pub struct AsciiSeq<'s>(pub &'s [u8]);
Expand description
A &[u8]
representing an ASCII-encoded DNA sequence of ACGTacgt
.
Other characters will be mapped into [0, 4)
via (c>>1)&3
, or may cause panics.
Tuple Fields§
§0: &'s [u8]
Trait Implementations§
Source§impl<'s> MemDbgImpl for AsciiSeq<'s>where
&'s [u8]: MemDbgImpl,
impl<'s> MemDbgImpl for AsciiSeq<'s>where
&'s [u8]: MemDbgImpl,
fn _mem_dbg_rec_on( &self, _memdbg_writer: &mut impl Write, _memdbg_total_size: usize, _memdbg_max_depth: usize, _memdbg_prefix: &mut String, _memdbg_is_last: bool, _memdbg_flags: DbgFlags, ) -> Result
fn _mem_dbg_depth_on( &self, writer: &mut impl Write, total_size: usize, max_depth: usize, prefix: &mut String, field_name: Option<&str>, is_last: bool, padded_size: usize, flags: DbgFlags, ) -> Result<(), Error>
Source§impl<'s> Ord for AsciiSeq<'s>
impl<'s> Ord for AsciiSeq<'s>
1.21.0 · 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<'s> PartialOrd for AsciiSeq<'s>
impl<'s> PartialOrd for AsciiSeq<'s>
Source§impl<'s> Seq<'s> for AsciiSeq<'s>
Maps ASCII to [0, 4)
on the fly.
Prefer first packing into a PackedSeqVec
for storage.
impl<'s> Seq<'s> for AsciiSeq<'s>
Maps ASCII to [0, 4)
on the fly.
Prefer first packing into a PackedSeqVec
for storage.
Source§const BASES_PER_BYTE: usize = 1usize
const BASES_PER_BYTE: usize = 1usize
Each input byte stores a single character.
Source§const BITS_PER_CHAR: usize = 2usize
const BITS_PER_CHAR: usize = 2usize
But each output bp only takes 2 bits!
Source§fn to_vec(&self) -> AsciiSeqVec
fn to_vec(&self) -> AsciiSeqVec
Convert to an owned version.
Source§fn iter_bp(self) -> impl ExactSizeIterator<Item = u8> + Clone
fn iter_bp(self) -> impl ExactSizeIterator<Item = u8> + Clone
Iterate the basepairs in the sequence, assuming values in 0..4
.
NOTE: This is only efficient on x86_64 with BMI2
support for pext
.
Source§fn par_iter_bp(
self,
context: usize,
) -> (impl ExactSizeIterator<Item = S> + Clone, usize)
fn par_iter_bp( self, context: usize, ) -> (impl ExactSizeIterator<Item = S> + Clone, usize)
Iterate the basepairs in the sequence in 8 parallel streams, assuming values in 0..4
.
Source§type SeqVec = AsciiSeqVec
type SeqVec = AsciiSeqVec
The corresponding owned sequence type.
Source§fn get_ascii(&self, index: usize) -> u8
fn get_ascii(&self, index: usize) -> u8
Get the ASCII character at the given index, without mapping to
b
-bit values.Source§fn revcomp_as_u64(&self) -> u64
fn revcomp_as_u64(&self) -> u64
Convert a short sequence (kmer) to a packed representation of its reverse complement as
u64
.Source§fn to_revcomp(&self) -> AsciiSeqVec
fn to_revcomp(&self) -> AsciiSeqVec
Compute the reverse complement of this sequence.
Source§fn slice(&self, range: Range<usize>) -> Self
fn slice(&self, range: Range<usize>) -> Self
Get a sub-slice of the sequence.
range
indicates character indices.Source§fn par_iter_bp_delayed(
self,
context: usize,
delay: usize,
) -> (impl ExactSizeIterator<Item = (S, S)> + Clone, usize)
fn par_iter_bp_delayed( self, context: usize, delay: usize, ) -> (impl ExactSizeIterator<Item = (S, S)> + Clone, usize)
Iterate over 8 chunks of the sequence in parallel, returning two characters offset by
delay
positions. Read moreSource§fn par_iter_bp_delayed_2(
self,
context: usize,
delay1: usize,
delay2: usize,
) -> (impl ExactSizeIterator<Item = (S, S, S)> + Clone, usize)
fn par_iter_bp_delayed_2( self, context: usize, delay1: usize, delay2: usize, ) -> (impl ExactSizeIterator<Item = (S, S, S)> + Clone, usize)
Iterate over 8 chunks of the sequence in parallel, returning three characters:
the char added, the one
delay
positions before, and the one delay2
positions before. Read moreSource§fn cmp_lcp(&self, other: &Self) -> (Ordering, usize)
fn cmp_lcp(&self, other: &Self) -> (Ordering, usize)
Compare and return the LCP of the two sequences.
Source§fn bits_per_char(&self) -> usize
fn bits_per_char(&self) -> usize
Convenience function that returns
b=Self::BITS_PER_CHAR
.Source§fn to_word(&self) -> usize
fn to_word(&self) -> usize
👎Deprecated: Prefer
to_u64
.Convert a short sequence (kmer) to a packed representation as
usize
.Source§fn to_word_revcomp(&self) -> usize
fn to_word_revcomp(&self) -> usize
👎Deprecated: Prefer
revcomp_to_u64
.Convert a short sequence (kmer) to a packed representation of its reverse complement as
usize
.impl<'s> Copy for AsciiSeq<'s>
impl<'s> Eq for AsciiSeq<'s>
impl<'s> StructuralPartialEq for AsciiSeq<'s>
Auto Trait Implementations§
impl<'s> Freeze for AsciiSeq<'s>
impl<'s> RefUnwindSafe for AsciiSeq<'s>
impl<'s> Send for AsciiSeq<'s>
impl<'s> Sync for AsciiSeq<'s>
impl<'s> Unpin for AsciiSeq<'s>
impl<'s> UnwindSafe for AsciiSeq<'s>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> MemDbg for Twhere
T: MemDbgImpl,
impl<T> MemDbg for Twhere
T: MemDbgImpl,
Source§fn mem_dbg(&self, flags: DbgFlags) -> Result<(), Error>
fn mem_dbg(&self, flags: DbgFlags) -> Result<(), Error>
Writes to stderr debug infos about the structure memory usage, expanding
all levels of nested structures.
Source§fn mem_dbg_on(
&self,
writer: &mut impl Write,
flags: DbgFlags,
) -> Result<(), Error>
fn mem_dbg_on( &self, writer: &mut impl Write, flags: DbgFlags, ) -> Result<(), Error>
Writes to a
core::fmt::Write
debug infos about the structure memory
usage, expanding all levels of nested structures.Source§fn mem_dbg_depth(&self, max_depth: usize, flags: DbgFlags) -> Result<(), Error>
fn mem_dbg_depth(&self, max_depth: usize, flags: DbgFlags) -> Result<(), Error>
Writes to stderr debug infos about the structure memory usage as
mem_dbg
, but expanding only up to max_depth
levels of nested structures.Source§fn mem_dbg_depth_on(
&self,
writer: &mut impl Write,
max_depth: usize,
flags: DbgFlags,
) -> Result<(), Error>
fn mem_dbg_depth_on( &self, writer: &mut impl Write, max_depth: usize, flags: DbgFlags, ) -> Result<(), Error>
Writes to a
core::fmt::Write
debug infos about the structure memory
usage as mem_dbg_on
, but expanding only up to
max_depth
levels of nested structures.