torchtree


Nametorchtree JSON
Version 1.0.2 PyPI version JSON
download
home_pagehttps://github.com/4ment/torchtree
SummaryPhylogenetic inference with pytorch
upload_time2024-07-10 04:34:37
maintainerNone
docs_urlNone
authorMathieu Fourment
requires_python>=3.7
licenseGPL3
keywords phylogenetics variational bayes pytorch
VCS
bugtrack_url
requirements dendropy numpy torch
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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)


torchtree is a program designed for inferring phylogenetic trees from molecular sequences. 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.

- [Getting Started](#getting-started)
  - [Dependencies](#dependencies)
  - [Installation](#installation)
- [Quick start](#quick-start)
- [Plug-ins](#torchtree-plug-in)

## Getting Started

### Dependencies
 - [DendroPy]
 - [PyTorch]

 ### 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
```

## 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.

### 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 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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/4ment/torchtree",
    "name": "torchtree",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "phylogenetics, variational, Bayes, pytorch",
    "author": "Mathieu Fourment",
    "author_email": "mathieu.fourment@uts.edu.au",
    "download_url": "https://files.pythonhosted.org/packages/70/07/aaf7efe7d895c7c1f48b11220f73348c30227fa873565bc8384da47ea331/torchtree-1.0.2.tar.gz",
    "platform": null,
    "description": "# torchtree\n\n[![Python package](https://github.com/4ment/torchtree/actions/workflows/python-package.yml/badge.svg)](https://github.com/4ment/torchtree/actions/workflows/python-package.yml)\n[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n[![docs](https://github.com/4ment/torchtree/actions/workflows/publish_documentation.yml/badge.svg)](https://github.com/4ment/torchtree/actions/workflows/publish_documentation.yml)\n![PyPI](https://img.shields.io/pypi/v/torchtree)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/torchtree)\n\n\ntorchtree is a program designed for inferring phylogenetic trees from molecular sequences. 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.\n\n- [Getting Started](#getting-started)\n  - [Dependencies](#dependencies)\n  - [Installation](#installation)\n- [Quick start](#quick-start)\n- [Plug-ins](#torchtree-plug-in)\n\n## Getting Started\n\n### Dependencies\n - [DendroPy]\n - [PyTorch]\n\n ### Installation\nUse an Anaconda environment (Optional)\n```bash\nconda env create -f environment.yml\nconda activate torchtree\n```\n\nTo install the latest stable version you can run\n```bash\npip install torchtree\n```\n\nTo build torchtree from source you can run\n```bash\ngit clone https://github.com/4ment/torchtree\npip install torchtree/\n```\n\nCheck install\n```bash\ntorchtree --help\n```\n\n## Quick start\n`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.\n\n### 1 - Generating a configuration file\nSome examples of models using variational inference:\n\n#### Unrooted tree with GTR+W4 model\n*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.\n\n```bash\ntorchtree-cli advi -i data/fluA.fa -t data/fluA.tree -m GTR -C 4 > fluA.json\n```\n\n#### Time tree with strict clock and constant coalescent model\n```bash\ntorchtree-cli advi -i data/fluA.fa -t data/fluA.tree -m JC69 --clock strict --coalescent constant > fluA.json\n```\n\n### 2 - Running torchtree\nThis will generate `sample.csv` and `sample.trees` files containing parameter and tree samples drawn from the variational distribution\n```bash\ntorchtree fluA.json\n```\n\n## torchtree plug-in\ntorchtree can be easily extended without modifying the code base thanks its modular implementation. Some examples of external packages\n- [torchtree-bito]\n- [torchtree-physher]\n- [torchtree-scipy]\n- [torchtree-tensorflow]\n\n## License\n\nDistributed under the GPLv3 License. See [LICENSE](LICENSE) for more information.\n\n## Acknowledgements\n\ntorchtree makes use of the following libraries and tools, which are under their own respective licenses:\n\n - [PyTorch]\n - [DendroPy]\n\n[DendroPy]: https://github.com/jeetsukumaran/DendroPy\n[PyTorch]: https://pytorch.org\n[torchtree-bito]: https://github.com/4ment/torchtree-bito\n[torchtree-physher]: https://github.com/4ment/torchtree-physher\n[torchtree-scipy]: https://github.com/4ment/torchtree-scipy\n[torchtree-tensorflow]: https://github.com/4ment/torchtree-tensorflow\n",
    "bugtrack_url": null,
    "license": "GPL3",
    "summary": "Phylogenetic inference with pytorch",
    "version": "1.0.2",
    "project_urls": {
        "Homepage": "https://github.com/4ment/torchtree"
    },
    "split_keywords": [
        "phylogenetics",
        " variational",
        " bayes",
        " pytorch"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "70ffb0bbc1082a8a6a905f4491df6aec990ba802c2ca8ba005fb5eb5364d3364",
                "md5": "25235412e23f417b3fc938775ec6e106",
                "sha256": "6c0f62e8d533ec29e90cd1579fd68e5b1e5a19e889d0ac5fc858afc51f912d9c"
            },
            "downloads": -1,
            "filename": "torchtree-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "25235412e23f417b3fc938775ec6e106",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 176513,
            "upload_time": "2024-07-10T04:34:35",
            "upload_time_iso_8601": "2024-07-10T04:34:35.125148Z",
            "url": "https://files.pythonhosted.org/packages/70/ff/b0bbc1082a8a6a905f4491df6aec990ba802c2ca8ba005fb5eb5364d3364/torchtree-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7007aaf7efe7d895c7c1f48b11220f73348c30227fa873565bc8384da47ea331",
                "md5": "a88d43eb21d5135aa6bd2de8be8bd024",
                "sha256": "79d37e31d6617c40343165abdb1494ad8467c920fc33f80019659ef6c3616988"
            },
            "downloads": -1,
            "filename": "torchtree-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "a88d43eb21d5135aa6bd2de8be8bd024",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 145415,
            "upload_time": "2024-07-10T04:34:37",
            "upload_time_iso_8601": "2024-07-10T04:34:37.407069Z",
            "url": "https://files.pythonhosted.org/packages/70/07/aaf7efe7d895c7c1f48b11220f73348c30227fa873565bc8384da47ea331/torchtree-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-10 04:34:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "4ment",
    "github_project": "torchtree",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "dendropy",
            "specs": []
        },
        {
            "name": "numpy",
            "specs": [
                [
                    ">=",
                    "1.7"
                ]
            ]
        },
        {
            "name": "torch",
            "specs": [
                [
                    ">=",
                    "1.9"
                ]
            ]
        }
    ],
    "lcname": "torchtree"
}
        
Elapsed time: 0.91824s