Skip to content

Commit 7b92795

Browse files
jwcodeelcoombe
andauthored
gr-path: add log for number of valid reads visited when making a silver path (#132)
* gr-path: add log for number of valid reads visited when making a silver path * bin/goldrush: set verbose flag to on by default * goldrush_path.cpp: add space to log messages Co-authored-by: Lauren Coombe <lauren.e.coombe@gmail.com> --------- Co-authored-by: Lauren Coombe <lauren.e.coombe@gmail.com>
1 parent a5a1f7f commit 7b92795

File tree

2 files changed

+23
-11
lines changed

2 files changed

+23
-11
lines changed

bin/goldrush

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,11 @@ goldrush-path: $(p2).fa check-G check-reads clean
231231

232232
$(p2).fa: $(p1)_all.fq
233233
ifneq ($(k), 22)
234-
$(time) goldrush-path -k $(k) -w $(w) -t $(tile) -u $(u) -a $(a) -o $(o) -p $(p2) -i $< -h $(h) -j $(t) -P $(P) -d $(d) -x$(x) -g $(G) -b $(b) -m 0
234+
$(time) goldrush-path -k $(k) -w $(w) -t $(tile) -u $(u) -a $(a) -o $(o) -p $(p2) -i $< -h $(h) -j $(t) -P $(P) -d $(d) -x$(x) -g $(G) -b $(b) -m 0 --verbose
235235
else ifneq ($(w), 16)
236-
$(time) goldrush-path -k $(k) -w $(w) -t $(tile) -u $(u) -a $(a) -o $(o) -p $(p2) -i $< -h $(h) -j $(t) -P $(P) -d $(d) -x$(x) -g $(G) -b $(b) -m 0
236+
$(time) goldrush-path -k $(k) -w $(w) -t $(tile) -u $(u) -a $(a) -o $(o) -p $(p2) -i $< -h $(h) -j $(t) -P $(P) -d $(d) -x$(x) -g $(G) -b $(b) -m 0 --verbose
237237
else
238-
$(time) goldrush-path -k $(k) -w $(w) -t $(tile) -u $(u) -a $(a) -o $(o) -p $(p2) -i $< -h $(h) -j $(t) -P $(P) -d $(d) -x$(x) -s $(s) -g $(G) -b $(b) -m 0
238+
$(time) goldrush-path -k $(k) -w $(w) -t $(tile) -u $(u) -a $(a) -o $(o) -p $(p2) -i $< -h $(h) -j $(t) -P $(P) -d $(d) -x$(x) -s $(s) -g $(G) -b $(b) -m 0 --verbose
239239
endif
240240
echo "Done GoldRush-Path! Golden path can be found in: $@"
241241

@@ -244,11 +244,11 @@ $(p1)_all.fq: $(p1)_$(M).fq
244244

245245
$(p1)_$(M).fq: $(long_reads)
246246
ifneq ($(k), 22)
247-
$(time) goldrush-path -k $(k) -w $(w) -t $(tile) -u $(u) -a $(a) -o $(o) -p $(p1) -i $< -h $(h) -j $(t) -x$(x) -P $(P) -d $(d) -g $(G) -b $(b) -r $(r) --silver_path -M $(M) -m $(m)
247+
$(time) goldrush-path -k $(k) -w $(w) -t $(tile) -u $(u) -a $(a) -o $(o) -p $(p1) -i $< -h $(h) -j $(t) -x$(x) -P $(P) -d $(d) -g $(G) -b $(b) -r $(r) --silver_path -M $(M) -m $(m) --verbose
248248
else ifneq ($(w), 16)
249-
$(time) goldrush-path -k $(k) -w $(w) -t $(tile) -u $(u) -a $(a) -o $(o) -p $(p1) -i $< -h $(h) -j $(t) -x$(x) -P $(P) -d $(d) -g $(G) -b $(b) -r $(r) --silver_path -M $(M) -m $(m)
249+
$(time) goldrush-path -k $(k) -w $(w) -t $(tile) -u $(u) -a $(a) -o $(o) -p $(p1) -i $< -h $(h) -j $(t) -x$(x) -P $(P) -d $(d) -g $(G) -b $(b) -r $(r) --silver_path -M $(M) -m $(m) --verbose
250250
else
251-
$(time) goldrush-path -k $(k) -w $(w) -t $(tile) -u $(u) -a $(a) -o $(o) -p $(p1) -i $< -h $(h) -j $(t) -x$(x) -P $(P) -d $(d) -s $(s) -g $(G) -b $(b) -r $(r) --silver_path -M $(M) -m $(m)
251+
$(time) goldrush-path -k $(k) -w $(w) -t $(tile) -u $(u) -a $(a) -o $(o) -p $(p1) -i $< -h $(h) -j $(t) -x$(x) -P $(P) -d $(d) -s $(s) -g $(G) -b $(b) -r $(r) --silver_path -M $(M) -m $(m) --verbose
252252
endif
253253

254254
%.racon-polished.fa: %.fa.$(long_reads).sam %.fa

goldrush_path/goldrush_path.cpp

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,14 @@ silver_path_check(
5959
uint64_t& inserted_bases,
6060
uint64_t& curr_path,
6161
uint32_t& ids_inserted,
62-
MIBFConstructSupport<uint32_t, multiLensfrHashIterator>& miBFCS)
62+
MIBFConstructSupport<uint32_t, multiLensfrHashIterator>& miBFCS,
63+
uint32_t& valid_reads)
6364
{
6465
if (target_bases < inserted_bases) {
66+
if (opt::verbose) {
67+
std::cerr << "Visited " << valid_reads << " reads " << "to generate " << curr_path << " silver paths" << std::endl;
68+
69+
}
6570
++curr_path;
6671
if (opt::max_paths < curr_path) {
6772
exit(0);
@@ -762,7 +767,8 @@ process_read(const btllib::SeqReader::Record& record,
762767
uint32_t& id,
763768
uint32_t& ids_inserted,
764769
const size_t min_seq_len,
765-
const std::unordered_set<std::string>& filter_out_reads)
770+
const std::unordered_set<std::string>& filter_out_reads,
771+
uint32_t& valid_reads)
766772
{
767773
if (record.seq.size() < min_seq_len) {
768774
if (opt::debug) {
@@ -855,11 +861,13 @@ process_read(const btllib::SeqReader::Record& record,
855861
inserted_bases,
856862
curr_path,
857863
ids_inserted,
858-
miBFCS);
864+
miBFCS,
865+
valid_reads);
859866
}
860867
} else {
861868
if (num_assigned_tiles == num_tiles) {
862869
++id;
870+
++valid_reads;
863871
if (opt::debug) {
864872
std::cerr << "complete assignment" << std::endl;
865873
}
@@ -919,7 +927,8 @@ process_read(const btllib::SeqReader::Record& record,
919927
inserted_bases,
920928
curr_path,
921929
ids_inserted,
922-
miBFCS);
930+
miBFCS,
931+
valid_reads);
923932
}
924933
}
925934
}
@@ -931,6 +940,7 @@ process_read(const btllib::SeqReader::Record& record,
931940
// output read to wood path
932941
}
933942
++id;
943+
++valid_reads;
934944
if (id % 10000 == 0) {
935945
std::cerr << "processed " << id << " reads" << std::endl;
936946
}
@@ -1063,6 +1073,7 @@ main(int argc, char** argv)
10631073
uint64_t inserted_bases = 0;
10641074
uint64_t target_bases = opt::ratio * opt::genome_size;
10651075
uint64_t curr_path = 1;
1076+
uint32_t valid_reads = 0;
10661077
uint32_t id = 1;
10671078
uint32_t ids_inserted = 0;
10681079
// std::unordered_map<uint32_t, uint8_t> id_to_num_tiles_inserted;
@@ -1090,7 +1101,8 @@ main(int argc, char** argv)
10901101
id,
10911102
ids_inserted,
10921103
opt::min_length,
1093-
filter_out_reads);
1104+
filter_out_reads,
1105+
valid_reads);
10941106
}
10951107

10961108
}

0 commit comments

Comments
 (0)