[BioC] How to retrieve all GO terms at level 5 as well as their annotated genes

Hervé Pagès hpages at fhcrc.org
Tue Jun 25 03:19:46 CEST 2013


Hi Peter,

Probably not the most elegant way, but you could do something like this
(granted that I understand correctly what a "level 5" term is):

   library(GO.db)

   getAllBPChildren <- function(goids)
   {
     ans <- unique(unlist(mget(goids, GOBPCHILDREN), use.names=FALSE))
     ans <- ans[!is.na(ans)]
   }

   level1_BP_terms <- getAllBPChildren("GO:0008150")     # 23 terms
   level2_BP_terms <- getAllBPChildren(level1_BP_terms)  # 256 terms
   level3_BP_terms <- getAllBPChildren(level2_BP_terms)  # 3059 terms
   level4_BP_terms <- getAllBPChildren(level3_BP_terms)  # 9135 terms
   level5_BP_terms <- getAllBPChildren(level4_BP_terms)  # 15023 terms

   library(org.Hs.eg.db)
   level5_genes <- mget(intersect(level5_BP_terms, keys(org.Hs.egGO2EG)),
                        org.Hs.egGO2EG)

Cheers,
H.

On 06/21/2013 02:28 AM, Peter Davidsen wrote:
> Dear list,
>
> I'm looking for a way to get the names of all Gene Ontology terms for
> Biological Processes at level 5 as well as the genes (human gene
> symbols) annotated to each of the level 5 GO terms.
>
> I have tried to query the DAVID knowledgebase, but the online tool
> doesn't seem to respond to any requests. Hence, could anybody maybe
> point me in the direction of a package that could provide me with the
> same information?
>
> Kind regards,
> Peter
>
> _______________________________________________
> 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
>

-- 
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages at fhcrc.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319



More information about the Bioconductor mailing list