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 orderskip_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
impl FastqSet
Sourcepub fn template_segments(
&self,
) -> Filter<Iter<'_, FastqSegment>, fn(&&FastqSegment) -> bool> ⓘ
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
Sourcepub fn sample_barcode_segments(
&self,
) -> Filter<Iter<'_, FastqSegment>, fn(&&FastqSegment) -> bool> ⓘ
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
Sourcepub fn molecular_barcode_segments(
&self,
) -> Filter<Iter<'_, FastqSegment>, fn(&&FastqSegment) -> bool> ⓘ
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
Sourcepub fn cell_barcode_segments(
&self,
) -> Filter<Iter<'_, FastqSegment>, fn(&&FastqSegment) -> bool> ⓘ
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
Sourcepub fn combine_readsets(readsets: Vec<Self>) -> Self
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
Sourcepub fn from_record_with_structure(
header: &[u8],
sequence: &[u8],
quality: &[u8],
read_structure: &ReadStructure,
skip_reasons: &[SkipReason],
) -> Self
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 basesquality- The full quality scoresread_structure- The read structure describing segment layoutskip_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§
impl StructuralPartialEq for FastqSet
Auto Trait Implementations§
impl Freeze for FastqSet
impl RefUnwindSafe for FastqSet
impl Send for FastqSet
impl Sync for FastqSet
impl Unpin for FastqSet
impl UnsafeUnpin for FastqSet
impl UnwindSafe for FastqSet
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
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>
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>
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