Skip to content

Commit

Permalink
gr-path: add log for number of valid reads visited when making a silv…
Browse files Browse the repository at this point in the history
…er 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>
  • Loading branch information
jwcodee and lcoombe authored Apr 2, 2024
1 parent a5a1f7f commit 7b92795
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
12 changes: 6 additions & 6 deletions bin/goldrush
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,11 @@ goldrush-path: $(p2).fa check-G check-reads clean

$(p2).fa: $(p1)_all.fq
ifneq ($(k), 22)
$(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
$(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
else ifneq ($(w), 16)
$(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
$(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
else
$(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
$(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
endif
echo "Done GoldRush-Path! Golden path can be found in: $@"

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

$(p1)_$(M).fq: $(long_reads)
ifneq ($(k), 22)
$(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)
$(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
else ifneq ($(w), 16)
$(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)
$(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
else
$(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)
$(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
endif

%.racon-polished.fa: %.fa.$(long_reads).sam %.fa
Expand Down
22 changes: 17 additions & 5 deletions goldrush_path/goldrush_path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,14 @@ silver_path_check(
uint64_t& inserted_bases,
uint64_t& curr_path,
uint32_t& ids_inserted,
MIBFConstructSupport<uint32_t, multiLensfrHashIterator>& miBFCS)
MIBFConstructSupport<uint32_t, multiLensfrHashIterator>& miBFCS,
uint32_t& valid_reads)
{
if (target_bases < inserted_bases) {
if (opt::verbose) {
std::cerr << "Visited " << valid_reads << " reads " << "to generate " << curr_path << " silver paths" << std::endl;

}
++curr_path;
if (opt::max_paths < curr_path) {
exit(0);
Expand Down Expand Up @@ -762,7 +767,8 @@ process_read(const btllib::SeqReader::Record& record,
uint32_t& id,
uint32_t& ids_inserted,
const size_t min_seq_len,
const std::unordered_set<std::string>& filter_out_reads)
const std::unordered_set<std::string>& filter_out_reads,
uint32_t& valid_reads)
{
if (record.seq.size() < min_seq_len) {
if (opt::debug) {
Expand Down Expand Up @@ -855,11 +861,13 @@ process_read(const btllib::SeqReader::Record& record,
inserted_bases,
curr_path,
ids_inserted,
miBFCS);
miBFCS,
valid_reads);
}
} else {
if (num_assigned_tiles == num_tiles) {
++id;
++valid_reads;
if (opt::debug) {
std::cerr << "complete assignment" << std::endl;
}
Expand Down Expand Up @@ -919,7 +927,8 @@ process_read(const btllib::SeqReader::Record& record,
inserted_bases,
curr_path,
ids_inserted,
miBFCS);
miBFCS,
valid_reads);
}
}
}
Expand All @@ -931,6 +940,7 @@ process_read(const btllib::SeqReader::Record& record,
// output read to wood path
}
++id;
++valid_reads;
if (id % 10000 == 0) {
std::cerr << "processed " << id << " reads" << std::endl;
}
Expand Down Expand Up @@ -1063,6 +1073,7 @@ main(int argc, char** argv)
uint64_t inserted_bases = 0;
uint64_t target_bases = opt::ratio * opt::genome_size;
uint64_t curr_path = 1;
uint32_t valid_reads = 0;
uint32_t id = 1;
uint32_t ids_inserted = 0;
// std::unordered_map<uint32_t, uint8_t> id_to_num_tiles_inserted;
Expand Down Expand Up @@ -1090,7 +1101,8 @@ main(int argc, char** argv)
id,
ids_inserted,
opt::min_length,
filter_out_reads);
filter_out_reads,
valid_reads);
}

}
Expand Down

0 comments on commit 7b92795

Please sign in to comment.