Skip to content

Commit

Permalink
Fixed infinite loop in alt_hsp.
Browse files Browse the repository at this point in the history
  • Loading branch information
bbuchfink committed Nov 18, 2022
1 parent d6f6e70 commit cfc1524
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/align/alt_hsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct ActiveTarget {
masked_seq[h.frame] = dst.ptr(i++);
}
Letter* seq = masked_seq[h.frame];
std::fill(seq + h.subject_range.begin_, seq + h.subject_range.end_, MASK_LETTER);
std::fill(seq + h.subject_range.begin_, seq + h.subject_range.end_, SUPER_HARD_MASK);
}
}
Sequence masked(int32_t context) const {
Expand Down Expand Up @@ -85,7 +85,7 @@ static TargetVec recompute_alt_hsps(const Sequence* query_seq, const int query_s
ActiveTarget& t = targets[hsp.front().swipe_target];
list<Hsp>& l = t.match->hsp;
l.splice(l.end(), hsp, hsp.begin());
std::fill(t.masked_seq[context] + l.back().subject_range.begin_, t.masked_seq[context] + l.back().subject_range.end_, MASK_LETTER);
std::fill(t.masked_seq[context] + l.back().subject_range.begin_, t.masked_seq[context] + l.back().subject_range.end_, SUPER_HARD_MASK);
t.active |= 1 << context;
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/util/sequence/sequence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,11 @@ void get_title_def(const std::string& s, std::string& title, std::string& def)
}

bool is_fully_masked(const Sequence& seq) {
return std::count(seq.data(), seq.end(), MASK_LETTER) == seq.length();
Loc n = 0;
for (const Letter* p = seq.data(); p < seq.end(); ++p)
if (*p >= TRUE_AA)
++n;
return n == seq.length();
}

}}

0 comments on commit cfc1524

Please sign in to comment.