« Back to projects

rapidtrees

rapidtrees

Blazingly fast pairwise phylogenetic tree distance calculations powered by Rust

rapidtrees is a high-performance tool for computing pairwise phylogenetic tree distances from BEAST/NEXUS .trees files. It supports three distance metrics — Robinson–Foulds, Weighted RF, and Kuhner–Felsenstein — and outputs a labeled distance matrix in TSV format.

I built rapidtrees to address a recurring bottleneck in Bayesian phylogenetic analyses: comparing thousands of posterior trees is computationally expensive and slow in pure Python. By writing the core in Rust and exposing Python bindings via PyO3, the tool fits naturally into existing bioinformatics workflows while delivering orders-of-magnitude faster runtimes.

By implementing a bit vector representations for every tree’s bipartition (based on the work of Branco et al.), rapidtrees achieves blazing fast distance calculations, even for large tree sets in seconds. On a MacBook Pro M1, it can compute the full pairwise distance matrix for 1000 trees with 5000 taxa in under 30 seconds.

The tool is available as a standalone CLI (cargo install rapidtrees) and as a Python package (pip install rapidtrees) for seamless integration into NumPy-based workflows.