https://github.com/walterxie/treespace
Animation of the tree space
https://github.com/walterxie/treespace
animation python3 treespace
Last synced: 2 months ago
JSON representation
Animation of the tree space
- Host: GitHub
- URL: https://github.com/walterxie/treespace
- Owner: walterxie
- Created: 2018-05-23T01:40:53.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-30T02:58:25.000Z (about 7 years ago)
- Last Synced: 2025-02-02T02:28:00.359Z (4 months ago)
- Topics: animation, python3, treespace
- Language: Jupyter Notebook
- Homepage: https://walterxie.github.io/TreeSpace/
- Size: 6.67 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Tree Space
Display the topologies of 3-taxa tree sampled from MCMC
under Kingman's coalescent model.## 3 Taxa
There are 3 different topologies in this tree space:
1. `T=0`, where the tree is `(A,B),C`;
2. `T=1`, where the tree is `(A,C),B`;
3. `T=2`, where the tree is `(B,C),A`.We define the tree interval _k1_ is the root height minus
internal node height, and _k2_ is the internal node height.
Both _k1_ and _k2_ are simulated by Kingman's coalescent
model using MCMC, where the probability of genealogies in a population is:P(k1, k2, T | Ne) =
(1/Ne) * e(-k1/Ne) * (1/Ne) * e(-3*k2/Ne)Assuming Ne = 1, then the above equation is simplified to:
P(k1, k2, T) = e-k1 * e(-3*k2)
The proposal during MCMC sampling makes the equal probability change _k1_ and _k2_ using the random walk algorithm, where the jump size _w_ is default to 1.
When _k1_ is smaller than 0, there will be an equal probability
to change the tree from this topology to any of another two topologies.The animation of 10,000 samples is available from
[below](https://walterxie.github.io/TreeSpace/#taxa3).
More animations with different jump size _w_ are available under the folder
[note](https://github.com/walterxie/TreeSpace/tree/master/note) in the repository.## Code
The python 3 source code is available from the Jupyter Notebook file
[TreeSpace3Taxa.ipynb](https://github.com/walterxie/TreeSpace/blob/master/note/TreeSpace3Taxa.ipynb)## Diagnose
* MovieWriter ffmpeg unavailable:
```bash
brew install ffmpeg
ffmpeg
```