Python bindings for IQTree
Project description
piqtree
piqtree
is a library which allows you use IQ-TREE directly from Python! The interface with python is through cogent3 objects.
For usage, please refer to the documentation or the examples below.
If you encounter any problems or have any feature requests feel free to raise an issue!
Contributing
If you would like to help out by contributing to the piqtree project, please check out our contributor guide!
Examples
Phylogenetic Reconstruction
from piqtree import build_tree
from piqtree.model import Model
from cogent3 import load_aligned_seqs # Included with piqtree!
# Load Sequences
aln = load_aligned_seqs("tests/data/example.fasta", moltype="dna")
aln = aln.take_seqs(["Human", "Chimpanzee", "Rhesus", "Mouse"])
# Reconstruct a phylogenetic tree with IQ-TREE!
tree = build_tree(aln, Model("JC"), rand_seed=1) # Optionally specify a random seed.
print("Tree topology:", tree) # A cogent3 tree object
print("Log-likelihood:", tree.params["lnL"])
# In a Jupyter notebook, try tree.get_figure() to see a dendrogram
Note See the cogent3 docs for examples on what you can do with cogent3 trees.
Fit Branch Lengths to Tree Topology
from piqtree import fit_tree
from piqtree.model import Model
from cogent3 import load_aligned_seqs, make_tree # Included with piqtree!
# Load Sequences
aln = load_aligned_seqs("tests/data/example.fasta", moltype="dna")
aln = aln.take_seqs(["Human", "Chimpanzee", "Rhesus", "Mouse"])
# Construct tree topology
tree = make_tree("(Human, Chimpanzee, (Rhesus, Mouse));")
# Fit branch lengths with IQ-TREE!
tree = fit_tree(aln, tree, Model("JC"), rand_seed=1) # Optionally specify a random seed.
print("Tree with branch lengths:", tree) # A cogent3 tree object
print("Log-likelihood:", tree.params["lnL"])
Create a Collection of Random Trees
from piqtree import TreeGenMode, random_trees
num_trees = 3
num_taxa = 5
# Also supports YULE_HARDING, CATERPILLAR, BALANCED, BIRTH_DEATH and STAR_TREE
tree_gen_mode = TreeGenMode.UNIFORM
# Randomly generate trees
trees = random_trees(num_trees, num_taxa, tree_gen_mode, rand_seed=1) # Optionally specify a random seed.
print(trees) # A tuple of 3 trees with 5 taxa each.
Pairwise Robinson-Foulds Distance between Trees
from piqtree import robinson_foulds
from cogent3 import make_tree # Included with piqtree!
# Construct trees
tree1 = make_tree("(a,b,(c,(d,e)));")
tree2 = make_tree("(e,b,(c,(d,a)));")
tree3 = make_tree("(a,b,(d,(c,e)));")
# Calculate pairwise distances
pairwise_distances = robinson_foulds([tree1, tree2, tree3]) # Supports any number of trees (for a sequence of trees use *seq_of_trees)
print(pairwise_distances) # A numpy array containing pairwaise Robinson-Foulds distances between trees
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 Distributions
Built Distributions
File details
Details for the file piqtree-0.5.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: piqtree-0.5.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 50.2 MB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57a24aa03ea21fe42d0cad6d03cbd557fc59c8c0b2e004804644c3045b9b92a1 |
|
MD5 | 4e21fdaa17d71c34696422cc4aef07e5 |
|
BLAKE2b-256 | 9ac5a04442a969c25096917e24e7315f635e073bb0aef793584e60721ed1f383 |
Provenance
The following attestation bundles were made for piqtree-0.5.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
:
Publisher:
release.yml
on iqtree/piqtree
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
piqtree-0.5.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
- Subject digest:
57a24aa03ea21fe42d0cad6d03cbd557fc59c8c0b2e004804644c3045b9b92a1
- Sigstore transparency entry: 209055906
- Sigstore integration time:
- Permalink:
iqtree/piqtree@e1285fbfa6cda4336a3642d95365b73fe96c31f2
- Branch / Tag:
refs/heads/main
- Owner: https://github.com/iqtree
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
release.yml@e1285fbfa6cda4336a3642d95365b73fe96c31f2
- Trigger Event:
workflow_dispatch
- Statement type:
File details
Details for the file piqtree-0.5.0-cp313-cp313-macosx_14_0_arm64.whl
.
File metadata
- Download URL: piqtree-0.5.0-cp313-cp313-macosx_14_0_arm64.whl
- Upload date:
- Size: 4.1 MB
- Tags: CPython 3.13, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8f9af816daf0ac96639b870baf655f79e5cd4832da30689f0374d4160e60d73 |
|
MD5 | 8e52111aa6c62de79ea19d4ff7b0fefc |
|
BLAKE2b-256 | 6af00c788ea48885e4766cf38b145a577b81f8092863c4b06bfdef9728dc1310 |
Provenance
The following attestation bundles were made for piqtree-0.5.0-cp313-cp313-macosx_14_0_arm64.whl
:
Publisher:
release.yml
on iqtree/piqtree
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
piqtree-0.5.0-cp313-cp313-macosx_14_0_arm64.whl
- Subject digest:
d8f9af816daf0ac96639b870baf655f79e5cd4832da30689f0374d4160e60d73
- Sigstore transparency entry: 209055910
- Sigstore integration time:
- Permalink:
iqtree/piqtree@e1285fbfa6cda4336a3642d95365b73fe96c31f2
- Branch / Tag:
refs/heads/main
- Owner: https://github.com/iqtree
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
release.yml@e1285fbfa6cda4336a3642d95365b73fe96c31f2
- Trigger Event:
workflow_dispatch
- Statement type:
File details
Details for the file piqtree-0.5.0-cp313-cp313-macosx_13_0_x86_64.whl
.
File metadata
- Download URL: piqtree-0.5.0-cp313-cp313-macosx_13_0_x86_64.whl
- Upload date:
- Size: 5.4 MB
- Tags: CPython 3.13, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e771e255fc3c4fabc889a75347458090ab50dcff221d994c46919fb86ee017a2 |
|
MD5 | a0a73a545a90f69752fa1fad0c66b0d5 |
|
BLAKE2b-256 | 000b63dfe825a13bc68d0aa803b08cee9906f9468cf8740cae33032e1df225ba |
Provenance
The following attestation bundles were made for piqtree-0.5.0-cp313-cp313-macosx_13_0_x86_64.whl
:
Publisher:
release.yml
on iqtree/piqtree
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
piqtree-0.5.0-cp313-cp313-macosx_13_0_x86_64.whl
- Subject digest:
e771e255fc3c4fabc889a75347458090ab50dcff221d994c46919fb86ee017a2
- Sigstore transparency entry: 209055940
- Sigstore integration time:
- Permalink:
iqtree/piqtree@e1285fbfa6cda4336a3642d95365b73fe96c31f2
- Branch / Tag:
refs/heads/main
- Owner: https://github.com/iqtree
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
release.yml@e1285fbfa6cda4336a3642d95365b73fe96c31f2
- Trigger Event:
workflow_dispatch
- Statement type:
File details
Details for the file piqtree-0.5.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: piqtree-0.5.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 50.2 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f4ddb82a4f215b03bb8fc398b6a90d11ee1830671d1d73f1f80c897138eb1de |
|
MD5 | aac682de4327cc090ffc53e7cf152212 |
|
BLAKE2b-256 | 7319f8bd3f2b278c62c344c649e5f6fd33d5178c1f1f7ebaea35daed0599ac15 |
Provenance
The following attestation bundles were made for piqtree-0.5.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
:
Publisher:
release.yml
on iqtree/piqtree
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
piqtree-0.5.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
- Subject digest:
6f4ddb82a4f215b03bb8fc398b6a90d11ee1830671d1d73f1f80c897138eb1de
- Sigstore transparency entry: 209055936
- Sigstore integration time:
- Permalink:
iqtree/piqtree@e1285fbfa6cda4336a3642d95365b73fe96c31f2
- Branch / Tag:
refs/heads/main
- Owner: https://github.com/iqtree
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
release.yml@e1285fbfa6cda4336a3642d95365b73fe96c31f2
- Trigger Event:
workflow_dispatch
- Statement type:
File details
Details for the file piqtree-0.5.0-cp312-cp312-macosx_14_0_arm64.whl
.
File metadata
- Download URL: piqtree-0.5.0-cp312-cp312-macosx_14_0_arm64.whl
- Upload date:
- Size: 4.1 MB
- Tags: CPython 3.12, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ce391e304e0eb38b6e27f03f4801e7cb9df9418c69e9be100181fdcfe9c730f |
|
MD5 | d8f5cefc35e65516b0f7ac659b8de07d |
|
BLAKE2b-256 | bd271f3994d9d7d00275cab9240346ddb9ecc34fbfd84d2e310a98104449b573 |
Provenance
The following attestation bundles were made for piqtree-0.5.0-cp312-cp312-macosx_14_0_arm64.whl
:
Publisher:
release.yml
on iqtree/piqtree
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
piqtree-0.5.0-cp312-cp312-macosx_14_0_arm64.whl
- Subject digest:
5ce391e304e0eb38b6e27f03f4801e7cb9df9418c69e9be100181fdcfe9c730f
- Sigstore transparency entry: 209055919
- Sigstore integration time:
- Permalink:
iqtree/piqtree@e1285fbfa6cda4336a3642d95365b73fe96c31f2
- Branch / Tag:
refs/heads/main
- Owner: https://github.com/iqtree
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
release.yml@e1285fbfa6cda4336a3642d95365b73fe96c31f2
- Trigger Event:
workflow_dispatch
- Statement type:
File details
Details for the file piqtree-0.5.0-cp312-cp312-macosx_13_0_x86_64.whl
.
File metadata
- Download URL: piqtree-0.5.0-cp312-cp312-macosx_13_0_x86_64.whl
- Upload date:
- Size: 5.4 MB
- Tags: CPython 3.12, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2840a0a39be6465b8db141a2c5093b194b8e817766125399c3376c78d8f8b0ce |
|
MD5 | e4940ea3ea3e9c1048dce2b8226a6ea9 |
|
BLAKE2b-256 | 381abfd4a58e4d9e5ace98c5ccc94d07d0772a4b8d21d502255c27b3181d3ca3 |
Provenance
The following attestation bundles were made for piqtree-0.5.0-cp312-cp312-macosx_13_0_x86_64.whl
:
Publisher:
release.yml
on iqtree/piqtree
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
piqtree-0.5.0-cp312-cp312-macosx_13_0_x86_64.whl
- Subject digest:
2840a0a39be6465b8db141a2c5093b194b8e817766125399c3376c78d8f8b0ce
- Sigstore transparency entry: 209055926
- Sigstore integration time:
- Permalink:
iqtree/piqtree@e1285fbfa6cda4336a3642d95365b73fe96c31f2
- Branch / Tag:
refs/heads/main
- Owner: https://github.com/iqtree
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
release.yml@e1285fbfa6cda4336a3642d95365b73fe96c31f2
- Trigger Event:
workflow_dispatch
- Statement type:
File details
Details for the file piqtree-0.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: piqtree-0.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 50.2 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ec7cefa90006ba6e062b830dc96ef304b225d5fcc58abb2610038474d527de6 |
|
MD5 | 686ab182e2b64a9c0b73ba16a08c0197 |
|
BLAKE2b-256 | 9233b20c473b1b38964317c6fc337ce61c76389e6bb1bbed9d643a97dce6ace2 |
Provenance
The following attestation bundles were made for piqtree-0.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
:
Publisher:
release.yml
on iqtree/piqtree
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
piqtree-0.5.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
- Subject digest:
7ec7cefa90006ba6e062b830dc96ef304b225d5fcc58abb2610038474d527de6
- Sigstore transparency entry: 209055923
- Sigstore integration time:
- Permalink:
iqtree/piqtree@e1285fbfa6cda4336a3642d95365b73fe96c31f2
- Branch / Tag:
refs/heads/main
- Owner: https://github.com/iqtree
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
release.yml@e1285fbfa6cda4336a3642d95365b73fe96c31f2
- Trigger Event:
workflow_dispatch
- Statement type:
File details
Details for the file piqtree-0.5.0-cp311-cp311-macosx_14_0_arm64.whl
.
File metadata
- Download URL: piqtree-0.5.0-cp311-cp311-macosx_14_0_arm64.whl
- Upload date:
- Size: 4.1 MB
- Tags: CPython 3.11, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 544f6527723a419fe06914ef45aa0cd930cf3b51fb27876bbfe5ffb8fef2ff50 |
|
MD5 | 06d4b02977efca44ef2791cf1701ba88 |
|
BLAKE2b-256 | 39abb3450148139dcdd0201fa8bc7f74911f8eae3d723a8a0aa62e0aceac5abb |
Provenance
The following attestation bundles were made for piqtree-0.5.0-cp311-cp311-macosx_14_0_arm64.whl
:
Publisher:
release.yml
on iqtree/piqtree
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
piqtree-0.5.0-cp311-cp311-macosx_14_0_arm64.whl
- Subject digest:
544f6527723a419fe06914ef45aa0cd930cf3b51fb27876bbfe5ffb8fef2ff50
- Sigstore transparency entry: 209055932
- Sigstore integration time:
- Permalink:
iqtree/piqtree@e1285fbfa6cda4336a3642d95365b73fe96c31f2
- Branch / Tag:
refs/heads/main
- Owner: https://github.com/iqtree
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
release.yml@e1285fbfa6cda4336a3642d95365b73fe96c31f2
- Trigger Event:
workflow_dispatch
- Statement type:
File details
Details for the file piqtree-0.5.0-cp311-cp311-macosx_13_0_x86_64.whl
.
File metadata
- Download URL: piqtree-0.5.0-cp311-cp311-macosx_13_0_x86_64.whl
- Upload date:
- Size: 5.4 MB
- Tags: CPython 3.11, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9c15fc2ffe0b964a0981d783094e5b578a5aa80ec69067a06a77beb785bf89a |
|
MD5 | 8e0ec72c7558825c27b40475aea820db |
|
BLAKE2b-256 | f7843ccbc76335afa2e7963d17219b249d6ba50d48ed3e93e4651d42861ac279 |
Provenance
The following attestation bundles were made for piqtree-0.5.0-cp311-cp311-macosx_13_0_x86_64.whl
:
Publisher:
release.yml
on iqtree/piqtree
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
piqtree-0.5.0-cp311-cp311-macosx_13_0_x86_64.whl
- Subject digest:
c9c15fc2ffe0b964a0981d783094e5b578a5aa80ec69067a06a77beb785bf89a
- Sigstore transparency entry: 209055915
- Sigstore integration time:
- Permalink:
iqtree/piqtree@e1285fbfa6cda4336a3642d95365b73fe96c31f2
- Branch / Tag:
refs/heads/main
- Owner: https://github.com/iqtree
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
release.yml@e1285fbfa6cda4336a3642d95365b73fe96c31f2
- Trigger Event:
workflow_dispatch
- Statement type: