Here is a complete example:
library(topGO)
library(ALL)
data(geneList)
sampleGOdata <- new("topGOdata",
description = "Simple session", ontology = "BP",
allGenes = geneList, geneSel = topDiffGenes,
nodeSize = 10,
annot = annFUN.db, affyLib = affyLib)
resultKS.elim <- runTest(sampleGOdata, algorithm = "elim", statistic = "ks")
png("sampleGOdata.png")
showSigOfNodes(sampleGOdata,
score(resultKS.elim),
firstSigNodes = 5,
useInfo='all')
dev.off()
The functions printGraph
and showSigOfNodes
do the same thing, except that printGraph
automatically makes a PDF or PS file.
I don't have enough rep to write another comment, so I'll have to just edit my answer. If you want better resolution, you might try reading this blog post.
If this was helpful, you I'd appreciate it if you upvote the answer (then maybe I'll be able to write more than 5 comments a day).
In your code, you need to declare the variables 'sampleGOdata', 'resultKS.elim', and 'comparisons'. Also you need to include all import statements (e.g. 'library(topGO)'). You should be able to just paste the code example into an R shell and have it run.
Yes, the code runs and produces a pdf file but how to change it that it produces png rather than pdf file?
Yes, but I can't run the code. No one else can either. The variables 'sampleGOdata', 'resultKS.elim', and 'comparison' are not defined. I had to look up the topGO vignette to find the definitions of 'sampleGOdata' and 'resultKS.elim'. But still I don't know what 'comparisons' is. How is 'comparisons' declared in your code?