gsva {GSVA} | R Documentation

## Gene Set Variation Analysis

### Description

Estimates GSVA enrichment scores.

### Usage

    ## S4 method for signature 'ExpressionSet,list'
    gsva(expr, gset.idx.list, annotation,
        method=c("gsva", "ssgsea", "zscore", "plage"),
        kcdf=c("Gaussian", "Poisson", "none"),
        abs.ranking=FALSE,
        min.sz=1,
        max.sz=Inf,
        parallel.sz=0,
        parallel.type="SOCK",
        mx.diff=TRUE,
        tau=switch(method, gsva=1, ssgsea=0.25, NA),
        ssgsea.norm=TRUE,
        verbose=TRUE)
    ## S4 method for signature 'ExpressionSet,GeneSetCollection'
    gsva(expr, gset.idx.list, annotation,
        method=c("gsva", "ssgsea", "zscore", "plage"),
        kcdf=c("Gaussian", "Poisson", "none"),
        abs.ranking=FALSE,
        min.sz=1,
        max.sz=Inf,
        parallel.sz=0,
        parallel.type="SOCK",
        mx.diff=TRUE,
        tau=switch(method, gsva=1, ssgsea=0.25, NA),
        ssgsea.norm=TRUE,
        verbose=TRUE)
    ## S4 method for signature 'matrix,GeneSetCollection'
    gsva(expr, gset.idx.list, annotation,
        method=c("gsva", "ssgsea", "zscore", "plage"),
        kcdf=c("Gaussian", "Poisson", "none"),
        abs.ranking=FALSE,
        min.sz=1,
        max.sz=Inf,
        parallel.sz=0,
        parallel.type="SOCK",
        mx.diff=TRUE,
        tau=switch(method, gsva=1, ssgsea=0.25, NA),
        ssgsea.norm=TRUE,
        verbose=TRUE)
    ## S4 method for signature 'matrix,list'
    gsva(expr, gset.idx.list, annotation,
        method=c("gsva", "ssgsea", "zscore", "plage"),
        kcdf=c("Gaussian", "Poisson", "none"),
        abs.ranking=FALSE,
        min.sz=1,
        max.sz=Inf,
        parallel.sz=0,
        parallel.type="SOCK",
        mx.diff=TRUE,
        tau=switch(method, gsva=1, ssgsea=0.25, NA),
        ssgsea.norm=TRUE,
        verbose=TRUE)

### Arguments

`expr` | Gene expression data which can be given either as an `ExpressionSet` object or as a matrix of expression values where rows correspond to genes and columns correspond to samples.
`gset.idx.list` | Gene sets provided either as a `list` object or as a `GeneSetCollection` object.
`annotation` | In the case of calling `gsva()` with expression data in a `matrix` and gene sets as a `GeneSetCollection` object, the `annotation` argument can be used to supply the name of the Bioconductor package that contains annotations for the class of gene identifiers occurring in the row names of the expression data matrix. By default `gsva()` will try to match the identifiers in `expr` to the identifiers in `gset.idx.list` just as they are, unless the `annotation` argument is set.
`method` | Method to employ in the estimation of gene-set enrichment scores per sample. By default this is set to `gsva` (Hänzelmann et al, 2013) and other options are `ssgsea` (Barbie et al, 2009), `zscore` (Lee et al, 2008) or `plage` (Tomfohr et al, 2005). The latter two standardize first expression profiles into z-scores over the samples and, in the case of `zscore`, it combines them together as their sum divided by the square-root of the size of the gene set, while in the case of `plage` they are used to calculate the singular value decomposition (SVD) over the genes in the gene set and use the coefficients of the first right-singular vector as pathway activity profile.
`kcdf` | Character string denoting the kernel to use during the non-parametric estimation of the cumulative distribution function of expression levels across samples when `method="gsva"`. By default, `kcdf="Gaussian"` which is suitable when input expression values are continuous, such as microarray fluorescent units in logarithmic scale, RNA-seq log-CPMs, log-RPKMs or log-TPMs. When input expression values are integer counts, such as those derived from RNA-seq experiments, then this argument should be set to `kcdf="Poisson"`.
`abs.ranking` | Flag used only when `mx.diff=TRUE`. When `abs.ranking=FALSE` (default) a modified Kuiper statistic is used to calculate enrichment scores, taking the magnitude difference between the largest positive and negative random walk deviations. When `abs.ranking=TRUE` the original Kuiper statistic that sums the largest positive and negative random walk deviations, is used. In this latter case, gene sets with genes enriched on either extreme (high or low) will be regarded as 'highly' activated.
`min.sz` | Minimum size of the resulting gene sets.
`max.sz` | Maximum size of the resulting gene sets.
`parallel.sz` | Number of processors to use when doing the calculations in parallel. This requires to previously load either the `parallel` or the `snow` library. If `parallel` is loaded and this argument is left with its default value (`parallel.sz=0`) then it will use all available core processors unless we set this argument with a smaller number. If `snow` is loaded then we must set this argument to a positive integer number that specifies the number of processors to employ in the parallel calculation.
`parallel.type` | Type of cluster architecture when using `snow`.
`mx.diff` | Offers two approaches to calculate the enrichment statistic (ES) from the KS random walk statistic. `mx.diff=FALSE`: ES is calculated as the maximum distance of the random walk from 0. `mx.diff=TRUE` (default): ES is calculated as the magnitude difference between the largest positive and negative random walk deviations.
`tau` | Exponent defining the weight of the tail in the random walk performed by both the `gsva` (Hänzelmann et al., 2013) and the `ssgsea` (Barbie et al., 2009) methods. By default, this `tau=1` when `method="gsva"` and `tau=0.25` when `method="ssgsea"` just as specified by Barbie et al. (2009) where this parameter is called `alpha`.
`ssgsea.norm` | Logical, set to `TRUE` (default) with `method="ssgsea"` runs the SSGSEA method from Barbie et al. (2009) normalizing the scores by the absolute difference between the minimum and the maximum, as described in their paper. When `ssgsea.norm=FALSE` this last normalization step is skipped.
`verbose` | Gives information about each calculation step. Default: `FALSE`.

