Skip to content

Commit

Permalink
fix: Allowed mismatches were -1 too small
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliusroemer committed Aug 30, 2023
1 parent e66d566 commit 609335a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages_rs/nextclade/src/align/seed_match2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ impl SeedMatch2 {
// counter to keep track of total number of mismatches in window
let mut forward_mismatches = 0;

while forward_mismatches < config.allowed_mismatches && length < max_length {
while forward_mismatches <= config.allowed_mismatches && length < max_length {
// remove first position in queue, decrement mismatch counter in case of mismatch
if mismatch_queue.pop_front().unwrap() {
forward_mismatches = forward_mismatches.saturating_sub(1);
Expand Down Expand Up @@ -159,7 +159,7 @@ impl SeedMatch2 {
// repeat in other direction
mismatch_queue = VecDeque::from(vec![false; config.window_size]);
let mut backward_mismatches = 0;
while backward_mismatches < config.allowed_mismatches && ref_pos > 0 && qry_pos > 0 {
while backward_mismatches <= config.allowed_mismatches && ref_pos > 0 && qry_pos > 0 {
if mismatch_queue.pop_front().unwrap() {
backward_mismatches = backward_mismatches.saturating_sub(1);
}
Expand Down

0 comments on commit 609335a

Please sign in to comment.