Generate pathway score using gene set enrichement analysis
Source:R/run_scfeatures.R
run_pathway_gsva.RdThis function calculates pathway scores for a given input dataset and gene set using gene set enrichment analysis (GSVA). It supports scRNA-seq, spatial proteomics and spatial transcriptomics. It currently supports two pathway analysis methods: ssgsea and aucell. By default, it uses the 50 hallmark gene sets from msigdb. Alternatively, users can provide their own gene sets of interest in a list format.
Usage
run_pathway_gsva(
data,
method = "aucell",
geneset = NULL,
species = "Homo sapiens",
type = "scrna",
subsample = TRUE,
ncores = 1
)Arguments
- data
A list object containing
datamatrix andcelltypeandsamplevector.- method
Type of pathway analysis method, currently support
ssgseaandaucell, default toaucell- geneset
By default (when the
genesetargument is not specified), we use the 50 hallmark gene set from msigdb. The users can also provide their geneset of interest in a list format, with each list entry containing a vector of the names of genes in a gene set. eg, geneset <- list("pathway_a" = c("CAPN1", ...), "pathway_b" = c("PEX6"))- species
Whether the species is "Homo sapiens" or "Mus musculus". Default is "Homo sapiens".
- type
The type of dataset, either "scrna", "spatial_t", or "spatial_p".
- subsample
Whether to subsample, either TRUE or FALSE. For larger datasets (eg, over 30,000 cells), the subsample function can be used to increase speed.
- ncores
Number of cores for parallel processing.
Value
a dataframe of samples x features The features are in the form of pathway 1 celltype a, pathway 2 celltype b ... etc, with the number representing the gene set enrichment score of a given pathway in cells from a given celltype.
Examples
utils::data("example_scrnaseq" , package = "scFeatures")
data <- example_scrnaseq[, 1:20]
celltype <- data$celltype
sample <- data$sample
data <- data@assays$RNA@data
alldata <- scFeatures:::formatData(data = data, celltype = celltype, sample = sample )
feature_pathway_gsva <- run_pathway_gsva(
alldata,
geneset = NULL, species = "Homo sapiens",
type = "scrna", subsample = FALSE, ncores = 1
)
#> Warning: nCores is no longer used. It will be deprecated in the next AUCell version.
#> Warning: Using only the first 176.15 genes (aucMaxRank) to calculate the AUC.
#> Warning: The following gene sets will be excluded from the analysis(less than 20% of their genes are available):
#> HALLMARK_ANGIOGENESIS, HALLMARK_APICAL_JUNCTION, HALLMARK_APICAL_SURFACE, HALLMARK_BILE_ACID_METABOLISM, HALLMARK_COAGULATION, HALLMARK_EPITHELIAL_MESENCHYMAL_TRANSITION, HALLMARK_ESTROGEN_RESPONSE_EARLY, HALLMARK_ESTROGEN_RESPONSE_LATE, HALLMARK_GLYCOLYSIS, HALLMARK_HEDGEHOG_SIGNALING, HALLMARK_KRAS_SIGNALING_DN, HALLMARK_KRAS_SIGNALING_UP, HALLMARK_MYOGENESIS, HALLMARK_NOTCH_SIGNALING, HALLMARK_PANCREAS_BETA_CELLS, HALLMARK_SPERMATOGENESIS, HALLMARK_UV_RESPONSE_DN, HALLMARK_WNT_BETA_CATENIN_SIGNALING, HALLMARK_XENOBIOTIC_METABOLISM