diff --git a/src/align/legacy/query_mapper.cpp b/src/align/legacy/query_mapper.cpp index e7ab1022..da4a88e0 100644 --- a/src/align/legacy/query_mapper.cpp +++ b/src/align/legacy/query_mapper.cpp @@ -310,7 +310,7 @@ void Target::inner_culling() filter_evalue = DBL_MAX; } for (list::iterator i = hsps.begin(); i != hsps.end();) { - if (i->is_enveloped_by(hsps.begin(), i, 0.5)) + if (i->query_range_enveloped_by(hsps.begin(), i, 0.5)) i = hsps.erase(i); else ++i; diff --git a/src/basic/hssp.cpp b/src/basic/hssp.cpp index 27baac67..6c18994f 100644 --- a/src/basic/hssp.cpp +++ b/src/basic/hssp.cpp @@ -233,6 +233,20 @@ bool Hsp::is_enveloped_by(std::list::const_iterator begin, std::list:: return false; } +bool Hsp::query_range_enveloped_by(const Hsp& hsp, double p) const +{ + return query_source_range.overlap_factor(hsp.query_source_range) >= p; +} + +bool Hsp::query_range_enveloped_by(std::list::const_iterator begin, std::list::const_iterator end, double p) const +{ + for (list::const_iterator i = begin; i != end; ++i) + if (query_range_enveloped_by(*i, p)) + return true; + return false; +} + + void Hsp::push_match(Letter q, Letter s, bool positive) { if (q == s) { diff --git a/src/basic/match.h b/src/basic/match.h index 123dcd5a..d5e836a7 100644 --- a/src/basic/match.h +++ b/src/basic/match.h @@ -217,6 +217,8 @@ struct Hsp bool is_enveloped_by(const Hsp &hsp, double p) const; bool is_enveloped_by(std::list::const_iterator begin, std::list::const_iterator end, double p) const; + bool query_range_enveloped_by(const Hsp& hsp, double p) const; + bool query_range_enveloped_by(std::list::const_iterator begin, std::list::const_iterator end, double p) const; bool is_weakly_enveloped_by(std::list::const_iterator begin, std::list::const_iterator end, int cutoff) const; void push_back(const DiagonalSegment &d, const TranslatedSequence &query, const Sequence& subject, bool reversed); void push_match(Letter q, Letter s, bool positive);