Trait debruijn::Kmer [−][src]
pub trait Kmer: Mer + Sized + Copy + PartialEq + PartialOrd + Eq + Ord + Hash {
Show 17 methods
fn empty() -> Self;
fn k() -> usize;
fn to_u64(&self) -> u64;
fn from_u64(value: u64) -> Self;
fn hamming_dist(&self, other: Self) -> u32;
fn extend_left(&self, v: u8) -> Self;
fn extend_right(&self, v: u8) -> Self;
fn extend(&self, v: u8, dir: Dir) -> Self { ... }
fn get_extensions(&self, exts: Exts, dir: Dir) -> Vec<Self> { ... }
fn min_rc_flip(&self) -> (Self, bool) { ... }
fn min_rc(&self) -> Self { ... }
fn is_palindrome(&self) -> bool { ... }
fn from_bytes(bytes: &[u8]) -> Self { ... }
fn from_ascii(bytes: &[u8]) -> Self { ... }
fn to_string(&self) -> String { ... }
fn kmers_from_bytes(str: &[u8]) -> Vec<Self> { ... }
fn kmers_from_ascii(str: &[u8]) -> Vec<Self> { ... }
}
Expand description
Encapsulates a Kmer sequence with statically known K.
Required methods
Return the rank of this kmer in an lexicographic ordering of all kmers E.g. ‘AAAA’ -> 0, ‘AAAT’ -> 1, etc. This will panic if K > 32.
Construct a kmer from the given lexicographic rank of the kmer. If K > 32, the leads bases will be A’s.
fn hamming_dist(&self, other: Self) -> u32
fn extend_left(&self, v: u8) -> Self
fn extend_left(&self, v: u8) -> Self
Add the base v
to the left side of the sequence, and remove the rightmost base
fn extend_right(&self, v: u8) -> Self
fn extend_right(&self, v: u8) -> Self
Add the base v
to the right side of the sequence, and remove the leftmost base
Provided methods
Add the base v
to the side of sequence given by dir
, and remove a base at the opposite side
fn get_extensions(&self, exts: Exts, dir: Dir) -> Vec<Self>
fn get_extensions(&self, exts: Exts, dir: Dir) -> Vec<Self>
Generate all the extension of this sequence given by exts
in direction Dir
fn min_rc_flip(&self) -> (Self, bool)
fn min_rc_flip(&self) -> (Self, bool)
Return the minimum of the kmer and it’s reverse complement, and a flag indicating if sequence was flipped
fn is_palindrome(&self) -> bool
fn is_palindrome(&self) -> bool
Test if this Kmer and it’s reverse complement are the same
fn from_bytes(bytes: &[u8]) -> Self
fn from_bytes(bytes: &[u8]) -> Self
Create a Kmer from the first K bytes of bytes
, which must be encoded as the integers 0-4.
fn from_ascii(bytes: &[u8]) -> Self
fn from_ascii(bytes: &[u8]) -> Self
Create a Kmer from the first K bytes of bytes
, which must be encoded as ASCII letters A,C,G, or T.
Generate vector of all kmers contained in str
encoded as 0-4.