View source: R/ScoreSignatures_UCell.R
ScoreSignatures_UCell | R Documentation |
Given a gene vs. cell matrix, calculates module/signature enrichment scores on single-cell level using 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) These scores only depend on the gene expression ranks of individual cell, and therefore they are robust across datasets regardless of dataset composition.
ScoreSignatures_UCell(
matrix = NULL,
features,
precalc.ranks = NULL,
maxRank = 1500,
w_neg = 1,
name = "_UCell",
assay = "counts",
chunk.size = 100,
BPPARAM = NULL,
ncores = 1,
ties.method = "average",
force.gc = FALSE
)
matrix |
Input matrix, either stored in a SingleCellExperiment object
or as a raw matrix. |
features |
A list of signatures, for example:
|
precalc.ranks |
If you have pre-calculated ranks using
|
maxRank |
Maximum number of genes to rank per cell; above this rank, a
given gene is considered as not expressed. Note: this parameter is
ignored if |
w_neg |
Weight on negative genes in signature. e.g. |
name |
Name suffix appended to signature names |
assay |
The sce object assay where the data is to be found |
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
|
ties.method |
How ranking ties should be resolved - passed on to data.table::frank |
force.gc |
Explicitly call garbage collector to reduce memory footprint |
Returns input SingleCellExperiment object with UCell scores added to altExp
library(UCell)
# Using sparse matrix
data(sample.matrix)
gene.sets <- list( Tcell_signature = c("CD2","CD3E","CD3D"),
Myeloid_signature = c("SPI1","FCER1G","CSF1R"))
scores <- ScoreSignatures_UCell(sample.matrix, features=gene.sets)
head(scores)
# Using sce object
library(SingleCellExperiment)
data(sample.matrix)
my.sce <- SingleCellExperiment(list(counts=sample.matrix))
gene.sets <- list( Tcell_signature = c("CD2","CD3E","CD3D"),
Myeloid_signature = c("SPI1","FCER1G","CSF1R"))
my.sce <- ScoreSignatures_UCell(my.sce, features=gene.sets)
altExp(my.sce, 'UCell')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.