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[..]);

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());

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.