Skip to main content

Reads

Struct Reads 

Source
pub struct Reads<D> { /* private fields */ }
Expand description

Store many DNA sequences together with an Exts and data each compactly packed together

§fields:
  • storage: Vec with 2-bit encoded DNA bases of all sequences
  • ends: Vec with the ends (exclusive) of the separate sequences in the Reads
  • exts: Option<Vec> with one Exts for each sequence
  • data: Vec with data for each sequence
  • len: length of all sequences together
  • stranded: [Stranded] conveying the strandedness and direction of the reads

Implementations§

Source§

impl<D: Clone + Copy> Reads<D>

Source

pub fn new(stranded: Strandedness) -> Self

Returns a new Reads

Source

pub fn new_with_quality(stranded: Strandedness) -> Self

Source

pub fn stranded(&self) -> Strandedness

Source

pub fn n_reads(&self) -> usize

Returns the number of reads stored

Source

pub fn mem(&self) -> usize

get the memory required for the reads

Source

pub fn set_stranded(&mut self, stranded: Strandedness)

set the strandedness and the direction of the reads

Source

pub fn set_custom_quality_bins(&mut self, quality_bins: QualityBins)

set custom quality bins

Source

pub fn add_read<V: Vmer>( &mut self, seq: V, exts: Option<Exts>, data: D, quality_scores: Option<&[u8]>, )

Adds a new read to the Reads

Source

pub fn from_vmer_vec<V: Vmer, S: IntoIterator<Item = (V, Exts, D)>>( vec_iter: S, stranded: Strandedness, ) -> Self

Transforms a [(vmer, exts, data)] into a Reads - watch for memory usage

Source

pub fn add_from_bytes(&mut self, bytes: &[u8], exts: Option<Exts>, data: D)

add ASCII encoded bases to the Reads

will transform all ascii characters outside of ACGTacgt into A

if Reads previously contained no exts, no new exts will be added see also: Reads::add_from_bytes_checked

Source

pub fn add_from_bytes_checked( &mut self, bytes: &[u8], exts: Option<Exts>, data: D, ) -> bool

add ASCII encoded bases to the Reads

will return false if the bytes contained characters outside of ACGTacgt, otherwise return true and add the bases see also: Reads::add_from_bytes

Source

pub fn get_read(&self, i: usize) -> Option<Read<D>>

get the ith read in a Reads

Source

pub fn shrink_to_fit(&mut self)

shrink the vectors’ capacity to fit the length

use sparsely

Source

pub fn iter(&self) -> ReadsIter<'_, D>

Iterate over the reads as (DnaString, Exts, D).

Source

pub fn partial_iter(&self, range: Range<usize>) -> ReadsIter<'_, D>

Iterate over a range start reads as (DnaString, Exts, D).

Source

pub fn info(&self) -> String

Source§

impl<D: ReadData> Reads<D>

Source

pub fn tag_kmers(&self, k: usize) -> HashMap<Tag, usize>

get the number of k-mers for each unique data value

Trait Implementations§

Source§

impl<D: Clone> Clone for Reads<D>

Source§

fn clone(&self) -> Reads<D>

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<D: Debug> Debug for Reads<D>

Source§

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

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

impl<D: Clone + Copy> Default for Reads<D>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de, D> Deserialize<'de> for Reads<D>
where D: Deserialize<'de>,

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<D: Clone + Copy + Debug> Display for Reads<D>

Source§

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

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

impl<D: Hash> Hash for Reads<D>

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<D: Ord> Ord for Reads<D>

Source§

fn cmp(&self, other: &Reads<D>) -> 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<D: PartialEq> PartialEq for Reads<D>

Source§

fn eq(&self, other: &Reads<D>) -> 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<D: PartialOrd> PartialOrd for Reads<D>

Source§

fn partial_cmp(&self, other: &Reads<D>) -> 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<D> Serialize for Reads<D>
where D: Serialize,

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<D: Eq> Eq for Reads<D>

Source§

impl<D> StructuralPartialEq for Reads<D>

Auto Trait Implementations§

§

impl<D> Freeze for Reads<D>

§

impl<D> RefUnwindSafe for Reads<D>
where D: RefUnwindSafe,

§

impl<D> Send for Reads<D>
where D: Send,

§

impl<D> Sync for Reads<D>
where D: Sync,

§

impl<D> Unpin for Reads<D>
where D: Unpin,

§

impl<D> UnsafeUnpin for Reads<D>

§

impl<D> UnwindSafe for Reads<D>
where D: 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
§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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>,

§

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

Source§

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