Skip to content

Commit

Permalink
fixed the feature where very long stretches of Ns aligned
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksey Zimin committed Sep 30, 2020
1 parent f75c9f2 commit 017e5df
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/umd/nucmer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,27 @@ void reverse_complement(std::string& s) {
*st = rc(*st);
}


void replace_n_random_letter(std::string& s) {
auto st = s.begin();
auto en = s.end() - 1;

for( ; st < en; ++st) {
if( *st == 'n' ){
int n=rand()%4;
if(n==0){
*st='a';
}else if(n==1){
*st='c';
}else if(n==2){
*st='g';
}else{
*st='t';
}
}
}
}

void SequenceAligner::align(const char* query, size_t query_len, std::vector<postnuc::Alignment>& alignments) {
std::vector<mgaps::Match_t> fwd_matches(1), bwd_matches(1);
FastaRecordSeq Query(query, query_len);
Expand Down Expand Up @@ -135,6 +156,7 @@ sequence_info::sequence_info(std::istream& data, size_t chunk_size) {
records.push_back({ sequence_offset, header_offset });
}
sequence += '`';
replace_n_random_letter(sequence);
records.push_back({ sequence.size(), headers.size() });
}

Expand Down

0 comments on commit 017e5df

Please sign in to comment.