How to download ChEBI Ontology Classes
2
0
Entering edit mode
7.4 years ago
support ▴ 40

I downloaded the ChEBI .sql files from here: https://www.ebi.ac.uk/chebi/downloadsForward.do and they have the list of compounds and relationships between compounds, but I can't find anywhere in there the list of ontological classes. For example: Flavonoids: https://www.ebi.ac.uk/chebi/searchId.do?chebiId=CHEBI:47916 Biological roles: https://www.ebi.ac.uk/chebi/searchId.do?chebiId=CHEBI:24432 Biomarkers: https://www.ebi.ac.uk/chebi/searchId.do?chebiId=CHEBI:59163

I need to get the whole tree of categories to go with the chemicals. I tried downloading the .OWL file but I haven't figured out if it contains these categories yet, because I can't load it into protege for some reason. Maybe because the file is so big. What would be the easiest way to get all of the categories and their relationships to the chemicals? I'm thinking of making a spider, and using webservices: http://www.ebi.ac.uk/chebi/webServices.do to first get all the categories by using getOntologyChildren and working my way down from the root parent categories (I don't know what they are yet, I know role is one of them though). Then I can loop through every chemical and using getOntologyParents to assign each chemical to categories. Is there an easier way to do this?

EDIT: Oh wait, I see that these ontological classes are stored in the compounds table. This makes things quite confusing because I don't know how to separate them from the compounds. Also there are lots of subgroups of compounds, like enantiomers that I don't need. I wanna scrape the compounds, not all the possible stereoisomers and ions of the compound. I wonder how I can filter all these subcompounds out.

chebi owl ontology • 2.6k views
ADD COMMENT
0
Entering edit mode
8 months ago
soerendip • 0

Here is a collection of tools that I have been working on recently that can be used to download the ChEBI graph.:

https://github.com/sorenwacker/chebi-tools

ADD COMMENT
0
Entering edit mode
8 months ago
Chris • 0

You can use the Ontology Access Kit:

pip install oaklib

This provides both command line access and python API access to all OBO ontologies, including CHEBI.

OAK can handle owl. obo, json, distributions, as well as talking to remote services that serve CHEBI (ubergraph, ontobee), but the easiest thing is to use the sqlite version. Even though chebi is moderately large (for an ontology), it should be performant

For example, to see the graph of ancestors from a term, following is-a relationships:

runoak -i sqlite:obo:chebi viz -p i "citric acid"

There will be a delay the first time you run this while the sqlite database is downloaded

Some more examples of using CHEBI in this notebook

ADD COMMENT

Login before adding your answer.

Traffic: 2804 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6