runGSEA This is an edited version of the GSEA function (GSEA 1.0), made to run directly in R. It does not provide all of the output that the GSEA algorithm provides, and there aren't any plots generated, but it will return p values and enrichment scores.

runGSEA(eset, labs, contrast, geneSets, weighted.score.type = 1,
  reshuffling.type = "sample.labels", minSetSize = 15, maxSetSize = 1000,
  nperm = 1000, returnRunningScores = F, ...)



the expression matrix to run GSEA on, with rows of genes & columns of samples.


a vector of labels describing the groups in the data.


a single character string describing the contrast to make, where the groups being compared correspond to the labels in labs. This is very similar to the contrasts used in LIMMA, but because GSEA is much simpler, it only accepts direct comparisons, of the form "A-B".


a named list of gene sets to be run in GSEA, or a character vector describing a single gene set. The names of these genes must correspond to the row names of eset.


Enrichment correlation-based weighting: 0=no weight (KS), 1=standard weigth, 2 = over-weigth (default: 1)


Type of permutation reshuffling: "sample.labels" or "gene.labels" (default: "sample.labels")


- Minimum number of genes in a gene set. Gene sets below this threshold will be trimmed.


- Maximum number of genes in a gene set. Gene sets above this threshold will be trimmed.


The number of permutations to perform in order to calculate the p-values. Default is 1000


if TRUE, return the matrix of the running enrichment scores for each gene set. These can be used to create the enrichment score plots from the original GSEA.


other arguments passed to GSEA.GeneRanking


The function returns a list with the enrichment scores (ES), normalized enrichment scores (NES), p-values (p.val), familywise error rate (FWER), false discovery rate (FDR), trimmed gene sets (trimmed.geneSets), and (optionally depending on value of returnRunningScores) the running scores (RunningScores).