npGSEA: Calculates an approximation of the permutation GSEA...

Description Usage Arguments Value Author(s) References Examples

View source: R/npGSEA.R


This function calculates the permutation gene set enrichment analysis test statistic and p-value without actually running the permutation. We account for the covariance among the genes within the set and approximate the corresponding permutation distribution. For more details on the method see Larson and Owen (2014).


  npGSEA(x, y, set, covars = NULL, approx = c("norm", "beta", "chiSq"), w = NULL, epsilonBetaAdj=TRUE, scaleXY=TRUE, uniVarX=TRUE )



A matrix of expression data or an object of type ExpressionSet. The columns of x represent samples in a given experiment. The rows are genes. The names of each row (or featureNames of the eSet) must be of the same type (e.g., entrez ids) as the ids of the gene set.


A vector containing the treatment for each sample. The length of y must be more than 4 for the "chisq" approximation. Each treatment group must have at least two observations for all approximation methods. There can only be two treatment groups.


A vector or matrix containing covariate(s) of interest, optional


A GeneSet object containing a set of genes of interest or a GeneSetCollection object containing a collection of GeneSets


A string of either "norm" (default), "beta" or "chiSq". If "norm", the normal approximation to the non-permutation GSEA is calculated and returned. If "beta", the beta approximation is reported. If "chiSq", the Chi-squared approximation to the permutation GSEA is calculated.


A vector or list containing the weights of each gene in the set or sets, optional. If w is a list, the number of elements in the list must correspond to the number of gene sets in the collection.


A boolean indicating whether or to not to use an epsilon adjusted p-value for the Beta approximation. When TRUE, this prevents observed p-values of 0. The default is TRUE.


A boolean indicating whether or to not to scale x and y. The default is TRUE.


A boolean indicating whether or to not to scale x to have unit variance. The default is TRUE.


An object with the corresponding GSEA results. If approx="norm" an npGSEAResultNorm object is returned. If approx="beta" a npGSEAResultBeta object is returned. If approx="chiSq" a npGSEAResultChiSq object is returned. If set is a GeneSetCollection (i.e., multiple sets of interest), then the corresponding npGSEAResultNormCollection, npGSEAResultBetaCollection, or npGSEAResultChiSqCollection is returned.


Jessica L. Larson and Art Owen


Jessica L Larson and Art B Owen: Moment based gene set tests. BMC Bioinformatics 2015, 16:132.


    yFactor <- as.factor( c(rep("treated", 5), rep("control", 5)) )
    xData <- matrix(data=rnorm(length(letters)*10) ,nrow=length(letters), ncol=10)
    rownames(xData) <- letters
    geneSetABC15 <- GeneSet(geneIds=letters[1:15], setName="setABC15")
    res <- npGSEA(x = xData, y = yFactor, set = geneSetABC15)

Example output

Loading required package: GSEABase
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,, cbind, colMeans, colSums, colnames,,
    duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
    lapply, lengths, mapply, match, mget, order, paste, pmax,,
    pmin,, rank, rbind, rowMeans, rowSums, rownames, sapply,
    setdiff, sort, table, tapply, union, unique, unsplit, which,
    which.max, which.min

Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

Loading required package: annotate
Loading required package: AnnotationDbi
Loading required package: stats4
Loading required package: IRanges
Loading required package: S4Vectors

Attaching package: 'S4Vectors'

The following object is masked from 'package:base':


Loading required package: XML
Loading required package: graph

Attaching package: 'graph'

The following object is masked from 'package:XML':


No methods found in package 'BiocGenerics' for request: 'unlist' when loading 'npGSEA'

npGSEA documentation built on Nov. 8, 2020, 6:49 p.m.