Phylo2Vec: integer vector representation of binary (phylogenetic) trees
Project description
Phylo2Vec
This repository contains an implementation of Phylo2Vec. It is distributed under the GNU Lesser General Public License v3.0 (LGPL).
Link to the paper: https://doi.org/10.1093/sysbio/syae030
Installation
Dependencies
- python>=3.9
- numba==0.56.4
- numpy==1.23.5
- biopython==1.80.0
- joblib>=1.2.0
- ete3==3.1.3
User installation
Pip
pip install phylo2vec
Manual installation
- We recommend to setup an isolated enviroment, using conda, mamba or virtualenv.
- Clone the repository and install using
pip:
git clone https://github.com/Neclow/phylo2vec_dev.git
pip install -e .
Development
Additional test dependencies
- pytest==7.4.2
- six==1.16.0
Testing
After installation, you can launch the test suite from outside the source directory:
pytest phylo2vec
Warning! You might need to clear your __pycache__ folders beforehand:
rm -rf phylo2vec/__pycache__/
rm -rf phylo2vec/base/__pycache__/
Basic usage
Conversions
- The
basemodule contains elements to convert a Newick string (to_vector) to a Phylo2Vec vector and vice versa (to_newick)
Example:
import numpy as np
from phylo2vec.base import to_newick, to_vector
v = np.array([0, 1, 2, 3, 4])
newick = to_newick(v) # '(0,(1,(2,(3,(4,5)6)7)8)9)10;'
v_converted = to_vector(newick) # array([0, 1, 2, 3, 4], dtype=int16)
Optimization
- The
optmodule contains methods to perform phylogenetic inference using Phylo2Vec vectors - TODO: include GradME from https://github.com/Neclow/GradME
Example:
from phylo2vec.opt import HillClimbingOptimizer
hc = HillClimbingOptimizer(raxml_cmd="/path/to/raxml-ng_v1.2.0_linux_x86_64/raxml-ng", verbose=True)
v_opt, taxa_dict, losses = hc.fit("/path/to/your_fasta_file.fa")
Citation and other work
@article{phylo2vec,
title={Phylo2Vec: a vector representation for binary trees},
author={Penn, Matthew J and Scheidwasser, Neil and Khurana, Mark P and Duch{\^e}ne, David A and Donnelly, Christl A and Bhatt, Samir},
journal={arXiv preprint arXiv:2304.12693},
year={2023}
}
- Preprint repository (core functions are deprecated): https://github.com/Neclow/phylo2vec_preprint
- C++ version (deprecated): https://github.com/Neclow/phylo2vec_cpp
- GradME: https://github.com/Neclow/GradME = phylo2vec + minimum evolution + gradient descent
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 phylo2vec-0.1.12.tar.gz.
File metadata
- Download URL: phylo2vec-0.1.12.tar.gz
- Upload date:
- Size: 21.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fb80084ce1608bc9fe314d1227bffa96b5d461e79c19e3e26d031be68ba1374
|
|
| MD5 |
faf596d6b482bf0b90a157fed16e3c73
|
|
| BLAKE2b-256 |
3fabe0706878ff9af41163e8c44e491e143461ea89f49c4e0638581fbcffda44
|
File details
Details for the file phylo2vec-0.1.12-py3-none-any.whl.
File metadata
- Download URL: phylo2vec-0.1.12-py3-none-any.whl
- Upload date:
- Size: 26.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18c2b3129248eb65d32b4dd9449442aec6b85f48474ebb64ca73b036a60a4bb6
|
|
| MD5 |
4e76b71edf4b26e71710695e96d61213
|
|
| BLAKE2b-256 |
ff83d0a528e7662383632cd4bb50026a8fae1515e4223ce854a2576c2f02ae47
|