Skip to main content

piqtree

PyPI Version Python Version License

CI Coverage Status Documentation Status

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!

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

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

piqtree-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (50.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

piqtree-0.4.0-cp312-cp312-macosx_14_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

piqtree-0.4.0-cp312-cp312-macosx_13_0_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.12macOS 13.0+ x86-64

piqtree-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (50.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

piqtree-0.4.0-cp311-cp311-macosx_14_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

piqtree-0.4.0-cp311-cp311-macosx_13_0_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.11macOS 13.0+ x86-64

piqtree-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (50.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

piqtree-0.4.0-cp310-cp310-macosx_14_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.10macOS 14.0+ ARM64

piqtree-0.4.0-cp310-cp310-macosx_13_0_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.10macOS 13.0+ x86-64

File details

Details for the file piqtree-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for piqtree-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9213363ccc19222e490fa6ead5e388476a01878dba78d133c79cf9b4371fd26c
MD5 104deb63c49fd330da641dd484e146dc
BLAKE2b-256 c61454ed42a217b7caca3dbdf7fabd5c379fbeecd46e4aef4aa8a6c766f20bac

See more details on using hashes here.

Provenance

The following attestation bundles were made for piqtree-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on iqtree/piqtree

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file piqtree-0.4.0-cp312-cp312-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for piqtree-0.4.0-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 b53c15cf1369d0eeee57e24091f41df5bfc579e1f5a09542828ddba4790ba378
MD5 798f67a8daf7b675f127836a890a3258
BLAKE2b-256 3baa574fb45830b88e98d6f38a63812e263d34b8ea852124a8a29d3bde8b4bb7

See more details on using hashes here.

Provenance

The following attestation bundles were made for piqtree-0.4.0-cp312-cp312-macosx_14_0_arm64.whl:

Publisher: release.yml on iqtree/piqtree

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file piqtree-0.4.0-cp312-cp312-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for piqtree-0.4.0-cp312-cp312-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 c9bca309aff40b54eb257beffef26bbbfec0f5684208ed331c3a1a96c6ff9b19
MD5 7809c9175ca70eb66aeb3a4fee818056
BLAKE2b-256 0590e6dac4cefa0bd5f6c828099f111b5c5254f467d554f1409160bfc0ee72a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for piqtree-0.4.0-cp312-cp312-macosx_13_0_x86_64.whl:

Publisher: release.yml on iqtree/piqtree

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file piqtree-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for piqtree-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 36471fe0d53d421c7cd2a1fd808f22dac7a78811f5cd10640ea0af7a59501df0
MD5 923507909a30666a75f46ca99ddd3cdb
BLAKE2b-256 c087d64c7c30c2fb4abe8b14aa6ca305088a24160d48ae8fddfb7cbddf00c9d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for piqtree-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on iqtree/piqtree

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file piqtree-0.4.0-cp311-cp311-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for piqtree-0.4.0-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 dfb14631d4e2b1b5fd22578d05ef553f88deb4deee64ab701906e784f974e56b
MD5 5542670c58511a16111a7e08d52981fc
BLAKE2b-256 48ccedb43f5931d7fe24d956c784ea87dc67bab3a3cebb0c851faf065c4be305

See more details on using hashes here.

Provenance

The following attestation bundles were made for piqtree-0.4.0-cp311-cp311-macosx_14_0_arm64.whl:

Publisher: release.yml on iqtree/piqtree

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file piqtree-0.4.0-cp311-cp311-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for piqtree-0.4.0-cp311-cp311-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 8afa788ad5a9891a4d83ff2b004d3d586b8ef81a8685d6673feb982528b2cc8c
MD5 37a4b5ce6235ea2f775b0c961ec6f5ca
BLAKE2b-256 339b959c2e1be09e301528e4cf8242a7a8ed434211df202ea464b61946bab1fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for piqtree-0.4.0-cp311-cp311-macosx_13_0_x86_64.whl:

Publisher: release.yml on iqtree/piqtree

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file piqtree-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for piqtree-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 26766d40ec610864a411c6dfed3be92ebfc88ad03b9edf9f31932abffb86cc87
MD5 c0bdaf06344a35ebf9024019c612612e
BLAKE2b-256 25f64617a6bbc91996aaa690460ceaf4de7e47bf9c48bc792525e0c743c783f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for piqtree-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on iqtree/piqtree

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file piqtree-0.4.0-cp310-cp310-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for piqtree-0.4.0-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 9660eadeaa31a85633ca2a26860d85cbd867cb5664f63dd4081f5675efd659b4
MD5 946a16e7e419e3cd6838d026c4866e97
BLAKE2b-256 b5d1fac5f5afc3cad97d3bb0abf0bfbbff3b437db627693b271612eb5c1ec9ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for piqtree-0.4.0-cp310-cp310-macosx_14_0_arm64.whl:

Publisher: release.yml on iqtree/piqtree

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file piqtree-0.4.0-cp310-cp310-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for piqtree-0.4.0-cp310-cp310-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 16d3a27079485db03f26d277d9c67c4749a52ce5159f64d662e9b39779b2e741
MD5 ae1e04e79dfeade1c49dd81831626c56
BLAKE2b-256 e578d2216f29cc78daa7159edb9ac4458772820f96f679f80faea47d205a4a94

See more details on using hashes here.

Provenance

The following attestation bundles were made for piqtree-0.4.0-cp310-cp310-macosx_13_0_x86_64.whl:

Publisher: release.yml on iqtree/piqtree

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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