Title: Maximum-Likelihood Perfect Phylogeny Inference at Scale
URL: https://github.com/kharchenkolab/scistreer, https://kharchenkolab.github.io/scistreer/
Version: 1.2.0
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).
License: GPL-3
Encoding: UTF-8
LazyData: true
Depends: R (≥ 4.1.0)
Imports: ape, dplyr, ggplot2, ggtree, igraph, parallelDist, patchwork, phangorn, Rcpp, reshape2, RcppParallel, RhpcBLASctl, stringr, tidygraph
Suggests: testthat (≥ 3.0.0)
Config/testthat/edition: 3
LinkingTo: Rcpp, RcppArmadillo, RcppParallel
NeedsCompilation: yes
SystemRequirements: GNU make
Author: Teng Gao [cre, aut], Evan Biederstedt [aut], Peter Kharchenko [aut], Yufeng Wu [aut]
Maintainer: Teng Gao <tgaoteng@gmail.com>
RoxygenNote: 7.2.2
Packaged: 2023-06-15 19:49:42 UTC; teng
Repository: CRAN
Date/Publication: 2023-06-15 20:20:02 UTC

Example genotype probability matrix

Description

Example genotype probability matrix

Usage

P_example

Format

An object of class matrix (inherits from array) with 1000 rows and 25 columns.


Smaller example genotype probability matrix

Description

Smaller example genotype probability matrix

Usage

P_small

Format

An object of class matrix (inherits from array) with 100 rows and 25 columns.


Find maximum lilkelihood assignment of mutations on a tree

Description

Find maximum lilkelihood assignment of mutations on a tree

Usage

annotate_tree(tree, P)

Arguments

tree

phylo Single-cell phylogenetic tree

P

matrix Genotype probability matrix

Value

tbl_graph A single-cell phylogeny with mutation placements

Examples

gtree_small = annotate_tree(tree_small, P_small)

Convert a single-cell phylogeny with mutation placements into a mutation graph

Description

Convert a single-cell phylogeny with mutation placements into a mutation graph

Usage

get_mut_graph(gtree)

Arguments

gtree

tbl_graph The single-cell phylogeny

Value

igraph Mutation graph

Examples

mut_graph = get_mut_graph(gtree_small)

Smaller example annotated tree built from P_small

Description

Smaller example annotated tree built from P_small

Usage

gtree_small

Format

An object of class tbl_graph (inherits from igraph) of length 199.


Annotate the direct upstream or downstream mutations on the edges

Description

Annotate the direct upstream or downstream mutations on the edges

Usage

label_edges(G)

Arguments

G

igraph Mutation graph

Value

igraph Mutation graph


From ape; will remove once new ape version is released https://github.com/emmanuelparadis/ape/issues/54

Description

From ape; will remove once new ape version is released https://github.com/emmanuelparadis/ape/issues/54

Usage

ladderize(phy, right = TRUE)

Arguments

phy

phylo The phylogeny

right

logical Whether ladderize to the right

Examples

tree_small = ladderize(tree_small)

Mutation placements calculated from tree_small and P_small

Description

Mutation placements calculated from tree_small and P_small

Usage

mut_nodes_small

Format

An object of class data.frame with 9 rows and 2 columns.


Transfer mutation assignment onto a single-cell phylogeny

Description

Transfer mutation assignment onto a single-cell phylogeny

Usage

mut_to_tree(gtree, mut_nodes)

Arguments

gtree

tbl_graph The single-cell phylogeny

mut_nodes

dataframe Mutation placements

Value

tbl_graph A single-cell phylogeny with mutation placements

Examples

gtree_small = mut_to_tree(gtree_small, mut_nodes_small)

Maximum likelihood tree search via NNI

Description

Maximum likelihood tree search via NNI

Usage

perform_nni(
  tree_init,
  P,
  max_iter = 100,
  eps = 0.01,
  ncores = 1,
  verbose = TRUE
)

Arguments

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

Value

multiPhylo List of trees corresponding to the rearrangement steps

Examples

tree_list = perform_nni(tree_upgma, P_small)

Plot phylogeny and mutation heatmap

Description

Plot phylogeny and mutation heatmap

Usage

plot_phylo_heatmap(tree, P, branch_width = 0.5, root_edge = TRUE)

Arguments

tree

phylo or tbl_graph Phylogeny

P

matrix Genotype probability matrix

branch_width

numeric Branch width

root_edge

logical Whether to plot root edge

Value

ggplot Plot visualizing the single-cell phylogeny and mutation probability heatmap

Examples

p = plot_phylo_heatmap(tree_small, P_small)

Run the scistree workflow

Description

Run the scistree workflow

Usage

run_scistree(
  P,
  init = "UPGMA",
  ncores = 1,
  max_iter = 100,
  eps = 0.01,
  verbose = TRUE
)

Arguments

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

Value

phylo A maximum-likelihood phylogeny

Examples

tree_small = run_scistree(P_small)

Score a tree based on maximum likelihood

Description

Score a tree based on maximum likelihood

Usage

score_tree(tree, P, get_l_matrix = FALSE)

Arguments

tree

phylo object

P

genotype probability matrix

get_l_matrix

whether to compute the whole likelihood matrix

Value

list Likelihood scores of a tree

Examples

tree_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

Description

Convert the phylogeny from tidygraph to phylo object modified from R package alakazam, converts a tbl_graph to a phylo object

Usage

to_phylo(graph)

Arguments

graph

tbl_graph The single-cell phylogeny

Value

phylo The single-cell phylogeny

Examples

tree_small = to_phylo(annotate_tree(tree_small, P_small))

Description

Annotate the direct upstream or downstream node on the edges

Usage

transfer_links(G)

Arguments

G

igraph Mutation graph

Value

igraph Mutation graph


Smaller example tree built from P_small

Description

Smaller example tree built from P_small

Usage

tree_small

Format

An object of class phylo of length 5.


Example tree built using UPGMA from P_small

Description

Example tree built using UPGMA from P_small

Usage

tree_upgma

Format

An object of class phylo of length 4.