Skip to content

Commit

Permalink
fix off-by-one bug in 'depth window'
Browse files Browse the repository at this point in the history
last window was skipped if window size divided reference length
  • Loading branch information
Artem Tarasov committed May 28, 2016
1 parent 742949a commit c228c63
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sambamba/depth.d
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ final class PerWindowPrinter : PerRegionPrinter {
printEmptyWindows(k);
moveToReference(column.ref_id);
} else if (column.ref_id != window_ref_id) {
while (leftmost_window_start_pos + window_size < ref_length)
while (leftmost_window_start_pos + window_size <= ref_length)
finishLeftMostWindow();
resetAllWindows();
foreach (k; window_ref_id + 1 .. column.ref_id)
Expand All @@ -1050,7 +1050,7 @@ final class PerWindowPrinter : PerRegionPrinter {
}

override void close() {
while (leftmost_window_start_pos + window_size < ref_length)
while (leftmost_window_start_pos + window_size <= ref_length)
finishLeftMostWindow();
foreach (k; window_ref_id + 1 .. bam.reference_sequences.length)
printEmptyWindows(cast(int)k);
Expand Down

0 comments on commit c228c63

Please sign in to comment.