diff --git a/noodles-fasta/src/record/sequence/complement.rs b/noodles-fasta/src/record/sequence/complement.rs index 44ee37c3a..9449e2560 100644 --- a/noodles-fasta/src/record/sequence/complement.rs +++ b/noodles-fasta/src/record/sequence/complement.rs @@ -61,6 +61,23 @@ fn complement(b: u8) -> Result { b'H' => Ok(b'D'), b'V' => Ok(b'B'), b'N' => Ok(b'N'), + b'a' => Ok(b't'), + b'c' => Ok(b'g'), + b'g' => Ok(b'c'), + b't' => Ok(b'a'), + b'u' => Ok(b'a'), + b'w' => Ok(b'w'), + b's' => Ok(b's'), + b'm' => Ok(b'k'), + b'k' => Ok(b'm'), + b'r' => Ok(b'y'), + b'y' => Ok(b'r'), + b'b' => Ok(b'v'), + b'd' => Ok(b'h'), + b'h' => Ok(b'd'), + b'v' => Ok(b'b'), + b'n' => Ok(b'n'), + _ => Err(ComplementError(b)), } } @@ -96,6 +113,22 @@ mod tests { assert_eq!(complement(b'H'), Ok(b'D')); assert_eq!(complement(b'V'), Ok(b'B')); assert_eq!(complement(b'N'), Ok(b'N')); + assert_eq!(complement(b'a'), Ok(b't')); + assert_eq!(complement(b'c'), Ok(b'g')); + assert_eq!(complement(b'g'), Ok(b'c')); + assert_eq!(complement(b't'), Ok(b'a')); + assert_eq!(complement(b'u'), Ok(b'a')); + assert_eq!(complement(b'w'), Ok(b'w')); + assert_eq!(complement(b's'), Ok(b's')); + assert_eq!(complement(b'm'), Ok(b'k')); + assert_eq!(complement(b'k'), Ok(b'm')); + assert_eq!(complement(b'r'), Ok(b'y')); + assert_eq!(complement(b'y'), Ok(b'r')); + assert_eq!(complement(b'b'), Ok(b'v')); + assert_eq!(complement(b'd'), Ok(b'h')); + assert_eq!(complement(b'h'), Ok(b'd')); + assert_eq!(complement(b'v'), Ok(b'b')); + assert_eq!(complement(b'n'), Ok(b'n')); assert_eq!(complement(b'X'), Err(ComplementError(b'X'))); } }