Skip to content

phytreon

Phylogenetic trees and publication figures in Python — a layered library with a fluent figure-builder API and both static (matplotlib) and interactive (plotly) backends.

import phytreon as pt

tr = pt.datasets.primates()
(pt.TreeFigure(tr).tip_labels().support_labels()).save("tree.pdf")

Install

pip install phytreon                  # from PyPI
pip install phytreon[interactive]     # + plotly (interactive HTML backend)

Developing locally (from a clone of this repo):

pip install -e .                 # core
pip install -e .[interactive]    # + plotly backend
pip install -e .[dev]            # + pytest, plotly

What's inside

  • coreTree/Node model, Newick/Nexus/PhyloXML I/O, metadata join
  • layout — rectangular, slanted, dendrogram, circular, fan, radial, circular-slanted (straight diagonal edges), inward-circular, unrooted (equal-angle / equal-daylight)
  • infer — NJ/UPGMA (model-corrected distances), native ML for nucleotide (JC69/K80/HKY85/GTR) and protein (JTT/WAG/LG) data +Γ, NNI, AIC/model_finder, parsimony (reversible Fitch, or irreversible Camin-Sokal for single-cell lineage tracing from CRISPR scars or somatic mutations), expression-similarity dendrograms (expression_dendrogram -- not phylogenetic), bootstrap, built-in MSA, trimming
  • comparative — ancestral states (parsimony / Mk-ML ER·SYM·ARD / Brownian), stochastic mapping (stochastic_map)
  • plot — the TreeFigure builder: chain .tip_labels(), .tip_points(), .heatmap(), .ring() … onto a tree, then .save()

See the tutorials and the API reference. phytreon's core is validated in pure Python (validation/): the likelihood engine matches an independent naive implementation to machine precision, and NJ recovers a tree exactly from its own additive distances.