Skip to main content

reverse_complement

Function reverse_complement 

Source
pub fn reverse_complement(seq: &[u8]) -> Vec<u8> 
Expand description

Reverse complements a DNA sequence.

Returns the reverse complement of the input sequence, normalizing to uppercase. A<->T, C<->G, N and other bases are unchanged.

§Examples

use fgumi_dna::dna::reverse_complement;

assert_eq!(reverse_complement(b"ACGT"), b"ACGT".to_vec());
assert_eq!(reverse_complement(b"AAAA"), b"TTTT".to_vec());
assert_eq!(reverse_complement(b"ACGTN"), b"NACGT".to_vec());
assert_eq!(reverse_complement(b"acgt"), b"ACGT".to_vec());  // normalized to uppercase