An open API service indexing awesome lists of open source software.

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

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