| Title: | Maximum-Likelihood Perfect Phylogeny Inference at Scale |
|---|---|
| Description: | Fast maximum-likelihood phylogeny inference from noisy single-cell data using the 'ScisTree' algorithm by Yufeng Wu (2019) <doi:10.1093/bioinformatics/btz676>. 'scistreer' provides an 'R' interface and improves speed via 'Rcpp' and 'RcppParallel', making the method applicable to massive single-cell datasets (>10,000 cells). |
| Authors: | Teng Gao [cre, aut], Evan Biederstedt [aut], Peter Kharchenko [aut], Yufeng Wu [aut] |
| Maintainer: | Teng Gao <[email protected]> |
| License: | GPL-3 |
| Version: | 1.2.1 |
| Built: | 2026-05-18 10:30:14 UTC |
| Source: | https://github.com/kharchenkolab/scistreer |
Find maximum lilkelihood assignment of mutations on a tree
annotate_tree(tree, P)annotate_tree(tree, P)
tree |
phylo Single-cell phylogenetic tree |
P |
matrix Genotype probability matrix |
tbl_graph A single-cell phylogeny with mutation placements
gtree_small = annotate_tree(tree_small, P_small)gtree_small = annotate_tree(tree_small, P_small)
Convert a single-cell phylogeny with mutation placements into a mutation graph
get_mut_graph(gtree)get_mut_graph(gtree)
gtree |
tbl_graph The single-cell phylogeny |
igraph Mutation graph
mut_graph = get_mut_graph(gtree_small)mut_graph = get_mut_graph(gtree_small)
Smaller example annotated tree built from P_small
gtree_smallgtree_small
An object of class tbl_graph (inherits from igraph) of length 199.
From ape; will remove once new ape version is released https://github.com/emmanuelparadis/ape/issues/54
ladderize(phy, right = TRUE)ladderize(phy, right = TRUE)
phy |
phylo The phylogeny |
right |
logical Whether ladderize to the right |
tree_small = ladderize(tree_small)tree_small = ladderize(tree_small)
Mutation placements calculated from tree_small and P_small
mut_nodes_smallmut_nodes_small
An object of class data.frame with 9 rows and 2 columns.
Transfer mutation assignment onto a single-cell phylogeny
mut_to_tree(gtree, mut_nodes)mut_to_tree(gtree, mut_nodes)
gtree |
tbl_graph The single-cell phylogeny |
mut_nodes |
dataframe Mutation placements |
tbl_graph A single-cell phylogeny with mutation placements
gtree_small = mut_to_tree(gtree_small, mut_nodes_small)gtree_small = mut_to_tree(gtree_small, mut_nodes_small)
Example genotype probability matrix
P_exampleP_example
An object of class matrix (inherits from array) with 1000 rows and 25 columns.
Smaller example genotype probability matrix
P_smallP_small
An object of class matrix (inherits from array) with 100 rows and 25 columns.
Maximum likelihood tree search via NNI
perform_nni( tree_init, P, max_iter = 100, eps = 0.01, ncores = 1, verbose = TRUE )perform_nni( tree_init, P, max_iter = 100, eps = 0.01, ncores = 1, verbose = TRUE )
tree_init |
phylo Intial tree |
P |
matrix Genotype probability matrix |
max_iter |
integer Maximum number of iterations |
eps |
numeric Tolerance threshold in likelihood difference for stopping |
ncores |
integer Number of cores to use |
verbose |
logical Verbosity |
multiPhylo List of trees corresponding to the rearrangement steps
tree_list = perform_nni(tree_upgma, P_small)tree_list = perform_nni(tree_upgma, P_small)
Plot phylogeny and mutation heatmap
plot_phylo_heatmap(tree, P, branch_width = 0.5, root_edge = TRUE)plot_phylo_heatmap(tree, P, branch_width = 0.5, root_edge = TRUE)
tree |
phylo or tbl_graph Phylogeny |
P |
matrix Genotype probability matrix |
branch_width |
numeric Branch width |
root_edge |
logical Whether to plot root edge |
ggplot Plot visualizing the single-cell phylogeny and mutation probability heatmap
p = plot_phylo_heatmap(tree_small, P_small)p = plot_phylo_heatmap(tree_small, P_small)
Run the scistree workflow
run_scistree( P, init = "UPGMA", ncores = 1, max_iter = 100, eps = 0.01, verbose = TRUE )run_scistree( P, init = "UPGMA", ncores = 1, max_iter = 100, eps = 0.01, verbose = TRUE )
P |
matrix Genotype probability matrix (cell x mutation). Each entry is a probability (0-1) that the cell harbors the mutation |
init |
character Initialization strategy; UPGMA or NJ |
ncores |
integer Number of cores to use |
max_iter |
integer Maximum number of iterations |
eps |
numeric Tolerance threshold in likelihood difference for stopping |
verbose |
logical Verbosity |
phylo A maximum-likelihood phylogeny
tree_small = run_scistree(P_small)tree_small = run_scistree(P_small)
Score a tree based on maximum likelihood
score_tree(tree, P, get_l_matrix = FALSE)score_tree(tree, P, get_l_matrix = FALSE)
tree |
phylo object |
P |
genotype probability matrix |
get_l_matrix |
whether to compute the whole likelihood matrix |
list Likelihood scores of a tree
tree_likelihood = score_tree(tree_upgma, P_small)$l_treetree_likelihood = score_tree(tree_upgma, P_small)$l_tree
Convert the phylogeny from tidygraph to phylo object modified from R package alakazam, converts a tbl_graph to a phylo object
to_phylo(graph)to_phylo(graph)
graph |
tbl_graph The single-cell phylogeny |
phylo The single-cell phylogeny
tree_small = to_phylo(annotate_tree(tree_small, P_small))tree_small = to_phylo(annotate_tree(tree_small, P_small))
Smaller example tree built from P_small
tree_smalltree_small
An object of class phylo of length 5.
Example tree built using UPGMA from P_small
tree_upgmatree_upgma
An object of class phylo of length 4.