rust-MAFFT¶
Pure-Rust port of MAFFT 7.526, byte-identical to the C reference.
Built on MAFFT
rust-MAFFT is a port — every algorithmic decision in this codebase traces back to work by Kazutaka Katoh and colleagues at CBRC. The FFT-anchored alignment algorithm, the iterative-refinement strategies, the scoring matrices, the PartTree heuristic — all of it is theirs. This project is engineering on top of their science. If you use it in published work, please cite the original MAFFT paper. See the Citation page for full details and BibTeX.
What it is¶
A complete rewrite of the MAFFT multiple sequence alignment toolchain in
Rust — no unsafe, no C at runtime, no global state. Output matches C
MAFFT 7.526 byte-for-byte across BAliBASE 3 (1930/1930 fixtures) for
every supported mode: FFT-NS-2, FFT-NS-i, G-INS-i, L-INS-i, E-INS-i,
PartTree, --add, --adjustdirection, and more.
Three ways to use it¶
-
As a Rust library
Programmatic access from any Rust project. See the Rust API on docs.rs.
-
As a Python package
Native bindings via PyO3. Drop-in Biopython interop. See the Python API.
-
As a CLI binary
# via cargo cargo install mafft-rs # or via pip (also bundles the binary) pip install pymafft # or pre-built from GitHub releasesSee the CLI Reference.
Why byte-identity matters¶
MAFFT is the de facto MSA reference for bioinformatics workflows. A Rust port that drifts even one tie-break from the C output forces every downstream pipeline to choose: re-validate the rewrite, or maintain a parallel C dependency. Byte-identity removes that choice — the Rust binary is a drop-in replacement.
The Byte-identity page documents the design decisions, FFT tie-break ports, FP-order constraints, and cross-validation infrastructure (99 FFI test functions against the C implementation, compiled in-tree on the same platform).
Status¶
- All standard modes: byte-identical across BAliBASE 3.
- Stub-parity flags (
--pdbidlist,--pdbfilelist): match C MAFFT's "temporarily unavailable, 2018/Dec." exit verbatim — these were disabled upstream. - DNA: byte-identical on nucleotide input too (pair-phase gap scale,
dndpreoffset, lowercase output,--nuc/--amino), including C's distinct--thread 1refinement path. - In-memory API:
mafft_rs::run_from_seqs/Mafft::run_seqsandpymafft.align(...)share the CLI's flag layer, so--auto,--adjustdirection,--nucbehave identically from Rust, Python and the shell. - Out of scope / residuals: see the architecture index.