Function bio::alphabets::dna::complement

source ·
pub fn complement(a: u8) -> u8
Expand description

Return complement of given DNA alphabet character (IUPAC alphabet supported).

Casing of input character is preserved, e.g. ta, but TA. All Ns remain as they are.

use bio::alphabets::dna;

assert_eq!(dna::complement(65), 84); // A → T
assert_eq!(dna::complement(99), 103); // c → g
assert_eq!(dna::complement(78), 78); // N → N
assert_eq!(dna::complement(89), 82); // Y → R
assert_eq!(dna::complement(115), 115); // s → s