### Details

GSVA assesses the relative enrichment of gene sets across samples using a non-parametric approach. Conceptually, GSVA transforms a p-gene by n-sample gene expression matrix into a g-geneset by n-sample pathway enrichment matrix. This facilitates many forms of statistical analysis in the 'space' of pathways rather than genes, providing a higher level of interpretability.

The `gsva()` function first maps the identifiers in the gene sets to the identifiers in the input expression data leading to a filtered collection of gene sets. This collection can be further filtered to require a minimun and/or maximum size of the gene sets for which we want to calculate GSVA enrichment scores, by using the arguments `min.sz` and `max.sz`.

### Value

A gene-set by sample matrix of GSVA enrichment scores.

### Author(s)

J. Guinney and R. Castelo

### References

Barbie, D.A. et al. Systematic RNA interference reveals that oncogenic KRAS-driven cancers require TBK1. Nature, 462(5):108-112, 2009.

Hänzelmann, S., Castelo, R. and Guinney, J. GSVA: Gene set variation analysis for microarray and RNA-Seq data. BMC Bioinformatics, 14:7, 2013.

Lee, E. et al. Inferring pathway activity toward precise disease classification. PLoS Comp Biol, 4(11):e1000217, 2008.

Tomfohr, J. et al. Pathway level analysis of gene expression using singular value decomposition. BMC Bioinformatics, 6:225, 2005.

### See Also

`filterGeneSets` `computeGeneSetsOverlap`

### Examples

    library(limma)

    p <- 10 ## number of genes
    n <- 30 ## number of samples
    nGrp1 <- 15 ## number of samples in group 1
    nGrp2 <- n - nGrp1 ## number of samples in group 2

    ## consider three disjoint gene sets
    geneSets <- list(set1=paste("g", 1:3, sep=""),
                     set2=paste("g", 4:6, sep=""),
                     set3=paste("g", 7:10, sep=""))

    ## sample data from a normal distribution with mean 0 and st.dev. 1
    y <- matrix(rnorm(n*p), nrow=p, ncol=n,
                dimnames=list(paste("g", 1:p, sep="") , paste("s", 1:n, sep="")))

    ## genes in set1 are expressed at higher levels in the last 'nGrp1+1' to 'n' samples
    y[geneSets$set1, (nGrp1+1):n] <- y[geneSets$set1, (nGrp1+1):n] + 2

    ## build design matrix
    design <- cbind(sampleGroup1=1, sampleGroup2vs1=c(rep(0, nGrp1), rep(1, nGrp2)))

    ## fit linear model
    fit <- lmFit(y, design)

    ## estimate moderated t-statistics
    fit <- eBayes(fit)

    ## genes in set1 are differentially expressed
    topTable(fit, coef="sampleGroup2vs1")

    ## estimate GSVA enrichment scores for the three sets
    gsva_es <- gsva(y, geneSets, mx.diff=1)

    ## fit the same linear model now to the GSVA enrichment scores
    fit <- lmFit(gsva_es, design)

    ## estimate moderated t-statistics
    fit <- eBayes(fit)

    ## set1 is differentially expressed
    topTable(fit, coef="sampleGroup2vs1")

[Package GSVA version 1.34.0 Index]