Visualize how cells move between clusters across multiple Seurat clustering resolutions.
Usage
ClusterTreePlot(
srt,
cluster_cols = NULL,
prefix = NULL,
resolutions = NULL,
features = NULL,
assay = NULL,
layer = "data",
edge_threshold = 0,
node_palette = "Spectral",
node_palcolor = NULL,
edge_palette = "YlOrRd",
edge_palcolor = NULL,
node_size = c(3, 10),
edge_size = c(0.25, 1.8),
label = TRUE,
label.size = 3,
label.fg = "black",
title = "Cluster tree",
subtitle = NULL,
xlab = "Resolution",
ylab = "Cluster",
legend.position = "right",
theme_use = "theme_scop",
theme_args = list(),
combine = TRUE,
ncol = NULL,
return_data = FALSE,
verbose = TRUE
)Arguments
- srt
A Seurat object.
- cluster_cols
Metadata columns containing clustering results at different resolutions. If
NULL, columns generated bySeurat::FindClusters(resolution = c(...))are detected automatically.- prefix
Optional prefix used to filter automatically detected clustering columns, for example
"RNA_snn".- resolutions
Optional numeric vector used to filter automatically detected resolutions.
- features
A character vector or a named list of features to plot. Features can be gene names in Assay or names of numeric columns in meta.data.
- assay
Which assay to use. If
NULL, the default assay of the Seurat object will be used. When the object also containsChromatinAssay, the default assay and additionalChromatinAssaywill be preprocessed sequentially.- layer
Which layer to use. Default is
data.- edge_threshold
Minimum incoming proportion required to draw an edge. Edges below this threshold are still available when
return_data = TRUE.- node_palette, node_palcolor
Palette used for node colors.
- edge_palette, edge_palcolor
Palette used for edge colors.
- node_size
Numeric range used for node sizes.
- edge_size
Numeric range used for edge widths.
- label
Whether the feature name is labeled in the center of the location of cells with high expression.
- label.size
Size of labels.
- label.fg
Foreground color of label.
- title
The text for the title. Default is
NULL.- subtitle
The text for the subtitle for the plot which will be displayed below the title. Default is
NULL.- xlab
The x-axis label of the plot. Default is
NULL.- ylab
The y-axis label of the plot. Default is
NULL.- legend.position
The position of legends, one of
"none","left","right","bottom","top". Default is"right".- theme_use
Theme used. Can be a character string or a theme function. Default is
"theme_scop".- theme_args
Other arguments passed to the
theme_use. Default islist().- combine
Combine plots into a single
patchworkobject. IfFALSE, return a list of ggplot objects.- ncol
Number of columns in the combined plot. Default is
NULL, which means determined automatically based on the number of plots.- return_data
Whether to return plot data along with the plot.
- verbose
Whether to print the message. Default is
TRUE.
Value
A ggplot, patchwork, list of ggplot objects, or a list with
plot data when return_data = TRUE.
Examples
if (FALSE) { # \dontrun{
data(pancreas_sub)
pancreas_sub <- standard_scop(pancreas_sub, verbose = FALSE)
pancreas_sub <- Seurat::FindClusters(
pancreas_sub,
resolution = seq(0.2, 1, by = 0.2),
verbose = FALSE
)
ClusterTreePlot(pancreas_sub)
ClusterTreePlot(
pancreas_sub,
features = c("Ins1", "Gcg")
)
} # }