Struct needletail::parser::FastaReader
source · pub struct FastaReader<R: Read> { /* private fields */ }
Expand description
Parser for FASTA files. Only use this directly if you know your file is FASTA and that it is not compressed as it does not handle decompression. If you are unsure, it’s better to use parse_fastx_file.
Implementations§
source§impl<R> Reader<R>where
R: Read,
impl<R> Reader<R>where R: Read,
sourcepub fn new(reader: R) -> Reader<R>
pub fn new(reader: R) -> Reader<R>
Creates a new reader with the default buffer size of 64 KiB
Example:
use needletail::parser::{FastaReader, FastxReader};
let fasta = b">id\nSEQUENCE";
let mut reader = FastaReader::new(&fasta[..]);
let record = reader.next().unwrap().unwrap();
assert_eq!(record.id(), b"id")
sourcepub fn with_capacity(reader: R, capacity: usize) -> Reader<R>
pub fn with_capacity(reader: R, capacity: usize) -> Reader<R>
Creates a new reader with a given buffer capacity. The minimum allowed capacity is 3.
Trait Implementations§
source§impl<R: Read + Send> FastxReader for Reader<R>
impl<R: Read + Send> FastxReader for Reader<R>
source§fn next(&mut self) -> Option<Result<SequenceRecord<'_>, ParseError>>
fn next(&mut self) -> Option<Result<SequenceRecord<'_>, ParseError>>
Gets the next record in the stream.
This imitates the Iterator API but does not support any iterator functions.
This returns None once we reached the EOF.
source§fn position(&self) -> &Position
fn position(&self) -> &Position
Returns the current line/byte in the stream we are reading from
source§fn line_ending(&self) -> Option<LineEnding>
fn line_ending(&self) -> Option<LineEnding>
Returns whether the current stream uses Windows or Unix style line endings
It is
None
only before calling next
, once next
has been called it will always
return a line ending.