Skip to main content

FastqSet

Struct FastqSet 

Source
pub struct FastqSet {
    pub header: Vec<u8>,
    pub segments: Vec<FastqSegment>,
    pub skip_reason: Option<SkipReason>,
}
Expand description

A FASTQ record parsed into its component segments according to a read structure.

When reading FASTQ files with complex structures (e.g., containing UMIs, barcodes, and template sequences), this structure holds the parsed segments along with the original header. Each segment is classified by type (template, molecular barcode, sample barcode, etc.).

§Fields

  • header - The original FASTQ header line (without the ‘@’ prefix)
  • segments - Vector of parsed segments in order
  • skip_reason - If Some, indicates why this read should be skipped during processing

Fields§

§header: Vec<u8>

The FASTQ header line (without ‘@’ prefix)

§segments: Vec<FastqSegment>

Ordered list of parsed segments from this read

§skip_reason: Option<SkipReason>

Reason for skipping this read, or None if the read should be processed

Implementations§

Source§

impl FastqSet

Source

pub fn template_segments( &self, ) -> Filter<Iter<'_, FastqSegment>, fn(&&FastqSegment) -> bool>

Returns an iterator over template segments.

Template segments contain the actual biological sequence to be analyzed (as opposed to barcodes or UMIs).

§Returns

Iterator over references to template segments in this read set

Source

pub fn sample_barcode_segments( &self, ) -> Filter<Iter<'_, FastqSegment>, fn(&&FastqSegment) -> bool>

Returns an iterator over sample barcode segments.

Sample barcodes identify which sample/library a read belongs to in multiplexed sequencing runs.

§Returns

Iterator over references to sample barcode segments

Source

pub fn molecular_barcode_segments( &self, ) -> Filter<Iter<'_, FastqSegment>, fn(&&FastqSegment) -> bool>

Returns an iterator over molecular barcode (UMI) segments.

Molecular barcodes (UMIs) uniquely tag individual molecules for duplicate detection and quantification.

§Returns

Iterator over references to molecular barcode segments

Source

pub fn cell_barcode_segments( &self, ) -> Filter<Iter<'_, FastqSegment>, fn(&&FastqSegment) -> bool>

Returns an iterator over cell barcode segments.

Cell barcodes identify which cell a read originated from in single-cell sequencing experiments.

§Returns

Iterator over references to cell barcode segments

Source

pub fn combine_readsets(readsets: Vec<Self>) -> Self

Combines multiple FastqSet instances into a single set.

Merges the segments from multiple read sets, preserving the header from the first set. Useful for combining segments from multiple FASTQ files that represent different parts of the same read (e.g., R1, R2, I1, I2).

§Arguments
  • readsets - Vector of read sets to combine
§Returns

A new FastqSet with all segments combined

§Panics

Panics if the input vector is empty or contains no segments

Source

pub fn from_record_with_structure( header: &[u8], sequence: &[u8], quality: &[u8], read_structure: &ReadStructure, skip_reasons: &[SkipReason], ) -> Self

Creates a FastqSet from raw FASTQ record data and a read structure.

This method applies the read structure to segment the sequence and quality data, producing a FastqSet with appropriately typed segments.

§Arguments
  • header - The FASTQ header/name (without ‘@’ prefix)
  • sequence - The full sequence bases
  • quality - The full quality scores
  • read_structure - The read structure describing segment layout
  • skip_reasons - List of reasons to skip reads gracefully instead of failing
§Returns

A FastqSet with segments parsed according to the read structure. If the read doesn’t have enough bases and TooFewBases is in skip_reasons, returns a FastqSet with skip_reason set.

§Panics

Panics if the read has too few bases and TooFewBases is not in skip_reasons.

Trait Implementations§

Source§

impl Clone for FastqSet

Source§

fn clone(&self) -> FastqSet

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 Debug for FastqSet

Source§

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

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

impl PartialEq for FastqSet

Source§

fn eq(&self, other: &FastqSet) -> 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 StructuralPartialEq for FastqSet

Auto Trait Implementations§

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