Rename clusters for the Seurat object
Usage
RenameClusters(
srt,
group.by,
nameslist = list(),
name = "newclusters",
keep_levels = FALSE
)Examples
data("pancreas_sub")
levels(pancreas_sub@meta.data[["SubCellType"]])
#> [1] "Ductal" "Ngn3 low EP" "Ngn3 high EP" "Pre-endocrine" "Beta" "Alpha" "Delta"
#> [8] "Epsilon"
# Rename all clusters
pancreas_sub <- RenameClusters(pancreas_sub, group.by = "SubCellType", nameslist = letters[1:8])
CellDimPlot(pancreas_sub, "newclusters")
#> Warning: No shared levels found between `names(values)` of the manual scale and the data's fill values.
# Rename specified clusters
pancreas_sub <- RenameClusters(pancreas_sub,
group.by = "SubCellType",
nameslist = list("a" = "Alpha", "b" = "Beta")
)
CellDimPlot(pancreas_sub, "newclusters")
#> Warning: No shared levels found between `names(values)` of the manual scale and the data's fill values.
# Merge and rename clusters
pancreas_sub <- RenameClusters(pancreas_sub,
group.by = "SubCellType",
nameslist = list("EndocrineClusters" = c("Alpha", "Beta", "Epsilon", "Delta")),
name = "Merged", keep_levels = TRUE
)
CellDimPlot(pancreas_sub, "Merged")
#> Warning: No shared levels found between `names(values)` of the manual scale and the data's fill values.