A lightweight toolkit for testing associations between phylogenetic trees and sample metadata
Project description
phylometa
phylometa is a lightweight Python toolkit for testing associations between phylogenetic trees and sample metadata.
It is designed for comparative genomics and phylogenomics workflows where users already have a tree and want to test whether categorical or continuous metadata show phylogenetic structure.
Features
- Check consistency between tree tips and metadata IDs
- Test phylogenetic clustering of categorical traits by permutation
- Test phylogenetic association of continuous traits using trait-distance vs patristic-distance correlation
- Run batch categorical tests across multiple traits
- Identify clades enriched for a categorical metadata value
- Plot metadata strips alongside a phylogenetic tree
Installation
pip install -e .
Input formats
Tree
- Newick format
Metadata
- TSV or CSV
- Must include a sample ID column matching tree tip names
Example metadata:
strain habitat antarctica ros_burden region
A soil no 11 Asia
B soil no 13 Asia
C ice yes 22 Antarctica
D lake no 14 Europe
Commands
Check tree and metadata compatibility
phylometa check \
--tree examples/demo_tree.nwk \
--meta examples/demo_meta.tsv \
--id-column strain
Test a categorical trait
phylometa test-categorical \
--tree examples/demo_tree.nwk \
--meta examples/demo_meta.tsv \
--id-column strain \
--trait habitat \
--n-perm 1000 \
--out categorical_results.tsv
Test multiple categorical traits
phylometa test-categorical-batch \
--tree examples/demo_tree.nwk \
--meta examples/demo_meta.tsv \
--id-column strain \
--traits habitat,antarctica,region \
--n-perm 1000 \
--out batch_results.tsv
Test a continuous trait
phylometa test-continuous \
--tree examples/demo_tree.nwk \
--meta examples/demo_meta.tsv \
--id-column strain \
--trait ros_burden \
--n-perm 1000 \
--out continuous_results.tsv
Test clade enrichment
phylometa clade-enrichment \
--tree examples/demo_tree.nwk \
--meta examples/demo_meta.tsv \
--id-column strain \
--trait antarctica \
--value yes \
--min-clade-size 2 \
--out enrichment_results.tsv
Plot metadata strips on a tree
phylometa plot \
--tree examples/demo_tree.nwk \
--meta examples/demo_meta.tsv \
--id-column strain \
--traits habitat,antarctica,ros_burden \
--out phylometa_plot.pdf
Output notes
test-categoricalreports within-group distance, between-group distance, and permutation p-valuestest-categorical-batchadditionally reports FDR-adjusted q-valuesclade-enrichmentreports Fisher’s exact test p-values and FDR-adjusted q-values- Missing metadata values are ignored in statistical tests and shown in gray in plots
Current scope
phylometa currently focuses on lightweight downstream association testing and visualization. It does not infer phylogenetic trees or perform ancestral-state reconstruction.
Planned improvements
- Better tree/strip alignment for large trees
- More advanced phylogenetic signal metrics
- HTML report generation
- Multiple-testing correction across mixed test types
- Publication-style figure themes
License
MIT
Project details
Release history Release notifications | RSS feed
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 phylometa-0.1.0.tar.gz.
File metadata
- Download URL: phylometa-0.1.0.tar.gz
- Upload date:
- Size: 12.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1c3fa05061bbb5ab867675c2be3c1717171cd678cbdefe143c69eb490c0f8fb
|
|
| MD5 |
c95ca4be6f73e874bc8858ca8dc2dccd
|
|
| BLAKE2b-256 |
e4f3ede48f03d166941a249e226ab2c2905aa9f865ee9f6812bffa4eed6d9064
|
File details
Details for the file phylometa-0.1.0-py3-none-any.whl.
File metadata
- Download URL: phylometa-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76c01658b1adfd1febd27956d9a12f1547ecffbadffc662227e482d8f2bbc1d0
|
|
| MD5 |
d6956257030e2a103811d336cc4fc2c0
|
|
| BLAKE2b-256 |
149654d67bca555b8ffe454e966617f8d4758e9795120f4edb1295110daaa699
|