[][src]Trait debruijn::Kmer

pub trait Kmer: Mer + Sized + Copy + PartialEq + PartialOrd + Eq + Ord + Hash {
    fn empty() -> Self;
fn k() -> usize;
fn to_u64(&self) -> u64;
fn from_u64(value: u64) -> Self;
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> { ... } }

Encapsulates a Kmer sequence with statically known K.

Required methods

fn empty() -> Self

Create a Kmer initialized to all A's

fn k() -> usize

K value for this concrete type.

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.

fn from_u64(value: u64) -> 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

Add the base v to the right side of the sequence, and remove the leftmost base

Loading content...

Provided methods

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

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)

Return the minimum of the kmer and it's reverse complement, and a flag indicating if sequence was flipped

fn min_rc(&self) -> Self

fn is_palindrome(&self) -> bool

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

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

Create a Kmer from the first K bytes of bytes, which must be encoded as ASCII letters A,C,G, or T.

fn to_string(&self) -> String

Return String containing Kmer sequence

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

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

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

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

Loading content...

Implementors

impl<T: PrimInt + FromPrimitive + Hash + IntHelp> Kmer for IntKmer<T>[src]

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

Shift the base v into the left end of the kmer

impl<T: PrimInt + FromPrimitive + Hash + IntHelp, KS: KmerSize> Kmer for VarIntKmer<T, KS>[src]

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

Shift the base v into the left end of the kmer

Loading content...