From b0a804d1eb09feb19c6039c7610192f7ef5a5613 Mon Sep 17 00:00:00 2001 From: SimonVandeVyver Date: Wed, 11 Sep 2024 09:54:33 +0200 Subject: [PATCH] fix tests to only use characters of peptide alphabet --- sa-index/src/sa_searcher.rs | 10 +++++----- text-compression/src/lib.rs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sa-index/src/sa_searcher.rs b/sa-index/src/sa_searcher.rs index 7f60cbb..2324046 100644 --- a/sa-index/src/sa_searcher.rs +++ b/sa-index/src/sa_searcher.rs @@ -481,7 +481,7 @@ mod tests { } fn get_example_proteins() -> Proteins { - let input_string = "AI-BLACVAA-AC-KCRLZ$"; + let input_string = "AI-CLACVAA-AC-KCRLY$"; let text = ProteinText::from_string(input_string); Proteins { @@ -561,7 +561,7 @@ mod tests { assert_eq!(bounds_res, BoundSearchResult::SearchResult((13, 16))); // search bounds 'RIZ' with equal I and L - let bounds_res = searcher.search_bounds(&[b'R', b'I', b'Z']); + let bounds_res = searcher.search_bounds(&[b'R', b'I', b'Y']); assert_eq!(bounds_res, BoundSearchResult::SearchResult((17, 18))); } @@ -574,18 +574,18 @@ mod tests { let searcher = Searcher::new(sa, proteins, Box::new(suffix_index_to_protein)); // search bounds 'RIZ' with equal I and L - let found_suffixes = searcher.search_matching_suffixes(&[b'R', b'I', b'Z'], usize::MAX, true); + let found_suffixes = searcher.search_matching_suffixes(&[b'R', b'I', b'Y'], usize::MAX, true); assert_eq!(found_suffixes, SearchAllSuffixesResult::SearchResult(vec![16])); // search bounds 'RIZ' without equal I and L - let found_suffixes = searcher.search_matching_suffixes(&[b'R', b'I', b'Z'], usize::MAX, false); + let found_suffixes = searcher.search_matching_suffixes(&[b'R', b'I', b'Y'], usize::MAX, false); assert_eq!(found_suffixes, SearchAllSuffixesResult::NoMatches); } // test edge case where an I or L is the first index in the sparse SA. #[test] fn test_l_first_index_in_sa() { - let input_string = "LMOXZ$"; + let input_string = "LMPYY$"; let text = ProteinText::from_string(input_string); let proteins = Proteins { diff --git a/text-compression/src/lib.rs b/text-compression/src/lib.rs index 60b2463..b090826 100644 --- a/text-compression/src/lib.rs +++ b/text-compression/src/lib.rs @@ -16,7 +16,7 @@ impl ProteinText { fn create_char_to_5bit_hashmap() -> HashMap { let mut hashmap = HashMap::::new(); - for (i, c) in "ACDEFGHIKLMNPQRSTVWY-".chars().enumerate() { + for (i, c) in "ACDEFGHIKLMNPQRSTVWY-$".chars().enumerate() { hashmap.insert(c as u8, i as u8); } @@ -25,7 +25,7 @@ impl ProteinText { fn create_bit5_to_char() -> Vec { let mut vec = Vec::::new(); - for c in "ACDEFGHIKLMNPQRSTVWY-".chars() { + for c in "ACDEFGHIKLMNPQRSTVWY-$".chars() { vec.push(c as u8); } vec