29 releases (19 breaking)

0.20.0 Mar 14, 2023
0.18.0 Feb 3, 2023
0.17.0 Nov 18, 2022
0.12.0 Jul 5, 2022
0.2.0 Jul 30, 2021
Download history 146/week @ 2022-12-01 299/week @ 2022-12-08 109/week @ 2022-12-15 221/week @ 2022-12-22 121/week @ 2022-12-29 170/week @ 2023-01-05 125/week @ 2023-01-12 212/week @ 2023-01-19 162/week @ 2023-01-26 309/week @ 2023-02-02 342/week @ 2023-02-09 567/week @ 2023-02-16 274/week @ 2023-02-23 289/week @ 2023-03-02 317/week @ 2023-03-09 333/week @ 2023-03-16

1,244 downloads per month
Used in 16 crates (6 directly)

MIT license

200KB
4.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 std::{fs::File, io::{self, BufReader}};
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?;
    println!("{}\t{}", record.name(), record.sequence().len());
}
# Ok::<(), io::Error>(())

Dependencies

~0.8–5.5MB
~80K SLoC