Calculate module scores for feature expression programs in single cells
Source:R/generics.R, R/utilities.R
AddModuleScore.RdCalculate the average expression levels of each program (cluster) on single cell level, subtracted by the aggregated expression of control feature sets. All analyzed features are binned based on averaged expression, and the control features are randomly selected from each bin.
Calculate the average expression levels of each program (cluster) on single cell level, subtracted by the aggregated expression of control feature sets. All analyzed features are binned based on averaged expression, and the control features are randomly selected from each bin.
Usage
AddModuleScore(object, ...)
# S3 method for class 'Seurat'
AddModuleScore(
object,
features,
pool = NULL,
nbin = 24,
ctrl = 100,
k = FALSE,
assay = NULL,
name = "Cluster",
seed = 1,
search = FALSE,
slot = "data",
...
)
# S3 method for class 'StdAssay'
AddModuleScore(
object,
features,
kmeans.obj,
pool = NULL,
nbin = 24,
ctrl = 100,
k = FALSE,
name = "Cluster",
seed = 1,
search = FALSE,
slot = "data",
...
)
# S3 method for class 'Assay'
AddModuleScore(
object,
features,
kmeans.obj,
pool = NULL,
nbin = 24,
ctrl = 100,
k = FALSE,
name = "Cluster",
seed = 1,
search = FALSE,
slot = "data",
...
)Arguments
- object
Seurat object
- ...
Extra parameters passed to
UpdateSymbolList- features
A list of vectors of features for expression programs; each entry should be a vector of feature names
- pool
List of features to check expression levels against, defaults to
rownames(x = object)- nbin
Number of bins of aggregate expression levels for all analyzed features
- ctrl
Number of control features selected from the same bin per analyzed feature
- k
Use feature clusters returned from DoKMeans
- assay
Name of assay to use
- name
Name for the expression programs; will append a number to the end for each entry in
features(eg. iffeatureshas three programs, the results will be stored asname1,name2,name3, respectively)- seed
Set a random seed. If NULL, seed is not set.
- search
Search for symbol synonyms for features in
featuresthat don't match features inobject? Searches the HGNC's gene names database; seeUpdateSymbolListfor more details- slot
Slot to calculate score values off of. Defaults to data slot (i.e log-normalized counts)
- kmeans.obj
A
DoKMeansoutput used to define feature clusters whenk = TRUE; ignored ifk = FALSE.
Value
Returns a Seurat object with module scores added to object meta data;
each module is stored as name# for each module program present in
features
Returns a Seurat object with module scores added to object meta data;
each module is stored as name# for each module program present in
features
Examples
if (FALSE) { # \dontrun{
data("pbmc_small")
cd_features <- list(c(
'CD79B',
'CD79A',
'CD19',
'CD180',
'CD200',
'CD3D',
'CD2',
'CD3E',
'CD7',
'CD8A',
'CD14',
'CD1C',
'CD68',
'CD9',
'CD247'
))
pbmc_small <- AddModuleScore(
object = pbmc_small,
features = cd_features,
ctrl = 5,
name = 'CD_Features'
)
head(x = pbmc_small[])
} # }