[BioC] extracting topGO gene ids from result object

Valerie Obenchain vobencha at fhcrc.org
Sun Dec 19 23:59:40 CET 2010

Hi Paul,

On 12/17/10 13:41, Paul Rigor wrote:
>   Hello,
> So I'm working on extracting IDs from a topGO result object. I have a
> list of terms ranked by p values (using classic fisher test). However,
> does the result object
> contain indices to the original list of gene ids per go term? The
> documentation was a bit unclear.
> Using the printGenes function and specifying the top ranked GO terms,
> I'd like to only pull the genes from my gene list, not from the entire
> GO annotation table, which seems to be the default behavior for this
> function.
Using the example from the topGO vignette,

     sampleGOdata <- new("topGOdata", description = "Simple session", 
ontology = "BP",
          allGenes = geneList, geneSel = topDiffGenes, nodeSize = 10, 
annot = annFUN.db,
          affyLib = affyLib)

     resultFisher <- runTest(sampleGOdata, algorithm = "classic", 
statistic = "fisher")

Create a map of geneIDs to GO terms,

     ann.genes <- genesInTerm(sampleGOdata)

Select a few GO terms from the Fisher analysis (you could sort these 
first or ...),

      fisher.go <- names(score(resultFisher))[1:5]
      fisher.ann.genes <- genesInTerm(sampleGOdata, whichGO=fisher.go)

The fisher.ann.genes list give you the  gene ID / GO term mapping subset 
on the GO terms from the Fisher analysis. You can also use printGenes on 
this subset of GO terms,

     ft <- printGenes(sampleGOdata, whichTerms=fisher.go, 


> Thanks,
> Paul
> 	[[alternative HTML version deleted]]
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor

More information about the Bioconductor mailing list