Expand description
Neighbor-Joining phylogenetic tree inference library.
§Data flow
[FASTA / Python dict / JS object]
│
▼
NJConfig (config.rs)
│
▼
detect_alphabet() ──► Alphabet::DNA | Alphabet::Protein
│
▼
MSA<DNA|Protein> (msa.rs)
├── bootstrap() ──► bootstrap_clade_counts()
└── into_dist::<Model>()
│
▼
DistMat (dist.rs)
│
▼
neighbor_joining() ──► NJState::run() (nj.rs)
│
▼
TreeNode (tree.rs)
│
▼
to_newick() ──► Newick String§Public API
The single public entry point is nj, which accepts an NJConfig and
returns a Newick string. Everything else is internal implementation detail
exposed only to the Python and WASM wrapper crates.
§Model–alphabet compatibility
| Model | DNA | Protein |
|---|---|---|
PDiff | ✓ | ✓ |
JukesCantor | ✓ | — |
Kimura2P | ✓ | — |
Poisson | — | ✓ |
Providing an incompatible model returns an Err from nj.
Modules§
Structs§
- MSA
- A typed multiple sequence alignment (MSA).
- NJConfig
- Full configuration for a single Neighbor-Joining run.
- Sequence
Object - A single sequence in a multiple sequence alignment.
Functions§
- bootstrap_
clade_ counts - Performs bootstrap sampling and counts clades across bootstrap trees.
- count_
clades - Recursively counts how many times each non-trivial clade appears in
tree. - detect_
alphabet - Heuristically detects whether the MSA contains DNA or protein sequences.
- nj
- Infers a phylogenetic tree from an aligned MSA and returns a Newick string.