noodles_fasta/lib.rs
1//! **noodles-fasta** handles and reading and writing of the FASTA format.
2//!
3//! FASTA is a text format with no formal specification and only has de facto rules. It typically
4//! consists of a list of records, each with a definition on the first line and a sequence in the
5//! following lines.
6//!
7//! The definition starts with a `>` (greater than) character, and directly after it is the
8//! reference sequence name. Optionally, whitespace may be used a delimiter for an extra
9//! description or metadata of the sequence. For example,
10//!
11//! ```text
12//! reference sequence name
13//! | |
14//! >sq0 LN:13
15//! | |
16//! description
17//! ```
18//!
19//! The sequence is effectively a byte array of characters representing a base. It is typically
20//! hard wrapped at an arbitrary width. For example, the following makes up the sequence
21//! `ACGTNACTGG`.
22//!
23//! ```text
24//! ACGT
25//! NACT
26//! GG
27//! ```
28//!
29//! # Examples
30//!
31//! ## Read all records in a FASTA file
32//!
33//! ```no_run
34//! # use std::{fs::File, io::{self, BufReader}};
35//! use noodles_fasta as fasta;
36//!
37//! let mut reader = File::open("reference.fa")
38//! .map(BufReader::new)
39//! .map(fasta::io::Reader::new)?;
40//!
41//! for result in reader.records() {
42//! let record = result?;
43//! // ...
44//! }
45//! # Ok::<(), io::Error>(())
46//! ```
47
48#[cfg(feature = "async")]
49pub mod r#async;
50
51pub mod fai;
52pub mod fs;
53pub mod io;
54pub mod record;
55pub mod repository;
56pub mod sequence;
57
58pub use self::{record::Record, repository::Repository};