Python package which implements split- and rank-based tools for inferring phylogenies, such as flattenings and subflattenings.
Installation
The latest version of SplitP can be installed via the command
pip install splitp
Examples
Import splitp and the associated helper functions
import splitp as sp
from splitp import tree_helper_functions as hf
Define trees and work with splits
splits = list(hf.all_splits(4)) # [01|23, 02|13, 03|12]
tree = sp.NXTree('((0,1),(2,3));')
true_splits = tree.true_splits() # 01|23
Let site patterns evolve under any submodel of the general markov model.
JC_subs_matrix = tree.build_JC_matrix(branch_length:=0.05) # Or any other numpy Markov matrix
tree.reassign_all_transition_matrices(JC_subs_matrix)
pattern_probs = tree.get_pattern_probabilities()
> 0 1
0 AAAA 0.185844
1 AAAC 0.003262
.. ... ...
254 TTTG 0.003262
255 TTTT 0.185844
Simulate sequence alignments from pattern distributions
pattern_frequencies = tree.draw_from_multinomial(pattern_probs, 100)
> 0 1
0 AAAA 0.22
1 AAAC 0.01
.. ... ...
2 CCGC 0.03
3 TTTT 0.14
Reconstruct trees using split based methods including flattenings:
F1 = tree.flattening('01|23', pattern_frequencies)
F2 = tree.flattening('02|13', pattern_frequencies)
print(tree.split_score(F1) < tree.split_score(F2)) # True
Or subflattenings:
SF = tree.signed_sum_subflattening('01|23', pattern_probs)
print(tree.split_score(SF)) # 0.0
For more functionality please see the documentation at splitp.joshuastevenson.me.
Please see CONTRIBUTING.md for information on contributing to this project.
Metadata
Release files for splitp 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| splitp-0.3.2.tar.gz | 832.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| splitp-0.3.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.7 MB
Release files / splitp-0.3.2.tar.gz
| Download URL | splitp-0.3.2.tar.gz |
|---|---|
| Size | 832.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
96da108f3f4cf217e92ce4ed8bd1bb087631ce28d97f545890e12da82a242aaf
|
|
BLAKE2b-256 checksum How to use checksums |
6e17f77d135fa48da87ecfae6c45eb31c78323f41bd1b10a012094661fa2c700
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.23
|
Release files / splitp-0.3.2-py3-none-any.whl
| Download URL | splitp-0.3.2-py3-none-any.whl |
|---|---|
| Size | 835.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ce44f7f4104b08799e4cb7fea65049f45403cf36521143d314259915396c91ac
|
|
BLAKE2b-256 checksum How to use checksums |
85885a363605c5baaad35459699160d1a583f0466ddc681df643c5fc249f4fcc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.23
|