Constructs a phylogenetic tree relating the 'average' cell from each identity class. Tree is estimated based on a distance matrix constructed in either gene expression space or PCA space.

BuildClusterTree(
  object,
  assay = NULL,
  features = NULL,
  dims = NULL,
  graph = NULL,
  slot = "data",
  reorder = FALSE,
  reorder.numeric = FALSE,
  verbose = TRUE
)

Arguments

object

Seurat object

assay

Assay to use for the analysis.

features

Genes to use for the analysis. Default is the set of variable genes (VariableFeatures(object = object))

dims

If set, tree is calculated in PCA space; overrides features

graph

If graph is passed, build tree based on graph connectivity between clusters; overrides dims and features

slot

Slot(s) to use; if multiple slots are given, assumed to follow the order of 'assays' (if specified) or object's assays

reorder

Re-order identity classes (factor ordering), according to position on the tree. This groups similar classes together which can be helpful, for example, when drawing violin plots.

reorder.numeric

Re-order identity classes according to position on the tree, assigning a numeric value ('1' is the leftmost node)

verbose

Show progress updates

Value

A Seurat object where the cluster tree can be accessed with Tool

Details

Note that the tree is calculated for an 'average' cell, so gene expression or PC scores are averaged across all cells in an identity class before the tree is constructed.

Examples

data("pbmc_small") pbmc_small
#> An object of class Seurat #> 230 features across 80 samples within 1 assay #> Active assay: RNA (230 features, 20 variable features) #> 2 dimensional reductions calculated: pca, tsne
pbmc_small <- BuildClusterTree(object = pbmc_small) Tool(object = pbmc_small, slot = 'BuildClusterTree')
#> #> Phylogenetic tree with 3 tips and 2 internal nodes. #> #> Tip labels: #> 0, 1, 2 #> #> Rooted; includes branch lengths.