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
)

Arguments

inSCE

Input SingleCellExperiment object.

geneSetCollectionName

Character. The name of the gene set collection to use.

useAssay

Character. The name of the assay to use. This assay should contain log normalized counts.

resultNamePrefix

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.

center

Boolean. If TRUE, values will be mean centered when computing the Mahalanobis statistic. Default FALSE.

gamma

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.

Value

A SingleCellExperiment object with VAM metrics stored in reducedDim as VAM_NameOfTheGeneset_Distance and VAM_NameOfTheGeneset_CDF.

Author

Nida Pervaiz

Examples

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