[][src]Function seq_io::fastx::dynamic::reader

pub fn reader<'s, R>(
    reader: R,
    multiline_fastq: bool
) -> Result<Option<Box<dyn FastxReader<R, StdPolicy, LineStore> + 's>>> where
    R: Read + 's, 

Recognizes the sequence format of the input and returns an appropriate FASTA or FASTQ reader as Box<dyn FastxReader<...> or None if the input has only empty lines.

reader is a convenience function for the most frequent case. If options need to be changed, use ReaderBuilder. The following two calls are equivalent:

This example is not tested
// using the reader() function:
let reader = seq_io::fastx::dynamic::reader(rdr, multiline_fastq).unwrap();

// using the builder API:
let reader = ReaderBuilder::new()
    .set_multiline_fastq(multiline_fastq)
    .from_reader(rdr)
    .unwrap();

If the first non-empty line starts with >, a fasta::Reader is returned. If it starts with @, fastq::Reader is returned if multiline_fastq is false, otherwise fastq::multiline::Reader is returned, If the first non-empty line contains an invalid start byte, an error with ErrorKind::InvalidStart will be returned.