Description Usage Arguments Details Value Examples
Change the cell names in all the different parts of an object. Can be useful before combining multiple objects.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | RenameCells(object, ...)
## S3 method for class 'Assay'
RenameCells(object, new.names = NULL, ...)
## S3 method for class 'DimReduc'
RenameCells(object, new.names = NULL, ...)
## S3 method for class 'Seurat'
RenameCells(
object,
add.cell.id = NULL,
new.names = NULL,
for.merge = FALSE,
...
)
|
object |
An object |
... |
Arguments passed to other methods |
new.names |
vector of new cell names |
add.cell.id |
prefix to add cell names |
for.merge |
Only rename slots needed for merging Seurat objects. Currently only renames the raw.data and meta.data slots. |
If add.cell.id
is set a prefix is added to existing cell names. If
new.names
is set these will be used to replace existing names.
An object with new cell names
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # Rename cells in an Assay
head(x = colnames(x = pbmc_small[["RNA"]]))
renamed.assay <- RenameCells(
object = pbmc_small[["RNA"]],
new.names = paste0("A_", colnames(x = pbmc_small[["RNA"]]))
)
head(x = colnames(x = renamed.assay))
# Rename cells in a DimReduc
head(x = Cells(x = pbmc_small[["pca"]]))
renamed.dimreduc <- RenameCells(
object = pbmc_small[["pca"]],
new.names = paste0("A_", Cells(x = pbmc_small[["pca"]]))
)
head(x = Cells(x = renamed.dimreduc))
# Rename cells in a Seurat object
head(x = colnames(x = pbmc_small))
pbmc_small <- RenameCells(object = pbmc_small, add.cell.id = "A")
head(x = colnames(x = pbmc_small))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.