Skip to content

Commit

Permalink
Fix so that partial rescu hits are added properly
Browse files Browse the repository at this point in the history
  • Loading branch information
ksahlin committed Apr 22, 2024
1 parent cd10bd7 commit 7fe07b4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/nam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ std::vector<Nam> find_nams_rescue(
unsigned int count;
unsigned int query_start;
unsigned int query_end;
bool is_partial;

bool operator< (const RescueHit& rhs) const {
return std::tie(count, query_start, query_end)
Expand All @@ -290,7 +291,7 @@ std::vector<Nam> find_nams_rescue(
size_t position = index.find(qr.hash);
if (position != index.end()) {
unsigned int count = index.get_count(position);
RescueHit rh{position, count, qr.start, qr.end};
RescueHit rh{position, count, qr.start, qr.end, false};
if (qr.is_reverse){
hits_rc.push_back(rh);
} else {
Expand All @@ -304,7 +305,7 @@ std::vector<Nam> find_nams_rescue(
size_t partial_pos = index.partial_find(qr.hash);
if (partial_pos != index.end()) {
unsigned int partial_count = index.get_partial_count(partial_pos);
RescueHit rh{partial_pos, partial_count, qr.partial_start, qr.partial_end};
RescueHit rh{partial_pos, partial_count, qr.partial_start, qr.partial_end, true};
if (qr.is_reverse){
hits_rc.push_back(rh);
} else {
Expand All @@ -325,7 +326,11 @@ std::vector<Nam> find_nams_rescue(
if ((rh.count > rescue_cutoff && cnt >= 5) || rh.count > 1000) {
break;
}
add_to_hits_per_ref_full(hits_per_ref[is_revcomp], rh.query_start, rh.query_end, index, rh.position);
if (rh.is_partial){
add_to_hits_per_ref_partial(hits_per_ref[is_revcomp], rh.query_start, rh.query_end, index, rh.position);
} else{
add_to_hits_per_ref_full(hits_per_ref[is_revcomp], rh.query_start, rh.query_end, index, rh.position);
}
cnt++;
}
is_revcomp++;
Expand Down

0 comments on commit 7fe07b4

Please sign in to comment.