46 releases (breaking)

new 0.37.0 May 8, 2024
0.35.0 Mar 28, 2024
0.31.0 Dec 14, 2023
0.30.0 Oct 12, 2023
0.2.0 Jul 30, 2021

#1609 in Parser implementations

Download history 297/week @ 2024-01-18 821/week @ 2024-01-25 549/week @ 2024-02-01 755/week @ 2024-02-08 696/week @ 2024-02-15 877/week @ 2024-02-22 841/week @ 2024-02-29 984/week @ 2024-03-07 678/week @ 2024-03-14 501/week @ 2024-03-21 750/week @ 2024-03-28 520/week @ 2024-04-04 759/week @ 2024-04-11 709/week @ 2024-04-18 383/week @ 2024-04-25 463/week @ 2024-05-02

2,425 downloads per month
Used in 46 crates (7 directly)

MIT license

230KB
5K SLoC

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::Reader::new)?;

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

Dependencies

~1.4–3MB
~51K SLoC