Skip to main content

Kmer

Trait Kmer 

Source
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§

Source

fn empty() -> Self

Create a Kmer initialized to all A’s

Source

fn k() -> usize

K value for this concrete type.

Source

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.

Source

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.

Source

fn hamming_dist(&self, other: Self) -> u32

Source

fn extend_left(&self, v: u8) -> Self

Add the base v to the left side of the sequence, and remove the rightmost base

Source

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§

Source

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

Source

fn get_extensions(&self, exts: Exts, dir: Dir) -> Vec<Self>

Generate all the extension of this sequence given by exts in direction Dir

Source

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

Source

fn min_rc(&self) -> Self

Return the minimum of the kmer and it’s reverse complement

Source

fn is_palindrome(&self) -> bool

Test if this Kmer and it’s reverse complement are the same

Source

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.

Source

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.

Source

fn to_string(&self) -> String

Return String containing Kmer sequence

Source

fn kmers_from_bytes(str: &[u8]) -> Vec<Self>

Generate vector of all kmers contained in str encoded as 0-4.

Source

fn kmers_from_ascii(str: &[u8]) -> Vec<Self>

Generate vector of all kmers contained in str, encoded as ASCII ACGT.

Source

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.

Implementors§