Skip to content

Commit

Permalink
Merge pull request #3 from PacificBiosciences/bugfix_offset
Browse files Browse the repository at this point in the history
Bugfix offset
  • Loading branch information
holtjma authored Dec 5, 2024
2 parents ca6dcf8 + eff3354 commit 56c7421
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v0.4.4
## Bugs
* Fixed a panic caused by input sequences shorter than the offset compare length

# v0.4.3
## Bugs
* Fixed a panic caused by an unchecked `unwrap()` in a `trace!` statement
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "waffle_con"
version = "0.4.3"
version = "0.4.4"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
3 changes: 3 additions & 0 deletions src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,9 @@ impl ConsensusNode {

// build up the search space
let con_len = self.consensus.len();

// we need to truncate the compare length if it is longer than the sequence
let offset_compare_length = offset_compare_length.min(sequence.len());

// figure out how far back we search
let start_delta = offset_window + offset_compare_length; // we search from current back to the offset_window
Expand Down
3 changes: 3 additions & 0 deletions src/dual_consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,9 @@ impl DualConsensusNode {
vec![(&mut self.dwfas1, &self.consensus1)]
};

// we need to truncate the compare length if it is longer than the sequence
let offset_compare_length = offset_compare_length.min(sequence.len());

for (dwfas, consensus) in activators.into_iter() {
// make sure everything is currently inactive
assert!(dwfas[seq_index].is_none());
Expand Down

0 comments on commit 56c7421

Please sign in to comment.