Skip to main content

DnaSlice

Struct DnaSlice 

Source
pub struct DnaSlice<'a>(pub &'a [u8]);
Expand description

A newtype wrapper around a &[u8] with implementations of the Mer and Vmer traits.

Tuple Fields§

§0: &'a [u8]

Trait Implementations§

Source§

impl<'a> Debug for DnaSlice<'a>

Source§

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

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

impl Mer for DnaSlice<'_>

Source§

fn set_mut(&mut self, _pos: usize, _val: u8)

Set base at pos to 2-bit encoded base val

Source§

fn set_slice_mut(&mut self, _pos: usize, _nbases: usize, _value: u64)

Set nbases positions in the sequence, starting at pos. Values must be packed into the upper-most bits of value.

Source§

fn rc(&self) -> Self

Return a new object containing the reverse complement of the sequence

Source§

fn len(&self) -> usize

Length of DNA sequence
Source§

fn is_empty(&self) -> bool

True if the sequence is empty.
Source§

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

Get 2-bit encoded base at position pos
Source§

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

Iterate over the bases in the sequence
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§

impl<'a> Ord for DnaSlice<'a>

Source§

fn cmp(&self, other: &DnaSlice<'a>) -> 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<'a> PartialEq for DnaSlice<'a>

Source§

fn eq(&self, other: &DnaSlice<'a>) -> 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<'a> PartialOrd for DnaSlice<'a>

Source§

fn partial_cmp(&self, other: &DnaSlice<'a>) -> 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 Vmer for DnaSlice<'_>

Source§

fn new(_len: usize) -> Self

Create a new sequence with length len, initialized to all A’s

Source§

fn max_len() -> usize

Maximum sequence length that can be stored in this type

Source§

fn get_kmer<K: Kmer>(&self, pos: usize) -> K

Efficiently extract a Kmer from the sequence

Source§

fn from_slice(seq: &[u8]) -> Self

Create a Vmer from a sequence of bytes
Source§

fn first_kmer<K: Kmer>(&self) -> K

Get the first Kmer from the sequence
Source§

fn last_kmer<K: Kmer>(&self) -> K

Get the last kmer in the sequence
Source§

fn both_term_kmer<K: Kmer>(&self) -> (K, K)

Get the terminal kmer of the sequence, on the both side of the sequence
Source§

fn term_kmer<K: Kmer>(&self, dir: Dir) -> K

Get the terminal kmer of the sequence, on the side of the sequence given by dir
Source§

fn iter_kmers<K: Kmer>(&self) -> KmerIter<'_, K, Self>

Iterate over the kmers in the sequence
Source§

fn iter_kmer_exts<K: Kmer>(&self, seq_exts: Exts) -> KmerExtsIter<'_, K, Self>

Iterate over the kmers and their extensions, given the extensions of the whole sequence
Source§

impl<'a> Eq for DnaSlice<'a>

Source§

impl<'a> StructuralPartialEq for DnaSlice<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for DnaSlice<'a>

§

impl<'a> RefUnwindSafe for DnaSlice<'a>

§

impl<'a> Send for DnaSlice<'a>

§

impl<'a> Sync for DnaSlice<'a>

§

impl<'a> Unpin for DnaSlice<'a>

§

impl<'a> UnsafeUnpin for DnaSlice<'a>

§

impl<'a> UnwindSafe for DnaSlice<'a>

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
§

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
§

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, 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,