Phylustrator
A small, composable plotter for evolutionary figures. Two domains share one grammar: ph.trees
plots phylogenetic trees and ph.genomes plots genomes, synteny and alignments. Start a figure,
add layers with +, and save it to SVG, PDF, or PNG.
Install
pip install git+https://github.com/AADavin/Phylustrator
SVG output needs nothing else; for PDF/PNG also install cairosvg (pip install cairosvg).
Trees
import phylustrator as ph
tree = ph.trees.loads("((((Human:6,Chimp:6)a:2,Gorilla:8)b:3,Orang:11)c:5,Gibbon:16)root;")
brain = {"Human": 1350, "Chimp": 400, "Gorilla": 500, "Orang": 400, "Gibbon": 100,
"a": 650, "b": 560, "c": 500, "root": 470}
(ph.trees.plot(tree)
+ ph.trees.color_branches(brain)
+ ph.trees.tip_labels()
+ ph.trees.colorbar("brain size (cc)")
+ ph.trees.time_axis("million years")).save("tree.png")
That is the whole idea: plot(tree) starts a figure and each + layer adds one decoration.
- Layouts —
rectangular(default),radial,unrooted. - Layers —
color_branches,color_history,tip_labels,node_labels,tip_track,branch_events,colorbar,legend,time_axis,time_marker,scale_bar,note,highlight_clade.
Genomes
The same grammar, for genome maps. Plot a genome as a line or a ring, colour genes by family or strand, link two genomes with synteny ribbons, or set a copy-number heatmap / alignment beside a tree.
import phylustrator as ph
G = ph.genomes.read_gff("genome.gff") # {name: Genome}
genome = next(iter(G.values()))
(ph.genomes.plot(genome, layout="circular", coordinates="nucleotide")
+ ph.genomes.genes(by="strand")
+ ph.genomes.position_axis()).save("ring.png")
- Layouts —
linear,circular, andstack(one genome per row, for synteny). - Layers —
genes,synteny,highlight,position_axis. - Panels —
heatmap,alignment, placed next to a tree withph.beside(tree, panel).
ZOMBI2 I/O
ph.zombi reads the output of the ZOMBI2 genome-evolution
simulator into the data models above — kept in one clearly-separated layer so the core stays
format-agnostic:
import phylustrator as ph
G = ph.zombi.read_genomes("run/genomes") # {lineage: Genome}
M = ph.zombi.read_profiles("run") # family x genome copy-number Matrix
aln = ph.zombi.read_alignment("run", family=0) # Alignment keyed by genome
tree = ph.zombi.read_species_tree("run") # a Tree
Command line
phyl is a one-shot tree viewer — hand it a Newick file:
phyl tree.nwk # render to a temporary PDF and open it
phyl tree.nwk -o fig.svg # save instead (format from the extension: .svg / .pdf / .png)
phyl tree.nwk --radial --no-labels
Flags: --layout {rectangular,radial,unrooted} (or --radial / --unrooted), --no-labels,
--node-labels, --no-stem, --no-open. Colouring and everything else live in the Python API.
Dependencies
Only drawsvg (plus cairosvg for PDF/PNG). No ete3, no matplotlib.
License
MIT — see LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file phylustrator-0.2.10.tar.gz.
File metadata
- Download URL: phylustrator-0.2.10.tar.gz
- Upload date:
- Size: 66.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1bd79656acc29c27516ad9d73ba6faa5a49c45214b83b1b7907283878a987e31
|
|
| MD5 |
60130c698c762daa12127a058d1a6693
|
|
| BLAKE2b-256 |
094c5c8f7016cc5d2e3e7a06633a673cbef257ff4c797679957cb5a8c5f43c80
|
Provenance
The following attestation bundles were made for phylustrator-0.2.10.tar.gz:
Publisher:
release.yml on AADavin/Phylustrator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
phylustrator-0.2.10.tar.gz -
Subject digest:
1bd79656acc29c27516ad9d73ba6faa5a49c45214b83b1b7907283878a987e31 - Sigstore transparency entry: 2466704828
- Sigstore integration time:
-
Permalink:
AADavin/Phylustrator@7c43ff0e6c902161651b8a219b1a5a8432ad071c -
Branch / Tag:
refs/tags/v0.2.10 - Owner: https://github.com/AADavin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7c43ff0e6c902161651b8a219b1a5a8432ad071c -
Trigger Event:
push
-
Statement type:
File details
Details for the file phylustrator-0.2.10-py3-none-any.whl.
File metadata
- Download URL: phylustrator-0.2.10-py3-none-any.whl
- Upload date:
- Size: 66.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e64c35ad8373f0eef81362a02c141f3fa69c709271586ddbe0c19d9f49f3b5a
|
|
| MD5 |
23170a9f109d430cf1f8321070978e30
|
|
| BLAKE2b-256 |
a4d1b345aea2dfea684fa41f5956d432c1bf562324e46703baa007206c121e7a
|
Provenance
The following attestation bundles were made for phylustrator-0.2.10-py3-none-any.whl:
Publisher:
release.yml on AADavin/Phylustrator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
phylustrator-0.2.10-py3-none-any.whl -
Subject digest:
0e64c35ad8373f0eef81362a02c141f3fa69c709271586ddbe0c19d9f49f3b5a - Sigstore transparency entry: 2466704834
- Sigstore integration time:
-
Permalink:
AADavin/Phylustrator@7c43ff0e6c902161651b8a219b1a5a8432ad071c -
Branch / Tag:
refs/tags/v0.2.10 - Owner: https://github.com/AADavin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7c43ff0e6c902161651b8a219b1a5a8432ad071c -
Trigger Event:
push
-
Statement type: