I'd like to do something like the following (example in python, but I'm guessing R is what I'll have to use):
for go_hierarchy in ["BP", "CC", "MF", "KEGG"]:
for go_category in go_hierarchy:
pass
The R GOstats package has a function that does almost exactly what I want, namely GOMFCHILDREN
It can be used like shown below to get all child terms for a term:
library("GO.db")
GOMFCHILDREN$"GO:0003700"
is_a is_a is_a is_a is_a is_a
"GO:0000981" "GO:0001010" "GO:0001011" "GO:0001034" "GO:0001073" "GO:0001130"
is_a is_a is_a is_a
"GO:0001142" "GO:0001167" "GO:0001199" "GO:0098531"
Problem is, it does not work for hierarchies:
GOMFCHILDREN$"MF"
NULL
GOMFCHILDREN$"GO:MF"
NULL
How do I get all the top level terms in a hierarchy?
Thanks for the info, but I wanted to do this in a script.