vamForSeurat {VAM} | R Documentation |
VAM wrapper for scRNA-seq data processed using the Seurat framework
Description
Executes the Variance-adjusted Mahalanobis (VAM) method (vamForCollection
) on
normalized scRNA-seq data stored in a Seurat object.
If the Seurat NormalizeData
method was used for normalization, the technical variance of each gene is computed as
the proportion of technical variance (from FindVariableFeatures
) multiplied by the variance of the normalized counts.
If SCTransform
was used for normalization, the technical variance for each gene is set
to 1 (the normalized counts output by SCTransform
should have variance 1 if there is only technical variation).
Usage
vamForSeurat(seurat.data, gene.weights, gene.set.collection,
center=FALSE, gamma=TRUE, sample.cov=FALSE, return.dist=FALSE)
Arguments
seurat.data |
The Seurat object that holds the scRNA-seq data. Assumes normalization has already been performed. |
gene.weights |
See description in |
gene.set.collection |
List of m gene sets for which scores are computed.
Each element in the list corresponds to a gene set and the list element is a vector
of indices for the genes in the set. The index value is defined relative to the
order of genes in the relevant |
center |
See description in |
gamma |
See description in |
sample.cov |
If true, will use the a diagonal covariance matrix generated from the
sample variances to compute the squared adjusted Mahalanobis distances (this is equivalent to not specifying
|
return.dist |
If true, will return the squared adjusted Mahalanobis distances in a new Assay object called "VAM.dist". Default is F. |
Value
Updated Seurat object that hold the VAM results in one or two new Assay objects:
If
return.dist
is true, the matrix of squared adjusted Mahalanobis distances will be stored in new Assay object called "VAM.dist".The matrix of CDF values (1 minus the one-sided p-values) will be stored in new Assay object called "VAM.cdf".
See Also
Examples
# Only run example code if Seurat package is available
if (requireNamespace("Seurat", quietly=TRUE) & requireNamespace("SeuratObject", quietly=TRUE)) {
# Define a collection with one gene set for the first 10 genes
collection=list(set1=1:10)
# Execute on the pbmc_small scRNA-seq data set included with SeuratObject
# See vignettes for more detailed Seurat examples
vamForSeurat(seurat.data=SeuratObject::pbmc_small,
gene.set.collection=collection)
}