Closed jolespin closed 7 months ago
@jolespin
You are close, EC number is under xref
(you can check which field they are under in the .obo
file).
Here are some sample code:
from goatools.base import get_godag
godag = get_godag("go-basic.obo", optional_attrs="xref")
for id_go, go in godag.items():
ecs = [x for x in go.xref if x.startswith("EC:")]
if ecs:
print(id_go, ecs)
This prints out:
...
GO:0008557 ['EC:7.6.2.1']
GO:1901237 ['EC:7.3.2.6']
GO:0090450 ['EC:3.6.1.64']
GO:0043851 ['EC:2.1.1.246']
I'm trying to understand how I can use GOTATOOLS to parse any of the GO files to yield a dictionary that has the following structure:
I was able to load the obo file but I couldn't figure out how to get the enzymes:
They are definitely in there, I just don't how to access them: