pub struct Kmer(pub u64);Expand description
A k-length nucleotide sequence represented as a 64-bit integer.
Tuple Fields§
§0: u64Implementations§
Source§impl Kmer
impl Kmer
Sourcepub fn make(seq: &str) -> Option<Kmer>
pub fn make(seq: &str) -> Option<Kmer>
convert a k-length string into a k-mer.
If k > 32 or the string contains letters other than
“A”, “C”, “G”, “T”, or “U”, None is returned.
Sourcepub fn make_many(k: usize, seq: &str) -> Vec<Kmer>
pub fn make_many(k: usize, seq: &str) -> Vec<Kmer>
Extract k-mers from a string.
Traverse the string seq and put all the valid k-mers in a vector.
Sourcepub fn with_many<S, F>(k: usize, seq: &S, f: F)
pub fn with_many<S, F>(k: usize, seq: &S, f: F)
Extract k-mers from a byte sequence and pass them to a closure.
Sourcepub fn with_many_both<S, F>(k: usize, seq: &S, f: F)
pub fn with_many_both<S, F>(k: usize, seq: &S, f: F)
Extract k-mers from both strands of a byte sequence.
Sourcepub fn frequency_vector<S>(k: usize, seq: &S) -> Vec<usize>
pub fn frequency_vector<S>(k: usize, seq: &S) -> Vec<usize>
Compute the frequency of k-mers on the forward strand of a sequence.
Compute a frequency vector with the number of instances in seq of
each of the 4**k possible k-mers.
Note that this is a dense representation, so the vector will have 4**k elements.
Sourcepub fn frequency_vector_both<S>(k: usize, seq: &S) -> Vec<usize>
pub fn frequency_vector_both<S>(k: usize, seq: &S) -> Vec<usize>
Compute the frequency of k-mers on both strands of a sequence.
Compute a frequency vector with the number of instances in seq of
each of the 4**k possible k-mers.
Note that this is a dense representation, so the vector will have 4**k elements.