{"id":18621290,"url":"https://github.com/4ment/torchtree-physher","last_synced_at":"2026-04-09T03:31:50.279Z","repository":{"id":187089871,"uuid":"465279042","full_name":"4ment/torchtree-physher","owner":"4ment","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-23T00:47:31.000Z","size":80,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-01-02T12:35:55.449Z","etag":null,"topics":["c","gradient","phylogenetics","physher","pytorch","torchtree"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/4ment.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-03-02T11:34:38.000Z","updated_at":"2025-09-23T00:47:34.000Z","dependencies_parsed_at":"2024-01-31T08:57:08.306Z","dependency_job_id":"68381d7a-a315-4126-9759-3151bf12cd29","html_url":"https://github.com/4ment/torchtree-physher","commit_stats":null,"previous_names":["4ment/torchtree-physher"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/4ment/torchtree-physher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4ment%2Ftorchtree-physher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4ment%2Ftorchtree-physher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4ment%2Ftorchtree-physher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4ment%2Ftorchtree-physher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/4ment","download_url":"https://codeload.github.com/4ment/torchtree-physher/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4ment%2Ftorchtree-physher/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31584568,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"online","status_checked_at":"2026-04-09T02:00:06.848Z","response_time":112,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","gradient","phylogenetics","physher","pytorch","torchtree"],"created_at":"2024-11-07T04:10:20.839Z","updated_at":"2026-04-09T03:31:50.264Z","avatar_url":"https://github.com/4ment.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 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 \u003e 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 \u003e 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` (aka skyglide)\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F4ment%2Ftorchtree-physher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F4ment%2Ftorchtree-physher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F4ment%2Ftorchtree-physher/lists"}