normGenesetExpression | R Documentation |
Calculate normalized expression for a set of genes in each cell
from a SingleCellExperiment
, using random sets of similarly
expressed genes as background to account for cell quality and
sequencing depth.
normGenesetExpression(
sce,
genes,
expr_values = "logcounts",
subset.row = NULL,
R = 200,
nbins = 100,
BPPARAM = SerialParam()
)
sce |
|
genes |
|
expr_values |
Integer scalar or string indicating which assay of
|
subset.row |
Sample random genes only from these. If |
R |
Integer scalar giving the number of random gene sets to sample for normalization. |
nbins |
Integer scalar, specifying the number of bins to group the
average expression levels into before sampling (passed to
|
BPPARAM |
An optional |
A numeric
vector with normalized gene set scores for each
cell in sce
.
Michael Stadler
if (require(SingleCellExperiment)) {
# get sce
example(SingleCellExperiment, echo=FALSE)
rownames(sce) <- paste0("g", seq.int(nrow(sce)))
# calculate gene set expression scores
markers <- c("g1", "g13", "g27")
scores <- normGenesetExpression(sce, markers, R = 50)
# compare expression of marker genes with scores
plotdat <- cbind(scores, t(logcounts(sce)[markers, ]))
cor(plotdat)
pairs(plotdat)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.