[BioC] GO.db: how to get GO Term

Marc Carlson mcarlson at fhcrc.org
Tue Jun 23 02:46:36 CEST 2009


Hi Gordon,

One thing you can do to make this more efficient is to use mget instead
of as.list().  That way you won't be pulling the whole mapping out of
the database into a list just to get one thing back out.

mget("GO:0000166",GOTERM,ifnotfound=NA)

Also, with mget() you can pass in multiple accessions into the 1st
argument and it will just hand you a longer list back.

mget(c("GO:0000066","GO:0000166"),GOTERM,ifnotfound=NA)


Is this what you were looking for?


  Marc



Gordon K Smyth wrote:
> What is the recommended way to find the GO term that corresponds to a
> given GO accession number?  I can do this:
>
>   > library(GO.db)
>   > Term(as.list(GOTERM["GO:0000166"])[[1]])
>   [1] "nucleotide binding"
>
> But this seems a bit inelegant, using as.list() and list subsetting as
> an intermediaries both inside and outside of S4 generic functions. 
> And it needs more work to generalise to multiple accession numbers. 
> Is there something more direct?
>
> Thanks a lot
> Gordon
>
> -----------------------------------------------
> Associate Professor Gordon K Smyth,
> NHMRC Senior Research Fellow,
> Bioinformatics Division, Walter and Eliza Hall Institute of Medical
> Research, 1G Royal Parade, Parkville, Vic 3052, Australia.
> smyth at wehi.edu.au
> http://www.wehi.edu.au/bioinformatics
> http://www.statsci.org/smyth
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> 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