pub struct FastaReader<R> { /* private fields */ }Expand description
Slab-style streaming FASTA reader over any Read input.
The reader accepts ordinary multiline FASTA. Header lines must begin with
>, sequence lines are concatenated without newline bytes, and blank lines
before the first record or between records are ignored.
Implementations§
Source§impl<R: Read> FastaReader<R>
impl<R: Read> FastaReader<R>
Sourcepub fn new(reader: R) -> Self
pub fn new(reader: R) -> Self
Create a reader with FastaConfig::default.
Sourcepub fn with_config(reader: R, config: FastaConfig) -> Self
pub fn with_config(reader: R, config: FastaConfig) -> Self
Create a reader with explicit configuration.
Sourcepub fn into_inner(self) -> R
pub fn into_inner(self) -> R
Return the wrapped reader.
Sourcepub fn next_batch(&mut self) -> Result<Option<FastaBatch<'_>>>
pub fn next_batch(&mut self) -> Result<Option<FastaBatch<'_>>>
Read the next batch of FASTA records.
Returns Ok(None) at EOF. A malformed non-empty line before the first
header is reported as a format error.
Sourcepub fn next_owned_batch(&mut self) -> Result<Option<OwnedFastaBatch>>
pub fn next_owned_batch(&mut self) -> Result<Option<OwnedFastaBatch>>
Read the next FASTA batch into an owned transferable buffer.
Sourcepub fn visit_records<F>(&mut self, visit: F) -> Result<()>
pub fn visit_records<F>(&mut self, visit: F) -> Result<()>
Visit every FASTA record in the stream.
This is a convenience path for single-pass consumers. It avoids the batch
record and identifier side tables used by next_batch.
Sourcepub fn visit_records_with_sink<S>(&mut self, sink: &mut S) -> Result<()>where
S: FastaRecordSink,
pub fn visit_records_with_sink<S>(&mut self, sink: &mut S) -> Result<()>where
S: FastaRecordSink,
Visit every FASTA record using a sink implementation.
Sourcepub fn stats(&mut self) -> Result<FastaStats>
pub fn stats(&mut self) -> Result<FastaStats>
Count all records and bases in an ordinary FASTA stream.
This uses the robust multiline FASTA parser, so it accepts wrapped
sequence records and blank lines in the same way as
next_batch.