pub struct SequencingRecord<'a> { /* private fields */ }Expand description
A zero-copy record used to write sequences to binary sequence files.
This struct provides a unified API for writing records to all binseq formats (BQ, VBQ, and CBQ). It uses borrowed references for zero-copy efficiency.
§Example
use binseq::SequencingRecordBuilder;
let record = SequencingRecordBuilder::default()
.s_seq(b"ACGTACGT")
.s_qual(b"IIIIFFFF")
.s_header(b"seq_001")
.flag(42)
.build()
.unwrap();Implementations§
Source§impl<'a> SequencingRecord<'a>
impl<'a> SequencingRecord<'a>
pub fn new( s_seq: &'a [u8], s_qual: Option<&'a [u8]>, s_header: Option<&'a [u8]>, x_seq: Option<&'a [u8]>, x_qual: Option<&'a [u8]>, x_header: Option<&'a [u8]>, flag: Option<u64>, ) -> Self
Sourcepub fn configured_size_cbq(
&self,
is_paired: bool,
has_flags: bool,
has_headers: bool,
has_qualities: bool,
) -> usize
pub fn configured_size_cbq( &self, is_paired: bool, has_flags: bool, has_headers: bool, has_qualities: bool, ) -> usize
Returns the configured size of this record for CBQ format.
CBQ uses columnar storage so there are no per-record length prefixes. This calculates the size based on writer configuration, ignoring any extra data in the record that the writer won’t use.
Sourcepub fn configured_size_vbq(
&self,
is_paired: bool,
has_flags: bool,
has_headers: bool,
has_qualities: bool,
bitsize: BitSize,
) -> usize
pub fn configured_size_vbq( &self, is_paired: bool, has_flags: bool, has_headers: bool, has_qualities: bool, bitsize: BitSize, ) -> usize
Returns the configured size of this record for VBQ format.
VBQ uses a row-based format with length prefixes for each field. This calculates the size based on writer configuration, ignoring any extra data in the record that the writer won’t use.
The VBQ record layout is:
- Flag (8 bytes, if
has_flags) s_len(8 bytes)x_len(8 bytes)s_seq(encoded, rounded up to 8-byte words)s_qual(raw bytes, ifhas_qualities)s_header_len+s_header(8 + len bytes, ifhas_headersands_headerpresent)x_seq(encoded, rounded up to 8-byte words, if paired)x_qual(raw bytes, ifhas_qualitiesand paired)x_header_len+x_header(8 + len bytes, ifhas_headersandx_headerpresent)
pub fn is_paired(&self) -> bool
pub fn has_flags(&self) -> bool
pub fn has_headers(&self) -> bool
pub fn has_qualities(&self) -> bool
Trait Implementations§
Source§impl<'a> Clone for SequencingRecord<'a>
impl<'a> Clone for SequencingRecord<'a>
Source§fn clone(&self) -> SequencingRecord<'a>
fn clone(&self) -> SequencingRecord<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<'a> Copy for SequencingRecord<'a>
Source§impl<'a> Default for SequencingRecord<'a>
impl<'a> Default for SequencingRecord<'a>
Source§fn default() -> SequencingRecord<'a>
fn default() -> SequencingRecord<'a>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<'a> Freeze for SequencingRecord<'a>
impl<'a> RefUnwindSafe for SequencingRecord<'a>
impl<'a> Send for SequencingRecord<'a>
impl<'a> Sync for SequencingRecord<'a>
impl<'a> Unpin for SequencingRecord<'a>
impl<'a> UnsafeUnpin for SequencingRecord<'a>
impl<'a> UnwindSafe for SequencingRecord<'a>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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