[R] Get part of a GO term

Martin Morgan mtmorgan at fhcrc.org
Tue Apr 10 19:43:30 CEST 2012


On 04/10/2012 09:11 AM, stella wrote:
> Hi,
>
> Sorry, I am bad with regular expression and a beginner with R. How do I get
> only the numbers 0009987 from the following entry?
>
> GO:0009987~cellular process

sub(".*:(.*)~.*", "\\1", "GO:009987~cellular process")

but you might also be interested in

   source("http://bioconductor.org/biocLite.R")
   biocLite("GO.db")

(once only) followed by

 > library(GO.db)
 > GOTERM[["GO:0009987"]]
GOID: GO:0009987
Term: cellular process
Ontology: BP
Definition: Any process that is carried out at the cellular level, but
     not necessarily restricted to a single cell. For example, cell
     communication occurs among more than one cell, but occurs at the
     cellular level.
Synonym: cell growth and/or maintenance
Synonym: cell physiology
Synonym: cellular physiological process
Synonym: GO:0008151
Synonym: GO:0050875
Secondary: GO:0008151
Secondary: GO:0050875
 > GOBPOFFSPRING[["GO:0009987"]]
  [1] "GO:0000001" "GO:0000002" "GO:0042254" "GO:0006467" "GO:0000011"
  [6] "GO:0000012" "GO:0000018" "GO:0000019" "GO:0045950" "GO:0000022"
[11] "GO:0000023" "GO:0000024" "GO:0000025" "GO:0000027" "GO:0000028"
...
 > Term(GOTERM[["GO:0009987"]])
[1] "cellular process"

And so on; see

http://bioconductor.org/packages/release/data/annotation/html/GO.db.html
http://bioconductor.org/packages/2.10/data/annotation/
http://bioconductor.org/packages/release/bioc/html/AnnotationDbi.html
http://bioconductor.org/packages/release/bioc/

Martin

>
> Thanks a lot,
> Stella
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Get-part-of-a-GO-term-tp4546125p4546125.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


-- 
Computational Biology
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109

Location: M1-B861
Telephone: 206 667-2793



More information about the R-help mailing list