#writer #file #name

noodles-fasta

FASTA format reader and writer

49 breaking releases

0.50.0 Mar 8, 2025
0.48.0 Jan 24, 2025
0.46.0 Dec 12, 2024
0.45.0 Oct 22, 2024
0.2.0 Jul 30, 2021

#177 in Biology

Download history 741/week @ 2024-12-04 1103/week @ 2024-12-11 915/week @ 2024-12-18 363/week @ 2024-12-25 1017/week @ 2025-01-01 1225/week @ 2025-01-08 1845/week @ 2025-01-15 1476/week @ 2025-01-22 2655/week @ 2025-01-29 3743/week @ 2025-02-05 1779/week @ 2025-02-12 1691/week @ 2025-02-19 1607/week @ 2025-02-26 2061/week @ 2025-03-05 1584/week @ 2025-03-12 1328/week @ 2025-03-19

6,979 downloads per month
Used in 66 crates (6 directly)

MIT license

265KB
6K 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::io::Reader::new)?;

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

Dependencies

~2–8MB
~61K SLoC