Skip to main content

IntKmer

Struct IntKmer 

Source
pub struct IntKmer<T: PrimInt + FromPrimitive + IntHelp + Sized> {
    pub storage: T,
}
Expand description

A Kmer sequence with a statically know K. K will fill the underlying integer type.

Fields§

§storage: T

Implementations§

Source§

impl<T: PrimInt + FromPrimitive + Hash + IntHelp + Sized> IntKmer<T>

Source

pub fn top_mask(n_bases: usize) -> T

Source

pub fn bottom_mask(n_bases: usize) -> T

Trait Implementations§

Source§

impl<T: Clone + PrimInt + FromPrimitive + IntHelp + Sized> Clone for IntKmer<T>

Source§

fn clone(&self) -> IntKmer<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: PrimInt + FromPrimitive + Hash + IntHelp> Debug for IntKmer<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de, T> Deserialize<'de> for IntKmer<T>

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<T: Hash + PrimInt + FromPrimitive + IntHelp + Sized> Hash for IntKmer<T>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

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

Source§

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

Shift the base v into the left end of the kmer

Source§

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

Hamming distance between this kmer and another kmer

Source§

fn empty() -> Self

Create a Kmer initialized to all A’s
Source§

fn k() -> usize

K value for this concrete type.
Source§

fn from_u64(v: u64) -> IntKmer<T>

Construct a kmer from the given lexicographic rank of the kmer. If K > 32, the leads bases will be A’s.
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 extend_right(&self, v: u8) -> Self

Add the base v to the right side of the sequence, and remove the leftmost base
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

Source§

impl<T: PrimInt + FromPrimitive + Hash + IntHelp> Mer for IntKmer<T>

Source§

fn get(&self, pos: usize) -> u8

Get the letter at the given position.

Source§

fn set_slice_mut(&mut self, pos: usize, n_bases: usize, value: u64)

Set a slice of bases in the kmer, using the packed representation in value. Sets n_bases, starting at pos. Bases must always be packed into the upper-most bits of the value.

Source§

fn rc(&self) -> Self

Return the reverse complement of this kmer

Source§

fn len(&self) -> usize

Length of DNA sequence
Source§

fn is_empty(&self) -> bool

True if the sequence is empty.
Source§

fn set_mut(&mut self, pos: usize, v: u8)

Set base at pos to 2-bit encoded base val
Source§

fn at_count(&self) -> u32

Count the number of A/T bases in the kmer
Source§

fn gc_count(&self) -> u32

Count the number of G/C bases in the kmer
Source§

fn iter(&self) -> MerIter<'_, Self>

Iterate over the bases in the sequence
Source§

impl<T: Ord + PrimInt + FromPrimitive + IntHelp + Sized> Ord for IntKmer<T>

Source§

fn cmp(&self, other: &IntKmer<T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T: PartialEq + PrimInt + FromPrimitive + IntHelp + Sized> PartialEq for IntKmer<T>

Source§

fn eq(&self, other: &IntKmer<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: PartialOrd + PrimInt + FromPrimitive + IntHelp + Sized> PartialOrd for IntKmer<T>

Source§

fn partial_cmp(&self, other: &IntKmer<T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<T> Serialize for IntKmer<T>

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<T: Copy + PrimInt + FromPrimitive + IntHelp + Sized> Copy for IntKmer<T>

Source§

impl<T: Eq + PrimInt + FromPrimitive + IntHelp + Sized> Eq for IntKmer<T>

Source§

impl<T: PrimInt + FromPrimitive + IntHelp + Sized> StructuralPartialEq for IntKmer<T>

Auto Trait Implementations§

§

impl<T> Freeze for IntKmer<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for IntKmer<T>
where T: RefUnwindSafe,

§

impl<T> Send for IntKmer<T>
where T: Send,

§

impl<T> Sync for IntKmer<T>
where T: Sync,

§

impl<T> Unpin for IntKmer<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for IntKmer<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for IntKmer<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> MerImmut for T
where T: Mer + Clone,

Source§

fn set(&self, pos: usize, val: u8) -> Self

Source§

fn set_slice(&self, pos: usize, nbases: usize, bits: u64) -> Self

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> ConstructibleKey for T
where T: Hash + Debug + PartialEq + Send + Sync,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<N> NodeTrait for N
where N: Copy + Ord + Hash,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,