pub struct FastqReader { /* private fields */ }Expand description
FASTQ file reader (streaming, memory-efficient)
Create using FastqReader::from_path() or FastqReader::from_buffer().
FASTQ format:
- Line 1: @ID description
- Line 2: Sequence
- Line 3: + (optional ID)
- Line 4: Quality
Implementations§
Source§impl FastqReader
impl FastqReader
Sourcepub fn from_buffer<R: BufRead + 'static>(reader: R) -> Self
pub fn from_buffer<R: BufRead + 'static>(reader: R) -> Self
Create a FASTQ reader from a buffered reader
This is the low-level constructor that accepts any buffered reader. Use this when you already have a BufRead source (e.g., from seeking to a specific position in a file for parallel processing).
§Example
use genomicframe_core::formats::fastq::FastqReader;
use std::io::BufReader;
use std::fs::File;
let file = File::open("reads.fastq")?;
let buf_reader = BufReader::new(file);
let mut reader = FastqReader::from_buffer(buf_reader);Sourcepub fn from_path<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn from_path<P: AsRef<Path>>(path: P) -> Result<Self>
Open a FASTQ file - handles .fastq, .fq, .fastq.gz, .fq.gz automatically
§Memory Behavior
- Opens file handle (~8KB buffer)
- Does NOT load reads into memory
- Records are parsed on-demand as you iterate
§Example
use genomicframe_core::formats::fastq::FastqReader;
use genomicframe_core::core::GenomicRecordIterator;
// Works with multi-GB files using only ~10KB RAM
let mut reader = FastqReader::from_path("reads.fastq.gz")?;
while let Some(record) = reader.next_record()? {
if record.mean_quality() >= 30.0 {
println!("High quality: {}", record.id);
}
}Sourcepub fn header(&self) -> &FastqHeader
pub fn header(&self) -> &FastqHeader
Get the FASTQ header metadata
Trait Implementations§
Source§impl GenomicReader for FastqReader
impl GenomicReader for FastqReader
Source§impl GenomicRecordIterator for FastqReader
impl GenomicRecordIterator for FastqReader
Source§type Record = FastqRecord
type Record = FastqRecord
The record type yielded by this iterator
Source§fn next_record(&mut self) -> Result<Option<Self::Record>>
fn next_record(&mut self) -> Result<Option<Self::Record>>
Advance to the next record Read more
Auto Trait Implementations§
impl Freeze for FastqReader
impl !RefUnwindSafe for FastqReader
impl !Send for FastqReader
impl !Sync for FastqReader
impl Unpin for FastqReader
impl UnsafeUnpin for FastqReader
impl !UnwindSafe for FastqReader
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> Filterable for T
impl<T> Filterable for T
Source§fn filter<F>(self, filter: F) -> FilteredReader<Self::Record, Self, F>where
F: RecordFilter<Self::Record>,
fn filter<F>(self, filter: F) -> FilteredReader<Self::Record, Self, F>where
F: RecordFilter<Self::Record>,
Apply a filter to this reader Read more
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