pub fn complement(base: u8) -> u8Expand description
Complement a single nucleotide as DNA, preserving case.
Bytes that are not nucleotide codes pass through unchanged, so gaps and padding survive.
U complements to A, and A complements to T — so complementing twice
turns RNA into DNA rather than returning the original byte. That is the only
sensible reading of a DNA complement, but it does mean the operation is not
an involution on RNA. Use complement_rna to keep uracil.
assert_eq!(complement(b'A'), b'T');
assert_eq!(complement(b'g'), b'c');
assert_eq!(complement(b'-'), b'-');
assert_eq!(complement(b'U'), b'A');
assert_eq!(complement(complement(b'U')), b'T'); // not 'U'