Skip to content

Commit

Permalink
Merge pull request #49 from bacpop/i48-multi-palindrome
Browse files Browse the repository at this point in the history
Fix for multicopy palindromes
  • Loading branch information
johnlees authored Jul 14, 2023
2 parents 746bb6a + 7237159 commit 25a01e3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ska"
version = "0.3.1"
version = "0.3.2"
authors = [
"John Lees <[email protected]>",
"Simon Harris <[email protected]>",
Expand Down
11 changes: 9 additions & 2 deletions src/ska_dict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,14 @@ where
b'S'
}
}
_ => panic!("Palindrome middle base not W/S: {}", *b),
b'N' => b'N',
_ => panic!("Palindrome middle base not W/S: {}", *b as char),
}
})
.or_insert(match base {
0 | 2 => b'W', // A or T
1 | 3 => b'S', // C or G
_ => panic!("Base encoding error: {base}"),
_ => panic!("Base encoding error: {}", base as char),
});
}

Expand Down Expand Up @@ -280,6 +281,12 @@ mod tests {
test_obj.split_kmers.clear();
test_obj.add_palindrome_to_dict(789, 3);
assert_eq!(test_obj.split_kmers[&789], b'S');

// Test case 4: Updating existing twice
test_obj.split_kmers.insert(123, b'W');
test_obj.add_palindrome_to_dict(123, 1);
test_obj.add_palindrome_to_dict(123, 1);
assert_eq!(test_obj.split_kmers[&123], b'N');
}

#[test]
Expand Down

0 comments on commit 25a01e3

Please sign in to comment.