Wrapper for the Variance-adjusted Mahalanobis (VAM), which is a fast and accurate method for cell-specific gene set scoring of single cell data. This algorithm computes distance statistics and one-sided p-values for all cells in the specified single cell gene expression matrix. Gene sets should already be imported and stored in the meta data using functions such as importGeneSetsFromList or importGeneSetsFromMSigDB
runVAM(
inSCE,
geneSetCollectionName,
useAssay,
resultNamePrefix = NULL,
center = FALSE,
gamma = TRUE
)
Input SingleCellExperiment object.
Character. The name of the gene set collection to use.
Character. The name of the assay to use. This assay should contain log normalized counts.
Character. Prefix to the name the VAM results which
will be stored in the reducedDim slot of inSCE
. The names of the
output matrices will be resultNamePrefix_Distance
and
resultNamePrefix_CDF
. If this parameter is set to NULL
, then
"VAM_geneSetCollectionName_"
will be used. Default NULL
.
Boolean. If TRUE
, values will be mean centered when
computing the Mahalanobis statistic. Default FALSE
.
Boolean. If TRUE
, a gamma distribution will be fit to
the non-zero squared Mahalanobis distances computed from a row-permuted
version of the gene expression matrix. The estimated gamma distribution will
be used to compute a one-sided p-value for each cell. If FALSE
, the
p-value will be computed using the standard chi-square approximation for the
squared Mahalanobis distance (or non-central if center = FALSE
).
Default TRUE
.
A SingleCellExperiment object with VAM metrics stored
in reducedDim
as VAM_NameOfTheGeneset_Distance
and
VAM_NameOfTheGeneset_CDF
.
importGeneSetsFromList, importGeneSetsFromMSigDB,
importGeneSetsFromGMT, importGeneSetsFromCollection for
importing gene sets. sctkListGeneSetCollections,
getPathwayResultNames and getGenesetNamesFromCollection for
available related information in inSCE
.
data(scExample, package = "singleCellTK")
sce <- subsetSCECols(sce, colData = "type != 'EmptyDroplet'")
sce <- scaterlogNormCounts(sce, assayName = "logcounts")
gs1 <- rownames(sce)[seq(10)]
gs2 <- rownames(sce)[seq(11,20)]
gs <- list("geneset1" = gs1, "geneset2" = gs2)
sce <- importGeneSetsFromList(inSCE = sce,geneSetList = gs,
by = "rownames")
sce <- runVAM(inSCE = sce,
geneSetCollectionName = "GeneSetCollection",
useAssay = "logcounts")
#> Sat Mar 18 10:31:40 2023 ... Running VAM
#> gene.weights not specified, defaulting all weights to 1
#> Computing VAM distances for 2 gene sets, 195 cells and 200 genes.
#> Min set size: 10, median size: 10