https://github.com/4ment/torchtree
A probabilistic framework in PyTorch for phylogenetic models
Science Score: 46.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
✓Academic publication links
Links to: arxiv.org -
✓Committers with academic emails
1 of 2 committers (50.0%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (17.9%) to scientific vocabulary
Keywords
Repository
A probabilistic framework in PyTorch for phylogenetic models
Basic Info
- Host: GitHub
- Owner: 4ment
- License: gpl-3.0
- Language: Jupyter Notebook
- Default Branch: master
- Homepage: https://4ment.github.io/torchtree
- Size: 42.6 MB
Statistics
- Stars: 17
- Watchers: 2
- Forks: 3
- Open Issues: 0
- Releases: 2
Topics
Metadata Files
README.md
torchtree
torchtree is a program designed for developing and inferring phylogenetic models. Implemented in Python, it leverages PyTorch for automatic differentiation. The suite of inference algorithms encompasses variational inference, Hamiltonian Monte Carlo, maximum a posteriori, and Markov chain Monte Carlo.
For a comprehensive assessment of torchtree's performance and use cases, please see our evaluation repository, torchtree-experiments, where torchtree was rigorously tested on various datasets and benchmarked for accuracy and speed.
Getting Started
Dependencies
### Installation
Use an Anaconda environment (Optional)
bash
conda env create -f environment.yml
conda activate torchtree
To install the latest stable version you can run
bash
pip install torchtree
To build torchtree from source you can run
bash
git clone https://github.com/4ment/torchtree
pip install torchtree/
Check install
bash
torchtree --help
Documentation
For detailed information on how to use torchtree and its features, please refer to the official documentation and API reference.
- Documentation
- API Reference
Quick start
torchtree requires a JSON file containing models and algorithms. A configuration file can be generated using torchtree-cli, a command line-based tool. This two-step process allows the user to adjust values in the configuration file, such as hyperparameters.
torchtree-cli implements several subcommands, each corresponding to a different type of inference algorithm.
A list of available subcommands can be obtained by running torchtree-cli --help.
The following subcommands are available:
advi: Automatic differentiation variational inferencehmc: Hamiltonian Monte Carlomap: Maximum a posteriorimcmc: Markov chain Monte Carlo
Each subcommand/algorithm requires a different set of arguments which can be obtained by running torchtree-cli <subcommand> --help.
torchtree-cli requires an alignment file in FASTA format and a tree file in either Newick or NEXUS format.
While torchtree uses the DendroPy library to parse and manipulate phylogenetic trees, it is recommended to use a Newick file due to the numerous variations of the NEXUS format.
Let's explore a few examples of how to use these programs using an influenza A virus dataset containing 69 DNA sequences. The alignment and tree files are located in the data directory.
1 - Generating a configuration file
Some examples of models using variational inference:
Unrooted tree with GTR+W4 model
W4 refers to a site model with 4 rates categories coming from a discretized Weibull distribution. This is similar to the more commonly used discretized Gamma distribution site model.
bash
torchtree-cli advi -i data/fluA.fa -t data/fluA.tree -m GTR -C 4 > fluA.json
Time tree with strict clock and constant coalescent model
bash
torchtree-cli advi -i data/fluA.fa -t data/fluA.tree -m JC69 --clock strict --coalescent constant > fluA.json
2 - Running torchtree
This will generate sample.csv and sample.trees files containing parameter and tree samples drawn from the variational distribution
bash
torchtree fluA.json
torchtree plug-in
torchtree can be easily extended without modifying the code base thanks its modular implementation. Some examples of plug-ins:
A GitHub template is available to assist in the development of a plug-in, and it is highly recommended to use it. This template provides a structured starting point, ensuring consistency and compatibility with torchtree while streamlining the development process.
How to cite
If you use torchtree, please consider citing:
```
@misc{fourment2024torchtree, title={torchtree: flexible phylogenetic model development and inference using {PyTorch}}, author={Mathieu Fourment and Matthew Macaulay and Christiaan J Swanepoel and Xiang Ji and Marc A Suchard and Frederick A Matsen IV}, year={2024}, eprint={2406.18044}, archivePrefix={arXiv}, primaryClass={q-bio.PE}, url={https://arxiv.org/abs/2406.18044} } ```
License
Distributed under the GPLv3 License. See LICENSE for more information.
Acknowledgements
torchtree makes use of the following libraries and tools, which are under their own respective licenses:
Owner
- Name: Mathieu Fourment
- Login: 4ment
- Kind: user
- Location: Australia
- Company: University of Technology Sydney
- Repositories: 58
- Profile: https://github.com/4ment
GitHub Events
Total
- Issues event: 3
- Watch event: 4
- Issue comment event: 1
- Push event: 16
- Pull request event: 5
- Fork event: 1
- Create event: 2
Last Year
- Issues event: 3
- Watch event: 4
- Issue comment event: 1
- Push event: 16
- Pull request event: 5
- Fork event: 1
- Create event: 2
Committers
Last synced: 8 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Mathieu Fourment | m****t@g****m | 233 |
| Matthew Macaulay | m****y@u****u | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 8 months ago
All Time
- Total issues: 3
- Total pull requests: 8
- Average time to close issues: 9 months
- Average time to close pull requests: 3 months
- Total issue authors: 2
- Total pull request authors: 4
- Average comments per issue: 0.33
- Average comments per pull request: 0.5
- Merged pull requests: 4
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 1
- Pull requests: 2
- Average time to close issues: about 2 hours
- Average time to close pull requests: 9 days
- Issue authors: 1
- Pull request authors: 2
- Average comments per issue: 0.0
- Average comments per pull request: 0.5
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- 4ment (2)
- maremita (1)
Pull Request Authors
- 4ment (3)
- mattapow (3)
- matsen (2)
- maremita (2)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 30 last-month
- Total dependent packages: 1
- Total dependent repositories: 1
- Total versions: 6
- Total maintainers: 1
pypi.org: torchtree
Phylogenetic inference with pytorch
- Homepage: https://github.com/4ment/torchtree
- Documentation: https://torchtree.readthedocs.io/
- License: GPL3
-
Latest release: 1.0.2
published almost 2 years ago
Rankings
Maintainers (1)
Dependencies
- dendropy *
- numpy >=1.7
- torch >=1.9
- actions/checkout v2 composite
- actions/setup-python v2 composite
- JamesIves/github-pages-deploy-action 3.6.2 composite
- actions/checkout v2.3.1 composite
- actions/setup-python v1 composite
- dendropy *
- numpy *
- sphinx *
- sphinx-autoapi *
- sphinx-book-theme *
- sphinxcontrib-bibtex *
- torch *
- dendropy
- numpy >=1.7
- pip
- python 3.7.*
- pytorch >=1.9