Struct noodles_fastq::Reader [−][src]
pub struct Reader<R> { /* fields omitted */ }
Expand description
A FASTQ reader.
Implementations
Creates a FASTQ reader.
Examples
use noodles_fastq as fastq;
let data = b"@r0\nATCG\n+\nNDLS\n";
let reader = fastq::Reader::new(&data[..]);
Returns a reference to the underlying reader.
Examples
use noodles_fastq as fastq;
let data = [];
let reader = fastq::Reader::new(&data[..]);
assert!(reader.get_ref().is_empty());
Returns a mutable reference to the underlying reader.
Examples
use noodles_fastq as fastq;
let data = [];
let mut reader = fastq::Reader::new(&data[..]);
assert!(reader.get_mut().is_empty());
Unwraps and returns the underlying reader.
Examples
use noodles_fastq as fastq;
let data = [];
let reader = fastq::Reader::new(&data[..]);
assert!(reader.into_inner().is_empty());
Reads a FASTQ record.
This reads from the underlying stream until four lines are read: the read name, the sequence, the plus line, and the quality scores. Each line omits the trailing newline.
The stream is expected to be at the start of a record.
If successful, the number of bytes read is returned. If the number of bytes read is 0, the stream reached EOF.
Examples
use noodles_fastq as fastq;
let data = b"@r0\nATCG\n+\nNDLS\n";
let mut reader = fastq::Reader::new(&data[..]);
let mut record = fastq::Record::default();
reader.read_record(&mut record)?;
assert_eq!(record.name(), b"r0");
assert_eq!(record.sequence(), b"ATCG");
assert_eq!(record.quality_scores(), b"NDLS");
Ok::<(), io::Error>(())
Returns an iterator over records starting from the current stream position.
The stream is expected to be at the start of a record.
Examples
use noodles_fastq as fastq;
let data = b"@r0\nATCG\n+\nNDLS\n";
let mut reader = fastq::Reader::new(&data[..]);
let mut records = reader.records();
assert_eq!(
records.next().transpose()?,
Some(fastq::Record::new("r0", "ATCG", "NDLS")
));
assert!(records.next().is_none());