License: Artistic-2.0
This is a list of some frequently asked questions (FAQ) on the GSVA package, with answers and links to the relevant documentation and resources. If you have any other question that you would like to see included in this FAQ, please open an issue in the GSVA GitHub repo. Aside from this FAQ and opening a GitHub issue, you can also get help on the GSVA package by:
Using the help system in R, e.g. ?gsva or
help(gsva), and reading the package vignettes, which can be
accessed from your own software installation with
browseVignettes("GSVA"), or through the Bioconductor
landing page for the GSVA package at https://bioconductor.org/packages/GSVA.
Posting your question on the Bioconductor support site, after reading the Bioconductor posting guide.
If you use the GSVA package in your research, please cite the GSVA publication (Hänzelmann et al. 2013). Additionally, if you use any of the following methods implemented in the GSVA package, please cite the corresponding publications:
ssGSEA (Barbie et al. 2009).
Z-score (Lee et al. 2008).
PLAGE (Tomfohr et al. 2005).
If you encounter the error:
This is because the GSVA package is not installed. You can install it with:
If you encounter the error:
This is because the GSVA package is not loaded. You can load it with:
If you encounter one of the following two errors, the first one given by some versions of GSVA:
Error in gsva(): Calling gsva(expr=., gset.idx.list=., method=., ...) is defunct
[... or ...]
Error: unable to find an inherited method for function ‘gsva’ for signature ‘param = "matrix"’where the last part could also be
param = "SummarizedExperiment",
param = "SingleCellExperiment",
param = "SpatialExperiment", etc., this is because you are
providing a wrong first argument in the call to gsva(). In
versions < 1.50 (up to October 2023, Bioconductor release 3.17), this
first argument was the object containing the input expression data.
However, starting with version 1.50 (October 2023, Bioconductor release
3.18), the first argument should be an object of class
GsvaMethodParam built with a constructor function according
to the method you want to use, i.e., gsvaParam(),
ssgseaParam(), zscoreParam(),
plageParam() or avgParam(), as in:
See the first GSVA package vignette for more details and examples.
If you encounter the error:
It means that none of the identifiers in your gene sets could be
matched to the identifiers in your expression data. This is usually
because the identifiers in your gene sets are of a different type than
the identifiers in your expression data, and both input expression and
gene sets lack the necessary metadata to map one type onto the other.
For example, your gene sets may contain gene symbols, while your
expression data may contain Ensembl gene IDs. Other common causes are
Ensembl identifiers with a version suffix (e.g.,
ENSG00000141510.17 instead of
ENSG00000141510), and gene sets of one organism used with
data from another one (e.g., human symbols such as TP53
with mouse data, where the symbol is Trp53).
The simplest way to provide the missing metadata on the expression
data is the annotation argument of the parameter
constructor function, e.g.:
where xxxxIdentifier is the appropriate function for the
type of identifiers in your expression data, e.g.,
ENSEMBLIdentifier(), EntrezIdentifier(), etc.
Note that you should load the package GSEABase to use
these functions, and you may obtain help about them by typing
help(GeneIdentifierType). Here also
org.Xx.eg.db is the appropriate organism-level annotation
package for your expression data, e.g., org.Hs.eg.db for
human, org.Mm.eg.db for mouse, etc. Please check the Bioconductor
annotation packages for the available organism-level annotation
packages. You can check whether this metadata is present in your input
expression data with gsvaAnnotation(expr), which returns
NULL when it is missing, and you can also add it to the
expression data with the following instruction:
Gene sets read with readGMT() already have this
metadata, which is guessed from their identifiers. When
gsets is a list object,
gsvaAnnotation(gsets) returns NULL, and you
can add the metadata in the same way as for the input expression
data.
Our recommendation is to pre-process the input expression data in the same way as you would do for a differential expression analysis, i.e., removing lowly expressed genes and normalizing the columns of expression data to reduce technical biases, such as differences in sequencing depth and RNA composition. GSVA does not read normalization factors or offsets produced by some normalization pipelines and associated with raw integer counts, so it is necessary to use those factors or offsets to transform the input raw integer counts into normalized continuous units of expression, such as log2 CPM, or log2 TPM.
Yes, for the GSVA, Z-score and PLAGE methods, which normalize or
decompose the expression of each gene across all the columns of the
input data. ssGSEA scores depend on the other columns only through
normalize=TRUE, the default, which divides the scores by
their range over the whole input data. Therefore, adding or removing
columns may change that normalizing range, which in turn may change the
resulting ssGSEA scores. If you do not want ssGSEA scores to be affected
by other columns use ssgseaParam(..., normalize=FALSE).
Note that this does not imply that ssGSEA scores from disparate columns
or datasets are directly comparable.
Gene sets are first mapped to the rows of the input expression data,
and those genes in gene sets that are absent from the expression data,
are removed from each gene set. Then, gene sets with fewer than
minSize or more than maxSize genes are
discarded. The gene sets actually used can be obtained by calling
geneSets() on the parameter object or on the output of
gsva().
The GSVA package includes regression tests that are routinely run in the Bioconductor build system to detect unintended changes in the scores with respect to previous versions of the package, caused by, e.g., bugs or new features. So, in principle, given the same input, scores should not differ with respect to previous versions of the package. However, this can still happen in the following cases:
rowNorm of gsvaParam(). Please consult
help(gsvaParam) and the vignette on using GSVA with
single-cell data.GSVA first normalizes the expression of each gene across the columns of the input data, so that each value reflects how high is the expression of that gene in that column, relative to the other columns. A positive GSVA score for a given gene set in a given column means that the genes of that gene set tend to be more highly expressed in that column, relative to the other columns, than the genes outside the gene set. A negative score means the opposite, and a score close to zero means that the genes of the gene set show no such tendency.
Because of how GSVA scores are derived, the magnitude of a fold change or difference in means between two groups of columns for a given gene set is difficult to interpret, but you can interpret the direction (over-expression or under-expression of that gene set or pathway). GSVA does not provide p-values on any hypothesis test about the magnitude of the score, but you can test with linear models whether a coefficient derived from GSVA scores is significantly different from zero; see the subsection on differential expression at pathway level of the first GSVA vignette and the GSVA publication (Hänzelmann et al. 2013) for further details.
A GSVA score for a given gene set in a given column is negative when
the genes in that gene set are, relative to the other columns, less
expressed in that column than the genes outside that gene set. The
function gsvaEnrichment() produces an enrichment plot that
helps to understand how a GSVA score was calculated. Please also consult
the GSVA publication (Hänzelmann et al.
2013) for more details on how the GSVA scores are calculated.
The implementation of ssGSEA in the GSVA package is based on the
original publication by Barbie et al. (Barbie et
al. 2009), and in principle the resulting enrichment scores
should be nearly identical to the scores obtained with the first
implementation by the authors of that publication, at the Broad
Institute, available at https://github.com/GSEA-MSigDB/ssGSEA-gpmodule, and as
the ssGSEAProjection module in the GenePattern
software, provided that parameters such as the weight exponent
(alpha) and the normalization of the scores
(normalize) match. There have been subsequent versions of
the ssGSEA algorithm by the Broad Institute, ssGSEA 2.0 and ssGSEA 3.0, which
are not implemented in the GSVA package.
Yes, as long as it is stored on disk, e.g., in an HDF5 file, and
given to GSVA as a DelayedArray object, such as an
HDF5Array object. If the dataset is sparse, such as those
produced by single-cell and spatially resolved transcriptomics,
substantial performance gains can be obtained when the file only stores
nonzero values as a compressed sparse column (CSC) matrix (e.g., 10x
Genomics HDF5). With default parameters, GSVA will use 90% of the
main memory of the computer or, if smaller, of the memory limit of the
job in a computer cluster. Memory consumption can be controlled with the
parameter maxmem in the calls to gsva(),
gsvaRowNorm(), gsvaColRanks() and
gsvaColScores(),and whether the calculations are performed
on disk with the parameter ondisk in the calls to
gsvaParam(), ssgseaParam(),
zscoreParam(), plageParam() and
avgParam(). Please consult the help pages of those
functions for more details on those parameters.
Yes, using the BPPARAM parameter in the calls to
gsva(), gsvaRowNorm(),
gsvaColRanks() and gsvaColScores(), e.g.,
gsva(param, BPPARAM=MulticoreParam(workers=4)); please
consult the details on that parameter in the manual pages of those
functions.
Yes, using the functions gsvaMap() and
gsvaReduce(); please consult the package vignette entitled
Using
GSVA on GPUs, HPC clusters and the cloud.
You can convert a Seurat object into a
SingleCellExperiment object with the function
as.SingleCellExperiment() from the CRAN package Seurat, and then
use that object as input to the gsva() function.
You can read an AnnData .h5ad file into a
SingleCellExperiment object with the function
readH5AD() from the Bioconductor package zellkonverter,
or with the function read_h5ad() from the Bioconductor
package anndataR, and then
use that object as input to the *Param() parameter
constructor functions. Please consult the documentation of those
packages for more details on how to use them.