Skip to contents

Build a minimum spanning tree over cluster centroids on UMAP/PCA and draw arrows to visualize putative transitions.

Usage

VisClusterFlowGraph(
  object,
  group.by = "seurat_clusters",
  reduction = "umap",
  palette = "C",
  point_size = 7,
  point_alpha = 0.9,
  label_size = 7
)

Arguments

object

A Seurat object; UMAP/PCA is computed when absent.

group.by

Metadata column for cluster identity. Default: "seurat_clusters".

reduction

Reduction name ('umap' or 'pca'). Default: 'umap'.

palette

Viridis palette option for color/fill. Default: "C".

point_size

Centroid point size. Default: 7.

point_alpha

Centroid point alpha. Default: 0.9.

label_size

Label size. Default: 7.

Value

A ggplot with centroid nodes and MST edges.

Author

benben-miao

Examples

obj <- SeuratVisProExample(
    n_cells = 300,
    n_genes = 1000,
    n_clusters = 10,
    seed = 123,
    genes_mt = "^MT-",
    neighbor_dims = 10,
    cluster_res = 0.5,
    umap_dims = 10,
    spatial = FALSE)
#> Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
#> 
#> Number of nodes: 300
#> Number of edges: 4508
#> 
#> Running Louvain algorithm...
#> Maximum modularity in 10 random starts: 0.9485
#> Number of communities: 10
#> Elapsed time: 0 seconds

p <- VisClusterFlowGraph(
   obj,
   group.by = "seurat_clusters",
   reduction = "umap",
   palette = "C",
   point_size = 7,
   point_alpha = 0.9,
   label_size = 5)
p