View source: R/AddModuleScore_UCell.R
AddModuleScore_UCell | R Documentation |
Given a Seurat object, calculates module/signature enrichment scores at single-cell level using the Mann-Whitney U statistic. UCell scores are normalized U statistics (between 0 and 1), and they are mathematically related to the Area under the ROC curve (see Mason and Graham)
AddModuleScore_UCell(
obj,
features,
maxRank = 1500,
chunk.size = 100,
BPPARAM = NULL,
ncores = 1,
storeRanks = FALSE,
w_neg = 1,
assay = NULL,
slot = "counts",
ties.method = "average",
force.gc = FALSE,
name = "_UCell"
)
obj |
Seurat object |
features |
A list of signatures, for example:
|
maxRank |
Maximum number of genes to rank per cell; above this rank, a given gene is considered as not expressed. |
chunk.size |
Number of cells to be processed simultaneously (lower size requires slightly more computation but reduces memory demands) |
BPPARAM |
A |
ncores |
Number of processors to parallelize computation. If
|
storeRanks |
Store ranks matrix in Seurat object ('UCellRanks' assay) for fast subsequent computations. This option may demand large amounts of RAM. |
w_neg |
Weight on negative genes in signature. e.g. |
assay |
Pull out data from this assay of the Seurat object
(if NULL, use |
slot |
Pull out data from this slot (layer in v5) of the Seurat object |
ties.method |
How ranking ties should be resolved - passed on to data.table::frank |
force.gc |
Explicitly call garbage collector to reduce memory footprint |
name |
Name tag that will be appended at the end of each signature name, "_UCell" by default (e.g. signature score in meta data will be named: Myeloid_signature_UCell) |
In contrast to Seurat's AddModuleScore, which is normalized by binning genes of similar expression at the population level, UCell scores depend only on the gene expression ranks of individual cell, and therefore they are robust across datasets regardless of dataset composition.
Returns a Seurat object with module/signature enrichment scores
added to object meta data; each score is stored as the corresponding
signature name provided in features
followed by the tag given
in name
(or "_UCell" by default )
library(UCell)
gene.sets <- list(Tcell = c("CD2","CD3E","CD3D"),
Myeloid = c("SPI1","FCER1G","CSF1R"))
data(sample.matrix)
obj <- Seurat::CreateSeuratObject(sample.matrix)
obj <- AddModuleScore_UCell(obj,features = gene.sets)
head(obj[[]])
## Using positive and negative gene sets
gene.sets <- list()
gene.sets$Tcell_gd <- c("TRDC+","TRGC1+","TRGC2+","TRDV1+",
"TRAC-","TRBC1-","TRBC2-")
gene.sets$NKcell <- c("FGFBP2+", "SPON2+", "KLRF1+",
"FCGR3A+", "CD3E-","CD3G-")
obj <- AddModuleScore_UCell(obj, features = gene.sets, name=NULL)
head(obj$NKcell)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.