Rename clusters for the Seurat object
Usage
RenameClusters(
srt,
group.by,
nameslist = list(),
name = "newclusters",
keep_levels = FALSE
)
Examples
data("pancreas_sub")
# Rename all clusters
levels(pancreas_sub@meta.data[["SubCellType"]]) <- unique(
pancreas_sub@meta.data[["SubCellType"]]
)
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.