Skip to content

Commit

Permalink
Merge pull request #713 from vgteam/skip-N-mems
Browse files Browse the repository at this point in the history
remove MEMs that contain Ns
  • Loading branch information
ekg authored Mar 11, 2017
2 parents fdd117d + 6f30de0 commit 6d63861
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/mapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3532,9 +3532,11 @@ Mapper::find_mems_simple(string::const_iterator seq_begin,
mems.erase(std::remove_if(mems.begin(), mems.end(),
[&smems_begin,
&min_mem_length](const MaximalExactMatch& m) {
return m.end-m.begin == 0
|| m.length() < min_mem_length
|| smems_begin[m.begin] != m.end;
return ( m.end-m.begin == 0
|| m.length() < min_mem_length
|| smems_begin[m.begin] != m.end
|| m.count_Ns() > 0
);
}),
mems.end());
// return the matches in natural order
Expand Down Expand Up @@ -6721,6 +6723,11 @@ void MaximalExactMatch::fill_positions(Mapper* mapper) {
}
}

// counts Ns in the MEM
size_t MaximalExactMatch::count_Ns(void) const {
return std::count(begin, end, 'N');
}

ostream& operator<<(ostream& out, const MaximalExactMatch& mem) {
size_t len = mem.begin - mem.end;
out << mem.sequence() << ":";
Expand Down
2 changes: 2 additions & 0 deletions src/mapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class MaximalExactMatch {
int length(void) const;
// uses an xgindex to fill out the MEM positions
void fill_positions(Mapper* mapper);
// tells if the MEM contains an N
size_t count_Ns(void) const;

friend bool operator==(const MaximalExactMatch& m1, const MaximalExactMatch& m2);
friend bool operator<(const MaximalExactMatch& m1, const MaximalExactMatch& m2);
Expand Down

0 comments on commit 6d63861

Please sign in to comment.