Crate noodles_fasta

Source
Expand description

noodles-fasta handles and reading and writing of the FASTA format.

FASTA is a text format with no formal specification and only has de facto rules. It typically consists of a list of records, each with a definition on the first line and a sequence in the following lines.

The definition starts with a > (greater than) character, and directly after it is the reference sequence name. Optionally, whitespace may be used a delimiter for an extra description or metadata of the sequence. For example,

 reference sequence name
 | |
>sq0 LN:13
     |   |
     description

The sequence is effectively a byte array of characters representing a base. It is typically hard wrapped at an arbitrary width. For example, the following makes up the sequence ACGTNACTGG.

ACGT
NACT
GG

§Examples

§Read all records in a FASTA file

use noodles_fasta as fasta;

let mut reader = File::open("reference.fa")
    .map(BufReader::new)
    .map(fasta::io::Reader::new)?;

for result in reader.records() {
    let record = result?;
    // ...
}

Re-exports§

pub use self::io::indexed_reader;
pub use self::io::reader;
pub use self::io::writer;
pub use self::record::Record;
pub use self::repository::Repository;
pub use self::fs::index;
pub use self::io::IndexedReader;
pub use self::io::Reader;
pub use self::io::Writer;
pub use self::async::io::Reader as AsyncReader;

Modules§

async
Async FASTA.
fai
FASTA index (FAI) and fields.
fs
FASTA filesystem operations.
io
FASTA I/O.
record
FASTA record and definition.
repository
Sequence repository and adapters.
sequence
Sequence format.