pub struct VarLenKmer<T: IntHelp + DeserializeOwned, const LEN: usize, KS: KmerSize> {
pub storage: [T; LEN],
pub phantom: PhantomData<KS>,
}Expand description
A fixed-length Kmer sequence that may not fill the bits of T
side: L R bases: 0 0 0 A C G T T bits: H …….. L bit : 14 12 10 8 6 4 2 0
sorting the integer will give a lexicographic sorting of the corresponding string.
kmers that don’t fill storage are always aligned to the least significant bits
Fields§
§storage: [T; LEN]§phantom: PhantomData<KS>Implementations§
Source§impl<T: IntHelp + DeserializeOwned, const LEN: usize, KS: KmerSize> VarLenKmer<T, LEN, KS>
impl<T: IntHelp + DeserializeOwned, const LEN: usize, KS: KmerSize> VarLenKmer<T, LEN, KS>
Sourcepub fn unused_bits_mask(n_bases: usize) -> T
pub fn unused_bits_mask(n_bases: usize) -> T
mask the unused bits at the top, plus the requested number of bases
Trait Implementations§
Source§impl<T: Clone + IntHelp + DeserializeOwned, const LEN: usize, KS: Clone + KmerSize> Clone for VarLenKmer<T, LEN, KS>
impl<T: Clone + IntHelp + DeserializeOwned, const LEN: usize, KS: Clone + KmerSize> Clone for VarLenKmer<T, LEN, KS>
Source§fn clone(&self) -> VarLenKmer<T, LEN, KS>
fn clone(&self) -> VarLenKmer<T, LEN, KS>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<T: Copy + IntHelp + DeserializeOwned, const LEN: usize, KS: Copy + KmerSize> Copy for VarLenKmer<T, LEN, KS>
Source§impl<T: IntHelp + DeserializeOwned, const LEN: usize, KS: KmerSize> Debug for VarLenKmer<T, LEN, KS>
impl<T: IntHelp + DeserializeOwned, const LEN: usize, KS: KmerSize> Debug for VarLenKmer<T, LEN, KS>
Source§impl<'de, T: IntHelp + DeserializeOwned, const LEN: usize, KS: KmerSize> Deserialize<'de> for VarLenKmer<T, LEN, KS>
impl<'de, T: IntHelp + DeserializeOwned, const LEN: usize, KS: KmerSize> Deserialize<'de> for VarLenKmer<T, LEN, KS>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<T: Eq + IntHelp + DeserializeOwned, const LEN: usize, KS: Eq + KmerSize> Eq for VarLenKmer<T, LEN, KS>
Source§impl<T: Hash + IntHelp + DeserializeOwned, const LEN: usize, KS: Hash + KmerSize> Hash for VarLenKmer<T, LEN, KS>
impl<T: Hash + IntHelp + DeserializeOwned, const LEN: usize, KS: Hash + KmerSize> Hash for VarLenKmer<T, LEN, KS>
Source§impl<T: IntHelp + DeserializeOwned, const LEN: usize, KS: KmerSize> Kmer for VarLenKmer<T, LEN, KS>
impl<T: IntHelp + DeserializeOwned, const LEN: usize, KS: KmerSize> Kmer for VarLenKmer<T, LEN, KS>
Source§fn extend_left(&self, v: u8) -> Self
fn extend_left(&self, v: u8) -> Self
Shift the base v into the left end of the kmer
Source§fn extend_right(&self, v: u8) -> Self
fn extend_right(&self, v: u8) -> Self
shift the base v into the right end of the k-mer
Source§fn 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.
Source§fn from_u64(_v: u64) -> Self
fn from_u64(_v: 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
Source§fn 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 sideSource§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 DirSource§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
Source§fn is_palindrome(&self) -> bool
fn is_palindrome(&self) -> bool
Test if this Kmer and it’s reverse complement are the same
Source§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.Source§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.Source§fn 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.Source§fn 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
Source§impl<T: IntHelp + DeserializeOwned, const LEN: usize, KS: KmerSize> Mer for VarLenKmer<T, LEN, KS>
impl<T: IntHelp + DeserializeOwned, const LEN: usize, KS: KmerSize> Mer for VarLenKmer<T, LEN, KS>
Source§impl<T: Ord + IntHelp + DeserializeOwned, const LEN: usize, KS: Ord + KmerSize> Ord for VarLenKmer<T, LEN, KS>
impl<T: Ord + IntHelp + DeserializeOwned, const LEN: usize, KS: Ord + KmerSize> Ord for VarLenKmer<T, LEN, KS>
Source§fn cmp(&self, other: &VarLenKmer<T, LEN, KS>) -> Ordering
fn cmp(&self, other: &VarLenKmer<T, LEN, KS>) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T: PartialEq + IntHelp + DeserializeOwned, const LEN: usize, KS: PartialEq + KmerSize> PartialEq for VarLenKmer<T, LEN, KS>
impl<T: PartialEq + IntHelp + DeserializeOwned, const LEN: usize, KS: PartialEq + KmerSize> PartialEq for VarLenKmer<T, LEN, KS>
Source§fn eq(&self, other: &VarLenKmer<T, LEN, KS>) -> bool
fn eq(&self, other: &VarLenKmer<T, LEN, KS>) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl<T: PartialOrd + IntHelp + DeserializeOwned, const LEN: usize, KS: PartialOrd + KmerSize> PartialOrd for VarLenKmer<T, LEN, KS>
impl<T: PartialOrd + IntHelp + DeserializeOwned, const LEN: usize, KS: PartialOrd + KmerSize> PartialOrd for VarLenKmer<T, LEN, KS>
Source§impl<T: IntHelp + DeserializeOwned, const LEN: usize, KS: KmerSize> Serialize for VarLenKmer<T, LEN, KS>
impl<T: IntHelp + DeserializeOwned, const LEN: usize, KS: KmerSize> Serialize for VarLenKmer<T, LEN, KS>
impl<T: PartialEq + IntHelp + DeserializeOwned, const LEN: usize, KS: PartialEq + KmerSize> StructuralPartialEq for VarLenKmer<T, LEN, KS>
Auto Trait Implementations§
impl<T, const LEN: usize, KS> Freeze for VarLenKmer<T, LEN, KS>where
T: Freeze,
impl<T, const LEN: usize, KS> RefUnwindSafe for VarLenKmer<T, LEN, KS>where
T: RefUnwindSafe,
KS: RefUnwindSafe,
impl<T, const LEN: usize, KS> Send for VarLenKmer<T, LEN, KS>
impl<T, const LEN: usize, KS> Sync for VarLenKmer<T, LEN, KS>
impl<T, const LEN: usize, KS> Unpin for VarLenKmer<T, LEN, KS>
impl<T, const LEN: usize, KS> UnsafeUnpin for VarLenKmer<T, LEN, KS>where
T: UnsafeUnpin,
impl<T, const LEN: usize, KS> UnwindSafe for VarLenKmer<T, LEN, KS>where
T: UnwindSafe,
KS: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> ConstructibleKey for T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
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
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreimpl<N> NodeTrait for N
§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
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
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
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
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.