-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- a bit more documentation
- Loading branch information
Showing
33 changed files
with
999 additions
and
349 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,93 @@ | ||
# torchtree | ||
|
||
[![Python package](https://github.com/4ment/torchtree/actions/workflows/python-package.yml/badge.svg)](https://github.com/4ment/torchtree/actions/workflows/python-package.yml) | ||
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) | ||
[![docs](https://github.com/4ment/torchtree/actions/workflows/publish_documentation.yml/badge.svg)](https://github.com/4ment/torchtree/actions/workflows/publish_documentation.yml) | ||
![PyPI](https://img.shields.io/pypi/v/torchtree) | ||
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/torchtree) | ||
|
||
## Installation | ||
|
||
### Use an Anaconda environment (Optional) | ||
torchtree is a program for inferring phylogenetic trees from molecular sequeces. It is implemented in python and uses [PyTorch] to leverage automatic differentiation. Inference algorithms include variational inference, Hamiltonian Monte Carlo, maximum a posteriori and Markov chain Monte Carlo. | ||
|
||
- [Getting Started](#getting-started) | ||
- [Dependencies](#dependencies) | ||
- [Installation](#installation) | ||
- [Quick start](#quick-start) | ||
|
||
## Getting Started | ||
|
||
### Dependencies | ||
- [DendroPy] | ||
- [PyTorch] | ||
|
||
### Installation | ||
Use an Anaconda environment (Optional) | ||
```bash | ||
conda env create -f environment.yml | ||
conda activate torchtree | ||
``` | ||
|
||
### The easy way | ||
To install the latest stable version, run | ||
To install the latest stable version you can run | ||
```bash | ||
pip install torchtree | ||
``` | ||
|
||
### Using the source code | ||
To build torchtree from source you can run | ||
```bash | ||
git clone https://github.com/4ment/torchtree | ||
cd torchtree | ||
pip install . | ||
pip install torchtree/ | ||
``` | ||
|
||
## Check install | ||
Check install | ||
```bash | ||
torchtree --help | ||
``` | ||
|
||
## Quick start | ||
torchtree will approximate the posterior distribution of an unrooted tree with a JC69 substitution model using variational inference | ||
`torchtree` requires a JSON file contaning models and algorithms. A configutation file can generated using `torchtree-cli`, a command line-based tool. This two-step process allows the user to ajust values in the configuration file such as hyper prior parameters. | ||
|
||
### 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 examples/advi/fluA.json | ||
torchtree-cli advi -i data/fluA.fa -t data/fluA.tree -m JC69 --clock strict --coalescent constant > fluA.json | ||
``` | ||
|
||
The JSON file can be generated using the torchtree CLI | ||
### 2 - Running torchtree | ||
This will generate `sample.csv` and `sample.trees` files containing parameter and tree samples drawn from the variational distribution | ||
```bash | ||
torchtree-cli advi -i data/fluA.fa -t data/fluA.tree > fluA.json | ||
``` | ||
torchtree fluA.json | ||
``` | ||
|
||
## torchtree plug-in | ||
torchtree can be easily extended without modifying the code base thanks its modular implementation. Some examples of external packages | ||
- [torchtree-bito] | ||
- [torchtree-physher] | ||
- [torchtree-scipy] | ||
- [torchtree-tensorflow] | ||
|
||
## License | ||
|
||
Distributed under the GPLv3 License. See [LICENSE](LICENSE) for more information. | ||
|
||
## Acknowledgements | ||
|
||
torchtree makes use of the following libraries and tools, which are under their own respective licenses: | ||
|
||
- [PyTorch] | ||
- [DendroPy] | ||
|
||
[DendroPy]: https://github.com/jeetsukumaran/DendroPy | ||
[PyTorch]: https://pytorch.org | ||
[torchtree-bito]: https://github.com/4ment/torchtree-bito | ||
[torchtree-physher]: https://github.com/4ment/torchtree-physher | ||
[torchtree-scipy]: https://github.com/4ment/torchtree-scipy | ||
[torchtree-tensorflow]: https://github.com/4ment/torchtree-tensorflow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,52 @@ | ||
Welcome to torchtree's documentation! | ||
Welcome to torchtree! | ||
====================================== | ||
|
||
.. warning:: | ||
The documentation corresponds to the current state of the main branch. There may be differences with the latest released version. | ||
|
||
Packages | ||
-------- | ||
|
||
.. autosummary:: | ||
:toctree: modules | ||
:caption: API | ||
:recursive: | ||
torchtree is a program for inferring phylogenetic trees from molecular sequeces. | ||
It is implemented in Python and uses PyTorch to leverage automatic differentiation. | ||
Inference algorithms include variational inference, Hamiltonian Monte Carlo, maximum *a posteriori* and Markov chain Monte Carlo. | ||
|
||
Installation | ||
------------ | ||
|
||
.. tabs:: | ||
|
||
.. code-tab:: bash Latest | ||
|
||
git clone https://github.com/4ment/torchtree | ||
pip install torchtree/ | ||
|
||
.. code-tab:: bash Pypi | ||
|
||
torchtree | ||
pip install torchtree | ||
|
||
|
||
Plug-ins | ||
------------------ | ||
|
||
torchtree can be easily extended without modifying the code base thanks its modular implementation. Some examples of external packages: | ||
|
||
- torchtree-bito_: is a plug-in interfacing the bito_ library for fast gradient calculations with BEAGLE_. | ||
- torchtree-physher_: is a plug-in interfacing physher_ for fast gradient calculations of tree likelihood and coalescent models. | ||
- torchtree-scipy_: is a plug-in interfacing the SciPy package. | ||
- torchtree-tensorflow_: is a plug-in interacting with Tensorflow. | ||
|
||
.. _torchtree-bito: http://github.com/4ment/torchtree-bito | ||
.. _torchtree-physher: http://github.com/4ment/torchtree-physher | ||
.. _torchtree-scipy: http://github.com/4ment/torchtree-scipy | ||
.. _torchtree-tensorflow: http://github.com/4ment/torchtree-tensorflow | ||
.. _physher: http://github.com/4ment/physher | ||
.. _BEAGLE: https://github.com/beagle-dev/beagle-lib | ||
.. _bito: https://github.com/phylovi/bito | ||
|
||
|
||
|
||
.. toctree:: | ||
:hidden: | ||
:caption: API | ||
|
||
API Reference<autoapi/torchtree/index> | ||
bibliography/bib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,6 @@ numpy | |
sphinx | ||
sphinx-autoapi | ||
sphinx-book-theme | ||
sphinx-tabs | ||
sphinxcontrib-bibtex | ||
torch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
Version number (major.minor.patch[-label]) | ||
""" | ||
|
||
__version__ = "1.0.2-dev1" | ||
__version__ = "1.0.2-dev2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.