Reconstruct tree by Trisicell-PartF#

This example shows how to assess a phylogenetic tree using Trisicell-PartF on a binary single-cell genotype matrix.

import scphylo as scp

# sphinx_gallery_thumbnail_path = "_static/thumbnails/trisicell-partf.png"

First, we load a binary test single-cell genotype data.

df_in = scp.datasets.test()
df_in.head()
mut0 mut1 mut2 mut3 mut4 mut5 mut6 mut7 mut8 mut9 mut10 mut11 mut12 mut13 mut14 mut15 mut16 mut17 mut18 mut19
cellIDxmutID
cell0 1 1 1 1 1 1 1 0 3 3 0 3 0 0 0 3 0 0 0 0
cell1 3 0 0 0 0 0 3 0 1 1 3 1 0 0 3 0 0 1 1 1
cell2 0 0 0 0 0 0 0 1 1 3 1 1 0 0 3 1 1 1 1 0
cell3 0 0 0 0 0 0 0 3 1 0 0 1 0 0 0 1 1 1 0 0
cell4 0 0 0 0 0 0 0 1 1 1 1 1 0 0 3 0 0 0 0 0


Then, using scphylo.tl.partf() we calculate the probability of cell6 and cell17 seeded by mut12

probs = scp.tl.partition_function(
    df_in,
    alpha=0.000001,
    beta=0.1,
    n_samples=100,
    n_batches=10,
    muts=["mut12"],
    cells=["cell6", "cell17"],
)
probs.mean(axis=1).round(4).values[0]
elapsed time: 0:00:04.770798

0.8948

Total running time of the script: (0 minutes 5.207 seconds)

Estimated memory usage: 10 MB

Gallery generated by Sphinx-Gallery