DnaStringSlice

Struct DnaStringSlice 

Source
pub struct DnaStringSlice<'a> {
    pub dna_string: &'a DnaString,
    pub start: usize,
    pub length: usize,
    pub is_rc: bool,
}
Expand description

An immutable slice into a DnaString

Fields§

§dna_string: &'a DnaString§start: usize§length: usize§is_rc: bool

Implementations§

Source§

impl<'a> DnaStringSlice<'a>

Source

pub fn is_palindrome(&self) -> bool

Source

pub fn bytes(&self) -> Vec<u8>

Source

pub fn ascii(&self) -> Vec<u8>

Source

pub fn to_dna_string(&self) -> String

Source

pub fn to_string(&self) -> String

Source

pub fn to_owned(&self) -> DnaString

Source

pub fn slice(&self, start: usize, end: usize) -> DnaStringSlice<'_>

Get slice containing the interval [start, end) of self

Source

pub fn hamming_dist(&self, other: &DnaStringSlice<'_>) -> u32

Compute the Hamming distance between this DNA string and another

Trait Implementations§

Source§

impl<'a> Clone for DnaStringSlice<'a>

Source§

fn clone(&self) -> DnaStringSlice<'a>

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<'a> Debug for DnaStringSlice<'a>

Source§

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

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

impl<'a> IntoIterator for &'a DnaStringSlice<'a>

Source§

type Item = u8

The type of the elements being iterated over.
Source§

type IntoIter = MerIter<'a, DnaStringSlice<'a>>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a> Mer for DnaStringSlice<'a>

Source§

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

Get the base at position i.

Source§

fn set_mut(&mut self, _: usize, _: u8)

Set the base as position i.

Source§

fn len(&self) -> usize

Length of DNA sequence
Source§

fn set_slice_mut(&mut self, _: usize, _: usize, _: 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) -> DnaStringSlice<'a>

Return a new object containing the reverse complement of the sequence
Source§

fn iter<'a>(&'a self) -> MerIter<'a, 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> PartialEq for DnaStringSlice<'a>

Source§

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

Source§

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

Get the kmer starting at position pos

Source§

fn new(_: 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 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 DnaStringSlice<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for DnaStringSlice<'a>

§

impl<'a> RefUnwindSafe for DnaStringSlice<'a>

§

impl<'a> Send for DnaStringSlice<'a>

§

impl<'a> Sync for DnaStringSlice<'a>

§

impl<'a> Unpin for DnaStringSlice<'a>

§

impl<'a> UnwindSafe for DnaStringSlice<'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
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
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

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.