pub trait Kmer:
Mer
+ Sized
+ Copy
+ PartialEq
+ PartialOrd
+ Eq
+ Ord
+ Hash {
Show 18 methods
// Required 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;
// Provided methods
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> { ... }
fn has_low_complexity(&self) -> bool { ... }
}Expand description
Encapsulates a Kmer sequence with statically known K.
Required Methods§
Sourcefn to_u64(&self) -> u64
fn to_u64(&self) -> u64
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.
Sourcefn from_u64(value: u64) -> Self
fn from_u64(value: u64) -> Self
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
Sourcefn 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
Sourcefn 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§
Sourcefn extend(&self, v: u8, dir: Dir) -> Self
fn extend(&self, v: u8, dir: Dir) -> Self
Add the base v to the side of sequence given by dir, and remove a base at the opposite side
Sourcefn 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
Sourcefn 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
Sourcefn is_palindrome(&self) -> bool
fn is_palindrome(&self) -> bool
Test if this Kmer and it’s reverse complement are the same
Sourcefn 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.
Sourcefn 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.
Sourcefn kmers_from_bytes(str: &[u8]) -> Vec<Self>
fn kmers_from_bytes(str: &[u8]) -> Vec<Self>
Generate vector of all kmers contained in str encoded as 0-4.
Sourcefn kmers_from_ascii(str: &[u8]) -> Vec<Self>
fn kmers_from_ascii(str: &[u8]) -> Vec<Self>
Generate vector of all kmers contained in str, encoded as ASCII ACGT.
fn has_low_complexity(&self) -> bool
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.