doGse | R Documentation |
Perform gene-set enrichment (GSE) analysis
doGse(edgeResult, gmtList, doParallel = FALSE)
edgeResult |
An object of the class |
gmtList |
An object of the class |
doParallel |
Logical, whether The function performs gene-set enrichment analysis. By default,the CAMERA method is applied. In case this is not successful, for instance because of lack of biological replicates, the GAGE method (Generally Applicable Gene-set Enrichment for pathway analysis) is applied. |
A data.frame
containing results of the gene-set enrichment analysis.
gseWithLogFCgage
and gseWithCamera
are wrapped by
this function to perform analysis with GAGE and CAMERA, respectively.
logFCgage
, camera.EdgeResult
, and camera.LimmaVoomResult
implement the logic, and
return the enrichment table.
exMat <- matrix(rpois(120, 10), nrow=20, ncol=6)
exGroups <- gl(2,3, labels=c("Group1", "Group2"))
exDesign <- model.matrix(~0+exGroups)
exContrast <- matrix(c(-1,1), ncol=1, dimnames=list(c("Group1", "Group2"), c("Group2.vs.Group1")))
exDescon <- DesignContrast(exDesign, exContrast, groups=exGroups)
exFdata <- data.frame(GeneSymbol=sprintf("Gene%d", 1:nrow(exMat)))
exPdata <- data.frame(Name=sprintf("Sample%d", 1:ncol(exMat)),
Group=exGroups)
exObj <- EdgeObject(exMat, exDescon,
fData=exFdata, pData=exPdata)
exDgeRes <- ribiosNGS::dgeWithEdgeR(exObj)
exGeneSets <- BioQC::GmtList(list(
list(name="Set1", desc="set 1", genes=c("Gene1", "Gene2", "Gene3"), namespace="default"),
list(name="Set2", desc="set 2", genes=c("Gene18", "Gene6", "Gene4"), namespace="default")
))
exGse <- doGse(exDgeRes, exGeneSets)
## Not run:
exMat <- matrix(rpois(120000, 10), nrow=20000, ncol=12)
exGroups <- gl(4,3, labels=c("Group1", "Group2", "Group3", "Group4"))
exDesign <- model.matrix(~0+exGroups)
exContrast <- matrix(c(-1,1,0,0, 0,0,-1,1),
ncol=2, byrow=FALSE,
dimnames=list(c("Group1", "Group2", "Group3", "Group4"),
c("Group2.vs.Group1", "Group4.vs.Group3")))
exDescon <- DesignContrast(exDesign, exContrast, groups=exGroups)
exFdata <- data.frame(GeneSymbol=sprintf("Gene%d", 1:nrow(exMat)))
exPdata <- data.frame(Name=sprintf("Sample%d", 1:ncol(exMat)),
Group=exGroups)
exObj <- EdgeObject(exMat, exDescon,
fData=exFdata, pData=exPdata)
exDgeRes <- ribiosNGS::dgeWithEdgeR(exObj)
ngeneset <- 1000
genesetSizes <- round(runif(ngeneset)*100)+1
exGeneSets <- BioQC::GmtList(lapply(seq(1:ngeneset), function(i) {
name <- paste0("GeneSet", i)
desc <- paste0("GeneSet", i)
genes <- sample(exFdata$GeneSymbol, genesetSizes[i])
res <- list(name=name, desc=desc, genes=genes, namespace="default")
}))
exGse <- doGse(exDgeRes, exGeneSets)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.