Skip to main content

SequencingRecord

Struct SequencingRecord 

Source
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>

Source

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

Source

pub fn s_seq(&self) -> &'a [u8]

Returns the primary sequence

Source

pub fn s_qual(&self) -> Option<&'a [u8]>

Returns the primary quality scores if present

Source

pub fn s_header(&self) -> Option<&'a [u8]>

Returns the primary header if present

Source

pub fn x_seq(&self) -> Option<&'a [u8]>

Returns the extended/paired sequence if present

Source

pub fn x_qual(&self) -> Option<&'a [u8]>

Returns the extended quality scores if present

Source

pub fn x_header(&self) -> Option<&'a [u8]>

Returns the extended header if present

Source

pub fn flag(&self) -> Option<u64>

Returns the flag if present

Source

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.

Source

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, if has_qualities)
  • s_header_len + s_header (8 + len bytes, if has_headers and s_header present)
  • x_seq (encoded, rounded up to 8-byte words, if paired)
  • x_qual (raw bytes, if has_qualities and paired)
  • x_header_len + x_header (8 + len bytes, if has_headers and x_header present)
Source

pub fn is_paired(&self) -> bool

Source

pub fn has_flags(&self) -> bool

Source

pub fn has_headers(&self) -> bool

Source

pub fn has_qualities(&self) -> bool

Trait Implementations§

Source§

impl<'a> Clone for SequencingRecord<'a>

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for SequencingRecord<'a>

Source§

impl<'a> Default for SequencingRecord<'a>

Source§

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> 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V