1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
//! MAFFT multiple sequence alignment — high-level Rust API.
//!
//! This is the ergonomic entry point. Add it to your project with:
//!
//! ```text
//! cargo add mafft
//! ```
//!
//! and write:
//!
//! ```no_run
//! use mafft::{MafftEngine, AlignmentMode, SequenceSet, read_fasta};
//!
//! let input: SequenceSet = read_fasta("input.fasta").unwrap();
//! let engine = MafftEngine::new(AlignmentMode::FftNs2);
//! let msa = engine.align(&input);
//! for (name, seq) in msa.names.iter().zip(msa.sequences.iter()) {
//! println!(">{name}");
//! println!("{}", std::str::from_utf8(seq).unwrap());
//! }
//! ```
//!
//! # What this crate re-exports
//!
//! * [`mafft_core`] — alignment engine, modes, MSA result types
//! * [`mafft_types`] — `Sequence`, `SequenceSet`, scoring models, segment types
//! * [`mafft_io`] — FASTA / hat2 / localhom readers and writers
//!
//! Items from these crates are flattened into the root namespace below,
//! so most callers never need to write `mafft::core::` / `mafft::io::`
//! paths — `use mafft::*` is enough.
//!
//! # When to depend on the sub-crates directly
//!
//! Reach for `mafft-core` / `mafft-align` / `mafft-tree` / `mafft-scoring`
//! / `mafft-fft` directly only if you need to:
//!
//! * cut compile time by avoiding the I/O layer,
//! * pin a sub-crate to a specific version independently of the rest, or
//! * extend internals (e.g. custom guide trees, custom scoring matrices).
//!
//! For everything else, depend on `mafft`.
//!
//! # The command line's flag layer, in-process (`cli` feature)
//!
//! `MafftEngine` takes an [`AlignmentMode`]; the command line *chooses* one
//! (`--auto` from sequence count and length) and does more before the engine
//! runs (`--adjustdirection` strand detection, `--nuc` / `--amino` type
//! forcing, the residue case fold). Re-deriving any of that in a caller is
//! how it silently diverges from C MAFFT. With `features = ["cli"]` the
//! [`cli`] module re-exports the `mafft-rs` crate, whose entry points take
//! the same argv the shell would and go through the same code as the
//! binary:
//!
//! ```no_run
//! # #[cfg(feature = "cli")] {
//! use mafft::cli::{run_from_seqs, SilentProgress};
//! use mafft::{Sequence, SequenceSet, SeqType};
//!
//! let input = SequenceSet {
//! sequences: vec![
//! Sequence { name: "a".into(), data: b"atggctagcttggacc".to_vec() },
//! Sequence { name: "b".into(), data: b"atggctagcttgcacc".to_vec() },
//! ],
//! seq_type: SeqType::Dna,
//! };
//! // Same flags as `mafft --auto --adjustdirection --thread 1 --nuc FILE`,
//! // but the sequences stay in memory and the rows come back as a value.
//! let msa = run_from_seqs(
//! ["mafft", "--auto", "--adjustdirection", "--thread", "1", "--nuc"],
//! &input,
//! &SilentProgress,
//! )?;
//! assert_eq!(msa.names.len(), 2);
//! # }
//! # Ok::<(), Box<dyn std::error::Error>>(())
//! ```
//!
//! `run_from(argv, &mut out)` is the same thing with a FASTA file in and
//! formatted text out; `Mafft::new().auto().nuc().run_seqs(&input)` is the
//! typed builder over either.
//!
//! # Related crates
//!
//! * [`mafft-rs`](https://crates.io/crates/mafft-rs) — standalone CLI:
//! `cargo install mafft-rs`; also the crate behind the `cli` feature
//! * [`pymafft`](https://pypi.org/project/pymafft/) — Python bindings
//! (`pip install pymafft`)
pub use *;
pub use *;
pub use *;
/// The `mafft-rs` crate's argv-driven entry points (`run_from`,
/// `run_from_seqs`, `Mafft`, `MafftError`, `Progress`). Needs the `cli`
/// feature.
/// Sub-crate re-exports under explicit names, for callers who prefer
/// disambiguation over the flattened root namespace.
/// Sequence / scoring / segment types.
/// FASTA / hat2 / localhom I/O.