Skip to main content

PhytClust takes a phylogenetic tree as input and outputs monophyletic leaf clusters that best fit the tree structure.

Project description

PhytClust

Monophyletic, dynamic-programming clustering of phylogenetic trees.

PhytClust finds clusterings of the leaves of a rooted tree such that every cluster is a monophyletic clade. It supports:

  • Exact k-way clustering (run(k=...))
  • Global peak search in k using a Calinski–Harabasz + Elbow 1 Index for validating cluster quality
  • Multi-resolution clustering: one representative k per log-spaced resolution bin
  • Polytomies, minimum cluster size constraints, support-aware branch lengths, outlier penalties and more!

Installation

1. Recommended: clean conda environment and install with PyPI

conda create -n phyt_env python=3.10
conda activate phyt_env
pip install phytclust

2. Install from source

git clone https://bitbucket.org/schwarzlab/phytclust.git
cd phytclust
pip install -e .[dev]

Command-line usage

Exact k clusters

Compute an exact k-way clustering, plot it, and save PNG + CSV under ./results:

phytclust tree.nwk --k 5 --save-fig --out-dir results

Global clustering solution

Search for the top 3 Calinski–Harabasz + Elbow index peaks up to k = 200, save everything in ./out:

phytclust tree.nwk --top-n 3 \
  --max-k 200 \
  --save-fig \
  --out-dir out

Multi-resolution clustering

Pick one representative peak per 4 log-spaced bins of k, don’t show plots interactively, save all k-specific CSVs and plots:

phytclust tree.nwk --bins 4 \
  --no-plot \
  --save-all-k \
  --save-fig \
  --out-dir out

(See phytclust --help for the complete CLI.)

Please cite

Please cite this repository if you use the algorithm in your work:

K. Ganesan, E. Billard, T.L. Kaufmann, C. B Strange, M. C. Cwikla, A. Altenhoff, C. Dessimoz, R.F. Schwarz, PhytClust, (2025), Bitbucket repository, https://bitbucket.org/schwarzlab/phytclust/


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

phytclust-0.1.1.tar.gz (238.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

phytclust-0.1.1-py3-none-any.whl (227.6 kB view details)

Uploaded Python 3

File details

Details for the file phytclust-0.1.1.tar.gz.

File metadata

  • Download URL: phytclust-0.1.1.tar.gz
  • Upload date:
  • Size: 238.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.12

File hashes

Hashes for phytclust-0.1.1.tar.gz
Algorithm Hash digest
SHA256 09cc16719372e5ab038495c4c94f9f32d0d68c9c9d61b095b82746925f63e5bc
MD5 aad0054c0b639af2e6d9497dfe055c4a
BLAKE2b-256 a77df5012717727e9b3712ca2590e271dceac45b864a5294a600d97ff0ec830f

See more details on using hashes here.

File details

Details for the file phytclust-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: phytclust-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 227.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.12

File hashes

Hashes for phytclust-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 630eb96d7ffc6eba6f3487c22a4012146919f4ba67ccbc972f66ebb183e6e1cd
MD5 064b0511384968a722d903a6e88b8df2
BLAKE2b-256 a26cec0d4f7c9e59dbb6c3a593d0ab6298905adcb8836701f3902c01c2e9f636

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page