This is a test version of Biostars. For the public version, visit https://www.biostars.org.
All Children, Grand Children Of Go Id

Given a GO ID (e.g. GO:0004872) I want to find out all the GO ids which are (in the tree) bellow this ID.(in other words I want to find out all Children, grand children and so on up-to the last node). I am looking for an solution in R or Python.

gene ontology tree python

3 answers

Install Bioconductor GO.db

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

and then

library(GO.db)
offspring = GOMFOFFSPRING[["GO:0004872"]]

using a mysql library for R, you can query the GO database. See http://wiki.geneontology.org/index.php/Example_Queries#Find_descendants_of_the_node_.27nucleus.27 for some examples. e.g;:

$ mysql -h mysql.ebi.ac.uk -u go_select --password=amigo -P 4085 -D go_latest \
  -e 'SELECT DISTINCT  descendant.name, descendant.term_type,descendant.acc
      from term INNER JOIN graph_path ON term.id=graph_path.term1_id) 
      INNER JOIN term AS descendant ON descendant.id=graph_path.term2_id)
       WHERE term.acc="GO:0004872" AND distance!=0'

+----------------------------------------------------------------+--------------------+------------+
| name                                                           | term_type          | acc        |
+----------------------------------------------------------------+--------------------+------------+
| interleukin-21 receptor activity                               | molecular_function | GO:0001532 |
| phorbol ester receptor activity                                | molecular_function | GO:0001565 |
| non-kinase phorbol ester receptor activity                     | molecular_function | GO:0001566 |
| non-tyrosine kinase fibroblast growth factor receptor activity | molecular_function | GO:0001571 |
| 5-HT1 receptor activity                                        | molecular_function | GO:0001586 |
| 5-HT2 receptor activity                                        | molecular_function | GO:0001587 |
| dopamine receptor activity, coupled via Gs                     | molecular_function | GO:0001588 |
| dopamine D5 receptor activity                                  | molecular_function | GO:0001589 |
| dopamine D1 receptor activity                                  | molecular_function | GO:0001590 |
| dopamine receptor activity, coupled via Gi/Go                  | molecular_function | GO:0001591 |
 (...)

If I have many many terminal GOs like thousands how can I reache the level one GO (below root: MF, BP and CC)?

Please delete this answer and create a new post with your question. You are more likely to get answers that way.

Log in to answer this question.