Get, set, and manipulate an object's identity classes
Get, set, and manipulate an object's identity classes
Idents(object, ...) Idents(object, ...) <- value RenameIdents(object, ...) ReorderIdent(object, var, ...) SetIdent(object, ...) StashIdent(object, save.name, ...) ## S3 method for class 'Seurat' Idents(object, ...) ## S3 replacement method for class 'Seurat' Idents(object, cells = NULL, drop = FALSE, ...) <- value ## S3 method for class 'Seurat' ReorderIdent( object, var, reverse = FALSE, afxn = mean, reorder.numeric = FALSE, ... ) ## S3 method for class 'Seurat' RenameIdents(object, ...) ## S3 method for class 'Seurat' SetIdent(object, cells = NULL, value, ...) ## S3 method for class 'Seurat' StashIdent(object, save.name = "orig.ident", ...) ## S3 method for class 'Seurat' droplevels(x, ...) ## S3 method for class 'Seurat' levels(x) ## S3 replacement method for class 'Seurat' levels(x) <- value
... |
Arguments passed to other methods; for |
value |
The name of the identities to pull from object metadata or the identities themselves |
var |
Feature or variable to order on |
save.name |
Store current identity information under this name |
cells |
Set cell identities for specific cells |
drop |
Drop unused levels |
reverse |
Reverse ordering |
afxn |
Function to evaluate each identity class based on; default is
|
reorder.numeric |
Rename all identity classes to be increasing numbers starting from 1 (default is FALSE) |
x, object |
An object |
Idents: The cell identities
Idents<-: object with the cell identities changed
RenameIdents: An object with selected identity classes renamed
ReorderIdent: An object with
SetIdent: An object with new identity classes set
StashIdent: An object with the identities stashed
# Get cell identity classes
Idents(pbmc_small)
# Set cell identity classes
# Can be used to set identities for specific cells to a new level
Idents(pbmc_small, cells = 1:4) <- 'a'
head(Idents(pbmc_small))
# Can also set idents from a value in object metadata
colnames(pbmc_small[[]])
Idents(pbmc_small) <- 'RNA_snn_res.1'
levels(pbmc_small)
# Rename cell identity classes
# Can provide an arbitrary amount of idents to rename
levels(pbmc_small)
pbmc_small <- RenameIdents(pbmc_small, '0' = 'A', '2' = 'C')
levels(pbmc_small)
## Not run:
head(Idents(pbmc_small))
pbmc_small <- ReorderIdent(pbmc_small, var = 'PC_1')
head(Idents(pbmc_small))
## End(Not run)
# Set cell identity classes using SetIdent
cells.use <- WhichCells(pbmc_small, idents = '1')
pbmc_small <- SetIdent(pbmc_small, cells = cells.use, value = 'B')
head(pbmc_small[[]])
pbmc_small <- StashIdent(pbmc_small, save.name = 'idents')
head(pbmc_small[[]])
# Get the levels of identity classes of a Seurat object
levels(x = pbmc_small)
# Reorder identity classes
levels(x = pbmc_small)
levels(x = pbmc_small) <- c('C', 'A', 'B')
levels(x = pbmc_small)Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.