Spectral Cluster Supertree
Spectral Cluster Supertree is a state-of-the-art algorithm for constructing rooted supertrees from collections of rooted source trees.
Spectral Cluster Supertree can be used on Newick formatted trees in Python in conjunction with cogent3's tree objects, or invoked from the command line.
Spectral Cluster Supertree can employ a number of weighting strategies that take into account the depths of nodes in the trees, as well as branch lengths. A user can specify weights of trees to add bias to some of the source trees if desired.
Installation
pip install sc-supertree
Usage
Python
from sc_supertree import load_trees, construct_supertree
source_trees = load_trees("source_tree_file.tre")
supertree = construct_supertree(source_trees, pcg_weighting="branch")
supertree.write("supertree_file.tre")
CLI
In your environment which has sc-supertree installed:
scs -i SOURCE_TREE_FILE -o SUPERTREE_FILE -p PCG_WEIGHTING_STRATEGY
The -i and -o options for the input and output files are required.
The -p proper cluster graph weighting strategy option must be one of ONE|DEPTH|BRANCH|BOOTSTRAP. It defaults to BRANCH when not provided (not recommended when some trees are missing branch lengths - see below). Tree weights are not supported through the command line.
Weighting Strategies
Proper Cluster Graph Weighting
Spectral Cluster Supertree recursively partitions the complete set of taxa to form a supertree. The core component of the algorithm involves partitioning the proper cluster graph through spectral clustering when the source trees are not consistent.
The proper cluster graph has the set of all taxa in the source trees as its vertices, and an edge connects two taxa if they appear together on the same side of the root in any of the source trees (such pairs of taxa are called proper clusters). Let $lca$ be the lowest common ancestor of a proper cluster. Each edge is weighted according to the specified strategy:
- one - The number of trees in which the pair of taxa appear as a proper cluster in.
- depth - The sum of the depths of the $lca$ of the proper cluster in all of the source trees.
- branch - The sum of the root to $lca$ branch lengths of the proper cluster in all of the source trees. If branch lengths are missing defaults to one (equivalent to depth). Do not use if source trees contain a mix of some trees with branch lengths and some without. -- bootstrap - The sum of bootstrap values of the $lca$ nodes across trees where two taxa appear as a proper cluster.
The branch weighting strategy is recommended when branch lengths are available. Otherwise, the depth weighting strategy is recommended over the one weighting strategy. The bootstrap strategy has not yet been empirically assessed.
Tree Weighting
In addition to the above, users may associate trees with weights to bias the results towards specific trees. Prior to the summation of the weights for an edge in the proper cluster graph, they are each multiplied by the weight of the corresponding tree. The weight of each tree defaults to one if not specified.
An example is shown below, without the tree weights the algorithm would randomly return either triple.
>>> from sc_supertree import construct_supertree
>>> from cogent3 import make_tree
>>> tree_1 = make_tree("(a,(b,c))")
>>> tree_2 = make_tree("(c,(b,a))")
>>> print(construct_supertree([tree_1, tree_2], weights=[1, 1.5]))
(c,(b,a));
Tree weighting can only be used in the python implementation, not the CLI.
Metadata
Release files for sc-supertree 2026.5.15
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sc_supertree-2026.5.15.tar.gz | 13.9 kB | With provenance | Details for sc_supertree-2026.5.15.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sc_supertree-2026.5.15-py3-none-any.whl | Python 3 | none | any | Details for sc_supertree-2026.5.15-py3-none-any.whl |
Total release size: 27.2 kB
Release files / sc_supertree-2026.5.15.tar.gz
| Download URL | sc_supertree-2026.5.15.tar.gz |
|---|---|
| Size | 13.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8d8a1e22b5a91438c849d0714ee1dee1b46ea4baf6863e3ba0de4e83d4bb60a1
|
|
BLAKE2b-256 checksum How to use checksums |
f5c67d7c900712a03819c950fb12caaa7457124a53f51993168f7197c4e02d3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 15, 2026.
Transparency logRelease files / sc_supertree-2026.5.15-py3-none-any.whl
| Download URL | sc_supertree-2026.5.15-py3-none-any.whl |
|---|---|
| Size | 13.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a3ad8a5bb1c7978c6d4811e5b1f017972eb6e4f1daf1d29c258c9e61dff0002a
|
|
BLAKE2b-256 checksum How to use checksums |
55e6a8f34de6c7b0a71812c221313db5cdcb143926e26fd63aadfcf3e2ecdbb2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 15, 2026.
Transparency logSecurity for sc-supertree 2026.5.15
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for sc_supertree-2026.5.15.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 15, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.