diff --git a/bitarray/src/lib.rs b/bitarray/src/lib.rs index e4bd8a2..78b6c60 100644 --- a/bitarray/src/lib.rs +++ b/bitarray/src/lib.rs @@ -85,7 +85,7 @@ impl BitArray { /// * `index` - The index of the value to set. /// * `value` - The value to set at the specified index. pub fn set(&mut self, index: usize, value: u64) { - let value: u64 = value.into(); + let value: u64 = value; let start_block = index * self.bits_per_value / 64; let start_block_offset = index * self.bits_per_value % 64; diff --git a/sa-index/src/sa_searcher.rs b/sa-index/src/sa_searcher.rs index 03abf07..f709fd6 100644 --- a/sa-index/src/sa_searcher.rs +++ b/sa-index/src/sa_searcher.rs @@ -178,11 +178,11 @@ impl Searcher { // match as long as possible while index_in_search_string < search_string.len() && index_in_suffix < self.proteins.text.len() - && (search_string[index_in_search_string] == self.proteins.text.get(index_in_suffix) as u8 + && (search_string[index_in_search_string] == self.proteins.text.get(index_in_suffix) || (search_string[index_in_search_string] == b'L' - && self.proteins.text.get(index_in_suffix) as u8 == b'I') + && self.proteins.text.get(index_in_suffix) == b'I') || (search_string[index_in_search_string] == b'I' - && self.proteins.text.get(index_in_suffix) as u8 == b'L')) + && self.proteins.text.get(index_in_suffix) == b'L')) { index_in_suffix += 1; index_in_search_string += 1; @@ -201,10 +201,10 @@ impl Searcher { search_string[index_in_search_string] }; - let protein_char = if self.proteins.text.get(index_in_suffix) as u8 == b'L' { + let protein_char = if self.proteins.text.get(index_in_suffix) == b'L' { b'I' } else { - self.proteins.text.get(index_in_suffix) as u8 + self.proteins.text.get(index_in_suffix) }; is_cond_or_equal = condition_check(peptide_char, protein_char); diff --git a/text-compression/src/lib.rs b/text-compression/src/lib.rs index 85e93b3..cac302f 100644 --- a/text-compression/src/lib.rs +++ b/text-compression/src/lib.rs @@ -73,7 +73,7 @@ impl ProteinText { /// # Returns /// /// An instance of `ProteinText` - pub fn from_vec(input_vec: &Vec) -> ProteinText { + pub fn from_vec(input_vec: &[u8]) -> ProteinText { let char_to_5bit = ProteinText::create_char_to_5bit_hashmap(); let bit5_to_char = ProteinText::create_bit5_to_char(); @@ -223,6 +223,10 @@ impl<'a> ProteinTextSlice<'a> { self.end - self.start } + pub fn is_empty(&self) -> bool { + self.len() == 0 + } + /// Checks if the slice and a given array of `u8` are equal. /// I and L can be equated. ///