torchtree-physher


Nametorchtree-physher JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/4ment/torchtree-physher
SummaryPhylogenetic inference with pytorch and physher
upload_time2024-07-10 05:13:17
maintainerNone
docs_urlNone
authorMathieu Fourment
requires_python>=3.7
licenseGPL3
keywords phylogenetics variational bayes pytorch
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # torchtree-physher

[![Testing](https://github.com/4ment/torchtree-physher/actions/workflows/test_linux.yml/badge.svg)](https://github.com/4ment/torchtree-physher/actions/workflows/test_linux.yml)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)

## About torchtree-physher
torchtree-physher is a python package providing fast gradient calculation implemented in [physher] for [torchtree].

## Getting Started

A C++ compiler such as ``g++`` or ``clang++`` is required.
On Debian-based systems, this can be installed via ``apt``:

```bash
sudo apt install g++
```

On MacOS, it is recommended to use the latest version of ``clang++``:
```bash
brew install llvm
```

The [pybind11] library is also used for binding the
C++ functionality to Python.

### Dependencies
 - [physher]
 - [pybind11]
 - [PyTorch]
 - [torchtree]

[physher] is a phylogenetic program written in C that provides C++ wrappers to compute the tree and coalescent likelihoods and their gradients under different models.

To build physher from source you can run
```bash
git clone https://github.com/4ment/physher
cmake -S physher/ -B physher/build -DBUILD_CPP_WRAPPER=on -DBUILD_TESTING=on
cmake --build physher/build/ --target install
```

Check it works (optional)
```bash
ctest --test-dir physher/build/
```


### Installation
To build `torchtree-physher` from source you can run
```bash
git clone https://github.com/4ment/torchtree-physher
pip install torchtree-physher/
```

### Check install
If the installation was successful, this command should print the version of the `torchtree_physher` library
```bash
python -c "import torchtree_physher;print(torchtree_physher.__version__)"
```

## Command line arguments
The torchtree-physher plugin adds these arguments to the torchtree CLI:

```bash
torchtree-cli advi --help
  ...
  --physher             use physher
  --physher_include_jacobian
                        include Jacobian of the node height transform in the node height gradient
  --physher_disable_sse
                        disable SSE in physher
  --physher_disable_coalescent
                        disable coalescent calculation by physher
  --physher_site {weibull,gamma}
                        distribution for rate heterogeneity across sites
```

## Features
### Tree likelihood
Some types in the JSON configuration file have to be replaced in order to use the tree likelihood implementation of physher. You simply need to add `torchtree_physher.` before a model type. Here is a list of models implemented in this plugin:

- `TreeLikelihoodModel`
- Substitution models:
  - `JC69`
  - `HKY`
  - `GTR`
  - `GeneralNonSymmetricSubstitutionModel`
- Tree models:
  - `UnRootedTreeModel`
  - `ReparameterizedTimeTreeModel`
- Clock models (optional):
  - `StrictClockModel`
  - `SimpleClockModel`
- Site models:
  - `ConstantSiteModel`
  - `GammaSiteModel`
  - `InvariantSiteModel`
  - `WeibullSiteModel`

Note that the type of every sub-model of the tree likelihood object (e.g. site, tree models...) has to be replaced.

For example if we want to use ADVI with an unrooted tree and a Weibull site model:

```bash
torchtree-cli advi -i data.fa -t data.tree -C 4 > data.json
sed -i -E 's/TreeLikelihoodModel/torchtree_physher.TreeLikelihoodModel/; s/UnRootedTreeModel/torchtree_physher.UnRootedTreeModel/; s/WeibullSiteModel/torchtree_physher.WeibullSiteModel/' data.json
torchtree data.json
```

The JSON file can be created directly using the `--physher` option:
```bash
torchtree-cli advi -i data.fa -t data.tree -C 4 --physher > data.json
```

### Coalescent models
Here is a list of coalescent models implemented in this plugin:

- `ConstantCoalescentModel`
- `PiecewiseConstantCoalescentGridModel` (aka skygrid)
- `PiecewiseConstantCoalescentModel` (aka skyride)
- `PiecewiseLinearCoalescentGridModel`

## License

Distributed under the GPLv3 License. See [LICENSE](LICENSE) for more information.

## Acknowledgements

torchtree-physher makes use of the following libraries and tools, which are under their own respective licenses:

 - [physher]
 - [pybind11]
 - [PyTorch]
 - [torchtree]

[physher]: https://github.com/4ment/physher
[pybind11]: https://pybind11.readthedocs.io/en/stable
[PyTorch]: https://pytorch.org
[torchtree]: https://github.com/4ment/torchtree

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/4ment/torchtree-physher",
    "name": "torchtree-physher",
    "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/4a/f2/aeef673bca12a5bc12a5d97895f9406e919c4dc39c63e2ac9a11ca8aee3a/torchtree-physher-1.0.0.tar.gz",
    "platform": null,
    "description": "# torchtree-physher\n\n[![Testing](https://github.com/4ment/torchtree-physher/actions/workflows/test_linux.yml/badge.svg)](https://github.com/4ment/torchtree-physher/actions/workflows/test_linux.yml)\n[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n\n## About torchtree-physher\ntorchtree-physher is a python package providing fast gradient calculation implemented in [physher] for [torchtree].\n\n## Getting Started\n\nA C++ compiler such as ``g++`` or ``clang++`` is required.\nOn Debian-based systems, this can be installed via ``apt``:\n\n```bash\nsudo apt install g++\n```\n\nOn MacOS, it is recommended to use the latest version of ``clang++``:\n```bash\nbrew install llvm\n```\n\nThe [pybind11] library is also used for binding the\nC++ functionality to Python.\n\n### Dependencies\n - [physher]\n - [pybind11]\n - [PyTorch]\n - [torchtree]\n\n[physher] is a phylogenetic program written in C that provides C++ wrappers to compute the tree and coalescent likelihoods and their gradients under different models.\n\nTo build physher from source you can run\n```bash\ngit clone https://github.com/4ment/physher\ncmake -S physher/ -B physher/build -DBUILD_CPP_WRAPPER=on -DBUILD_TESTING=on\ncmake --build physher/build/ --target install\n```\n\nCheck it works (optional)\n```bash\nctest --test-dir physher/build/\n```\n\n\n### Installation\nTo build `torchtree-physher` from source you can run\n```bash\ngit clone https://github.com/4ment/torchtree-physher\npip install torchtree-physher/\n```\n\n### Check install\nIf the installation was successful, this command should print the version of the `torchtree_physher` library\n```bash\npython -c \"import torchtree_physher;print(torchtree_physher.__version__)\"\n```\n\n## Command line arguments\nThe torchtree-physher plugin adds these arguments to the torchtree CLI:\n\n```bash\ntorchtree-cli advi --help\n  ...\n  --physher             use physher\n  --physher_include_jacobian\n                        include Jacobian of the node height transform in the node height gradient\n  --physher_disable_sse\n                        disable SSE in physher\n  --physher_disable_coalescent\n                        disable coalescent calculation by physher\n  --physher_site {weibull,gamma}\n                        distribution for rate heterogeneity across sites\n```\n\n## Features\n### Tree likelihood\nSome types in the JSON configuration file have to be replaced in order to use the tree likelihood implementation of physher. You simply need to add `torchtree_physher.` before a model type. Here is a list of models implemented in this plugin:\n\n- `TreeLikelihoodModel`\n- Substitution models:\n  - `JC69`\n  - `HKY`\n  - `GTR`\n  - `GeneralNonSymmetricSubstitutionModel`\n- Tree models:\n  - `UnRootedTreeModel`\n  - `ReparameterizedTimeTreeModel`\n- Clock models (optional):\n  - `StrictClockModel`\n  - `SimpleClockModel`\n- Site models:\n  - `ConstantSiteModel`\n  - `GammaSiteModel`\n  - `InvariantSiteModel`\n  - `WeibullSiteModel`\n\nNote that the type of every sub-model of the tree likelihood object (e.g. site, tree models...) has to be replaced.\n\nFor example if we want to use ADVI with an unrooted tree and a Weibull site model:\n\n```bash\ntorchtree-cli advi -i data.fa -t data.tree -C 4 > data.json\nsed -i -E 's/TreeLikelihoodModel/torchtree_physher.TreeLikelihoodModel/; s/UnRootedTreeModel/torchtree_physher.UnRootedTreeModel/; s/WeibullSiteModel/torchtree_physher.WeibullSiteModel/' data.json\ntorchtree data.json\n```\n\nThe JSON file can be created directly using the `--physher` option:\n```bash\ntorchtree-cli advi -i data.fa -t data.tree -C 4 --physher > data.json\n```\n\n### Coalescent models\nHere is a list of coalescent models implemented in this plugin:\n\n- `ConstantCoalescentModel`\n- `PiecewiseConstantCoalescentGridModel` (aka skygrid)\n- `PiecewiseConstantCoalescentModel` (aka skyride)\n- `PiecewiseLinearCoalescentGridModel`\n\n## License\n\nDistributed under the GPLv3 License. See [LICENSE](LICENSE) for more information.\n\n## Acknowledgements\n\ntorchtree-physher makes use of the following libraries and tools, which are under their own respective licenses:\n\n - [physher]\n - [pybind11]\n - [PyTorch]\n - [torchtree]\n\n[physher]: https://github.com/4ment/physher\n[pybind11]: https://pybind11.readthedocs.io/en/stable\n[PyTorch]: https://pytorch.org\n[torchtree]: https://github.com/4ment/torchtree\n",
    "bugtrack_url": null,
    "license": "GPL3",
    "summary": "Phylogenetic inference with pytorch and physher",
    "version": "1.0.0",
    "project_urls": {
        "Homepage": "https://github.com/4ment/torchtree-physher"
    },
    "split_keywords": [
        "phylogenetics",
        " variational",
        " bayes",
        " pytorch"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ef418c3be80ab9227f7a871847190340d4223b1643fa2cf7af42c2bfd47c273d",
                "md5": "049951e05063a9950c5f32791b96f393",
                "sha256": "ff497093f473c000c1e24ae25c76bda0f14161e8713a6117ff88e15669d46fda"
            },
            "downloads": -1,
            "filename": "torchtree_physher-1.0.0-cp312-cp312-macosx_11_0_arm64.whl",
            "has_sig": false,
            "md5_digest": "049951e05063a9950c5f32791b96f393",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.7",
            "size": 176871,
            "upload_time": "2024-07-10T05:13:15",
            "upload_time_iso_8601": "2024-07-10T05:13:15.535918Z",
            "url": "https://files.pythonhosted.org/packages/ef/41/8c3be80ab9227f7a871847190340d4223b1643fa2cf7af42c2bfd47c273d/torchtree_physher-1.0.0-cp312-cp312-macosx_11_0_arm64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4af2aeef673bca12a5bc12a5d97895f9406e919c4dc39c63e2ac9a11ca8aee3a",
                "md5": "19931ccb574188d6b2089d88c4f7cfe7",
                "sha256": "1f84064326b6e490871f0279243af62d78390bd6b67e2444d7825279f27323e9"
            },
            "downloads": -1,
            "filename": "torchtree-physher-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "19931ccb574188d6b2089d88c4f7cfe7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 32420,
            "upload_time": "2024-07-10T05:13:17",
            "upload_time_iso_8601": "2024-07-10T05:13:17.748037Z",
            "url": "https://files.pythonhosted.org/packages/4a/f2/aeef673bca12a5bc12a5d97895f9406e919c4dc39c63e2ac9a11ca8aee3a/torchtree-physher-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-10 05:13:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "4ment",
    "github_project": "torchtree-physher",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "torchtree-physher"
}
        
Elapsed time: 0.26467s