pub trait SeqVec:
Default
+ Sync
+ SerializeInner
+ DeserializeInner
+ MemSize
+ MemDbg
+ Clone
+ 'static {
type Seq<'s>: Seq<'s>;
Show 14 methods
// Required methods
fn as_slice(&self) -> Self::Seq<'_>;
fn len(&self) -> usize;
fn is_empty(&self) -> bool;
fn clear(&mut self);
fn into_raw(self) -> Vec<u8> ⓘ;
fn random(n: usize) -> Self;
fn push_seq(&mut self, seq: Self::Seq<'_>) -> Range<usize>;
fn push_ascii(&mut self, seq: &[u8]) -> Range<usize>;
// Provided methods
fn slice(&self, range: Range<usize>) -> Self::Seq<'_> { ... }
fn read_kmer(&self, k: usize, pos: usize) -> u64 { ... }
fn read_revcomp_kmer(&self, k: usize, pos: usize) -> u64 { ... }
fn read_kmer_u128(&self, k: usize, pos: usize) -> u128 { ... }
fn read_revcomp_kmer_u128(&self, k: usize, pos: usize) -> u128 { ... }
fn from_ascii(seq: &[u8]) -> Self { ... }
}
Expand description
An owned sequence.
Can be constructed from either ASCII input or the underlying non-owning Seq
type.
Implemented for:
- A
Vec<u8>
of ASCII characters, returning 8-bit values. - An
AsciiSeqVec
of DNA charactersACGT
, interpreted as 2-bit values. - A
PackedSeqVec
of packed DNA characters (4 per byte), returning 2-bit values.
Required Associated Types§
Required Methods§
Sourcefn as_slice(&self) -> Self::Seq<'_>
fn as_slice(&self) -> Self::Seq<'_>
Get a non-owning slice to the underlying sequence.
Unfortunately, Deref
into a Seq
can not be supported.
Sourcefn push_seq(&mut self, seq: Self::Seq<'_>) -> Range<usize>
fn push_seq(&mut self, seq: Self::Seq<'_>) -> Range<usize>
Append the given sequence to the underlying storage.
This may leave gaps (padding) between consecutively pushed sequences to avoid re-aligning the pushed data.
Returns the range of indices corresponding to the pushed sequence.
Use self.slice(range)
to get the corresponding slice.
Sourcefn push_ascii(&mut self, seq: &[u8]) -> Range<usize>
fn push_ascii(&mut self, seq: &[u8]) -> Range<usize>
Append the given ASCII sequence to the underlying storage.
This may leave gaps (padding) between consecutively pushed sequences to avoid re-aligning the pushed data.
Returns the range of indices corresponding to the pushed sequence.
Use self.slice(range)
to get the corresponding slice.
Provided Methods§
Sourcefn slice(&self, range: Range<usize>) -> Self::Seq<'_>
fn slice(&self, range: Range<usize>) -> Self::Seq<'_>
Get a sub-slice of the sequence. Indices are character offsets.
Sourcefn read_revcomp_kmer(&self, k: usize, pos: usize) -> u64
fn read_revcomp_kmer(&self, k: usize, pos: usize) -> u64
Extract a k-mer from this sequence.
Sourcefn read_kmer_u128(&self, k: usize, pos: usize) -> u128
fn read_kmer_u128(&self, k: usize, pos: usize) -> u128
Extract a k-mer from this sequence.
Sourcefn read_revcomp_kmer_u128(&self, k: usize, pos: usize) -> u128
fn read_revcomp_kmer_u128(&self, k: usize, pos: usize) -> u128
Extract a k-mer from this sequence.
Sourcefn from_ascii(seq: &[u8]) -> Self
fn from_ascii(seq: &[u8]) -> Self
Create a SeqVec
from ASCII input.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.