[BioC] Extract genes for a GO term in GOstat

Chao-Jen Wong cwon2 at fhcrc.org
Thu Jun 3 19:17:01 CEST 2010


Hi, Rohit,

I wrote a short script to extract the gene associated with the
over-represented GO terms. Hope this would help. Let me know if it
doesn't work.

your code is:
> params <- new("GOHyperGParams", geneIds=entrez.ids,
> annotation=c("hgu133plus2"), ontology="BP", pvalueCutoff=0.05,
> conditional=FALSE, testDirection="over")
> resultBP<-hyperGTest(params)
>
> please help to find out the genes associated with the go terms
>
> Rohit
>   
You can do the following:

p <- params
origGeneIds <- geneIds(p)
selected <- intersect(geneIds(p), universeGeneIds(p))
cat2Entrez <- categoryToEntrezBuilder(p)
## get the gene (Entrez ID) in the category
geneInCat <- lapply(as.list(summary(resultBP)[,1]),
                    function(goid) {
                      selected[selected %in% cat2Entrez[[goid]]]
                    } )

## if you want to convert the Entrez ID to manufacture id
x=revmap(as.list(hgu133plus2ENTREZID))
geneInCatName <- lapply(geneInCat, function(geneid) {
                        unlist(lapply(as.list(geneid), function(id)
                            sel[sel %in% x[[id]] ] ))
                        })
  names(geneInCatName) <- summary(hgOver$result)[,1]
  ## return
geneInCatName


-- 
Chao-Jen Wong
Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Avenue N., M1-B514
PO Box 19024
Seattle, WA 98109
206.667.4485
cwon2 at fhcrc.org



More information about the Bioconductor mailing list