Group phylogenetically placed sequence variants into phylotypes
Project description
Phylotypes
Group features (e.g. 16s rRNA gene variable region sequence variants) placed on a common phylogenetic tree by phylogenetic distance.
This is particularly useful when attempting a metanalysis of 16s rRNA gene variable region amplicons, in which the amplicons were made with different primers, etc.
Input:
--jplace <file> A jplace file (deduplicated) as made by pplacer or epa-ng.
Output:
--out <file> Path where the output should be placed in CSV format. This will be a header-containing CSV file in long-format with two columns: phylogroup and feature-id.
Parameters:
--lwr-overlap <0.0 - 1.0> Minimum like-weight-ratio overlap for two placed features (e.g. sequence variants) to be pre-grouped. Default of 0.1 should be fine for most use cases.
--threshold_pd <float> Phylogenetic distance at which to cluster features. Default of 1.0 corresponds roughly to somewhere between species-level and genus-level grouping for 16s rRNA V4 region amplicons.
--distance {legacy,kr} Pairwise distance metric. legacy (default) is an exact, vectorized reimplementation of the original LCA-weighted-average metric and reproduces prior phylotypes. kr is the true tree-Wasserstein (Kantorovich-Rubinstein) distance, a proper metric -- opt-in.
Note: --threshold_pd's default of 1.0 is calibrated for --distance legacy. The kr metric is on a different (smaller-valued) scale, so the same threshold means a different cut. If you use --distance kr, re-calibrate --threshold_pd on your own data; the legacy default will over- or under-split. (No default kr threshold is provided yet -- this is a TODO pending empirical calibration on a real dataset.)
--no-distal-length Ignore distal length to nodes when computing distances. Default is False (distal length is included).
--incremental Use an incremental seed→apply→expand→reconcile clustering path instead of the default batch path. Scales to larger inputs with lower peak memory at the cost of approximate (single/centroid-like) linkage near phylotype boundaries.
--seed-size <int> Number of (most specific) placements used to seed the initial phylotype pool when --incremental is set. Default: 200.
--expand-batch-size <int> Maximum number of orphaned placements clustered together per expand pass when --incremental is set. Default: 200.
--device <str> PyTorch device for tensor computations, e.g. cpu or cuda. Default: cpu.
--max-pregroup-size <int> Maximum SVs in a single pregroup after LCA-based re-clustering; larger pregroups are split back to their pre-merge groups to bound memory use. Default: 5000.
add_phylotypes
Assign a new set of placed sequence variants into an existing set of phylotypes.
Given a previous JPLACE file and its phylotype assignments (produced by phylotypes), and a new JPLACE of sequence variants placed on the same reference tree, each new SV is assigned to the nearest existing phylotype.
Input:
--previous_jp / -P <file> Previous JPLACE file (same reference tree as --new_jp).
--previous_phylotypes / -p <file> CSV file with two columns (phylotype, sv) representing the existing phylotype assignments.
--new_jp / -N <file> New JPLACE file containing the sequence variants to be assigned.
Output:
--out / -O <file> Output CSV (phylotype, sv) placing the new SVs into the existing phylotypes. SVs that share no tree-edge overlap with any existing phylotype are reported as orphans in the log and omitted from the output.
Parameters:
--no-distal-length Ignore distal length when computing distances. Default: False.
--device <str> PyTorch device. Default: cpu.
--distance {legacy,kr} Pairwise distance metric. Default: legacy.
phylotype_taxonomy
Assign a consensus species (or best-effort taxon) to each phylotype using per-SV taxonomic annotations.
Input:
--phylotypes / -p <file> CSV with phylotype and sv columns (output of phylotypes).
--taxonomy / -t <file> Per-SV taxonomic assignments in long format (as produced by MaLiAmPi), with columns sv, rank, want_rank, and tax_name.
Output:
--out / -O <file> CSV with phylotype and species columns. Phylotypes without a species-level assignment are annotated at the best available rank with a spp. suffix.
Release notes
v2.0.1
add_phylotypesnow shares the same JPLACE loader and distance metric asphylotypes, eliminating a divergent implementation that failed on standard SEPP/epa-ng edge-numbered trees.- New
--incrementalclustering path for large datasets. - GPU support via
--device cuda(or any valid PyTorch device string). - KR-distance threshold caveat: the
--distance krmetric is on a different (smaller-valued) scale thanlegacy. The default--threshold_pd 1.0is calibrated forlegacyonly. If using--distance kr, re-calibrate the threshold on your own data.
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 phylotypes-2.0.2.tar.gz.
File metadata
- Download URL: phylotypes-2.0.2.tar.gz
- Upload date:
- Size: 26.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4d0b8d23eccbb6174dad3fdcc17723788390b0bc29f788762a6ea5da19d3514
|
|
| MD5 |
2d0c01eb0afd58a0d1b6a6086f975507
|
|
| BLAKE2b-256 |
843a5eb230d6b957dd413602d37eac0f2ae67a8c8cec23e000aadfcfb184379a
|
Provenance
The following attestation bundles were made for phylotypes-2.0.2.tar.gz:
Publisher:
publish.yml on jgolob/phylotypes
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
phylotypes-2.0.2.tar.gz -
Subject digest:
e4d0b8d23eccbb6174dad3fdcc17723788390b0bc29f788762a6ea5da19d3514 - Sigstore transparency entry: 2176154459
- Sigstore integration time:
-
Permalink:
jgolob/phylotypes@546d339dd7357809e5609a254353a7280070670a -
Branch / Tag:
refs/tags/v2.0.2 - Owner: https://github.com/jgolob
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@546d339dd7357809e5609a254353a7280070670a -
Trigger Event:
push
-
Statement type:
File details
Details for the file phylotypes-2.0.2-py3-none-any.whl.
File metadata
- Download URL: phylotypes-2.0.2-py3-none-any.whl
- Upload date:
- Size: 21.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b0d98692c63625ae26d0218be92b5542699bcbdc8a23c0c7eccb2ad99e3b920
|
|
| MD5 |
f4c304a46f53f67fd242f9f6c59d56f4
|
|
| BLAKE2b-256 |
4dbaa3c75062e6b12aee17818e38770e08622e88a7aa106cea7ffd81e528b54a
|
Provenance
The following attestation bundles were made for phylotypes-2.0.2-py3-none-any.whl:
Publisher:
publish.yml on jgolob/phylotypes
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
phylotypes-2.0.2-py3-none-any.whl -
Subject digest:
8b0d98692c63625ae26d0218be92b5542699bcbdc8a23c0c7eccb2ad99e3b920 - Sigstore transparency entry: 2176154475
- Sigstore integration time:
-
Permalink:
jgolob/phylotypes@546d339dd7357809e5609a254353a7280070670a -
Branch / Tag:
refs/tags/v2.0.2 - Owner: https://github.com/jgolob
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@546d339dd7357809e5609a254353a7280070670a -
Trigger Event:
push
-
Statement type: