noodles_fasta/
lib.rs

1#![warn(missing_docs)]
2
3//! **noodles-fasta** handles and reading and writing of the FASTA format.
4//!
5//! FASTA is a text format with no formal specification and only has de facto rules. It typically
6//! consists of a list of records, each with a definition on the first line and a sequence in the
7//! following lines.
8//!
9//! The definition starts with a `>` (greater than) character, and directly after it is the
10//! reference sequence name. Optionally, whitespace may be used a delimiter for an extra
11//! description or metadata of the sequence. For example,
12//!
13//! ```text
14//!  reference sequence name
15//!  | |
16//! >sq0 LN:13
17//!      |   |
18//!      description
19//! ```
20//!
21//! The sequence is effectively a byte array of characters representing a base. It is typically
22//! hard wrapped at an arbitrary width. For example, the following makes up the sequence
23//! `ACGTNACTGG`.
24//!
25//! ```text
26//! ACGT
27//! NACT
28//! GG
29//! ```
30//!
31//! # Examples
32//!
33//! ## Read all records in a FASTA file
34//!
35//! ```no_run
36//! # use std::{fs::File, io::{self, BufReader}};
37//! use noodles_fasta as fasta;
38//!
39//! let mut reader = File::open("reference.fa")
40//!     .map(BufReader::new)
41//!     .map(fasta::io::Reader::new)?;
42//!
43//! for result in reader.records() {
44//!     let record = result?;
45//!     // ...
46//! }
47//! # Ok::<(), io::Error>(())
48//! ```
49
50#[cfg(feature = "async")]
51pub mod r#async;
52
53pub mod fai;
54pub mod fs;
55pub mod io;
56pub mod record;
57pub mod repository;
58pub mod sequence;
59
60#[deprecated(
61    since = "0.39.0",
62    note = "Use `noodles_fasta::io::indexed_reader` instead."
63)]
64pub use self::io::indexed_reader;
65
66#[deprecated(since = "0.39.0", note = "Use `noodles_fasta::io::reader` instead.")]
67pub use self::io::reader;
68
69#[deprecated(since = "0.39.0", note = "Use `noodles_fasta::io::writer` instead.")]
70pub use self::io::writer;
71
72pub use self::{record::Record, repository::Repository};
73
74#[deprecated(since = "0.39.0", note = "Use `noodles_fasta::fs::index` instead.")]
75pub use self::fs::index;
76
77#[deprecated(
78    since = "0.39.0",
79    note = "Use `noodles_fasta::io::IndexedReader` instead."
80)]
81pub use self::io::IndexedReader;
82
83#[deprecated(since = "0.39.0", note = "Use `noodles_fasta::io::Reader` instead.")]
84pub use self::io::Reader;
85
86#[deprecated(since = "0.39.0", note = "Use `noodles_fasta::io::Writer` instead.")]
87pub use self::io::Writer;
88
89#[cfg(feature = "async")]
90#[deprecated(
91    since = "0.45.0",
92    note = "Use `noodles_fasta::r#async::io::Reader` instead."
93)]
94pub use self::r#async::io::Reader as AsyncReader;