biothings / pending.api

Set of standalone APIs built with the BioThings SDK for the Translator Project
https://biothings.ncats.io
Apache License 2.0
5 stars 13 forks source link

Data source: FooDB #65

Closed andrewsu closed 6 months ago

andrewsu commented 2 years ago

From their website (https://foodb.ca/):

FooDB is the world’s largest and most comprehensive resource on food constituents, chemistry and biology. It provides information on both macronutrients and micronutrients, including many of the constituents that give foods their flavor, color, taste, texture and aroma. Each chemical entry in the FooDB contains more than 100 separate data fields covering detailed compositional, biochemical and physiological information (obtained from the literature). This includes data on the compound’s nomenclature, its description, information on its structure, chemical class, its physico-chemical data, its food source(s), its color, its aroma, its taste, its physiological effect, presumptive health effects (from published studies), and concentrations in various foods. Users are able to browse or search FooDB by food source, name, descriptors, function or concentrations. Depending on individual preferences users are able to view the content of FooDB from the Food Browse (listing foods by their chemical composition) or the Compound Browse (listing chemicals by their food sources).

This resource could provide edges between foods (indexed by FooDB IDs), and chemical compounds (indexed by CAS number, InChI Key, PubChem, ChEMBL, etc.). For example, https://foodb.ca/foods/FOOD00914 shows the link between soybean oil and beta-sitosterol. Unfortunately, it doesn't look like the FooDB IDs are linked to external IDs that are well used within Translator (so FooDB just might be the canonical ID here?).

FooDB does have an API but it requires an API key, so not (currently) workable for Translator...

Downloadable file is available at https://foodb.ca/downloads, provided under CC-BY-NC license. As of now, the last update was April 2020.

$ unzip foodb_2020_04_07_json.zip
Archive:  foodb_2020_04_07_json.zip
   creating: foodb_2020_04_07_json/
  inflating: __MACOSX/._foodb_2020_04_07_json
  inflating: foodb_2020_04_07_json/Content.json
  inflating: foodb_2020_04_07_json/FoodTaxonomy.json
  inflating: foodb_2020_04_07_json/AccessionNumber.json
  inflating: foodb_2020_04_07_json/.DS_Store
  inflating: __MACOSX/foodb_2020_04_07_json/._.DS_Store
  inflating: foodb_2020_04_07_json/CompoundAlternateParent.json
  inflating: foodb_2020_04_07_json/PfamMembership.json
  inflating: foodb_2020_04_07_json/CompoundsPathway.json
  inflating: foodb_2020_04_07_json/OntologySynonym.json
  inflating: foodb_2020_04_07_json/CompoundsEnzyme.json
  inflating: foodb_2020_04_07_json/Nutrient.json
  inflating: foodb_2020_04_07_json/OntologyTerm.json
  inflating: foodb_2020_04_07_json/CompoundSynonym.json
  inflating: foodb_2020_04_07_json/Enzyme.json
  inflating: foodb_2020_04_07_json/Food.json
  inflating: foodb_2020_04_07_json/Reference.json
  inflating: foodb_2020_04_07_json/Pfam.json
  inflating: foodb_2020_04_07_json/HealthEffect.json
  inflating: foodb_2020_04_07_json/CompoundsHealthEffect.json
  inflating: foodb_2020_04_07_json/CompoundExternalDescriptor.json
  inflating: foodb_2020_04_07_json/Compound.json
  inflating: __MACOSX/foodb_2020_04_07_json/._Compound.json
  inflating: foodb_2020_04_07_json/EnzymeSynonym.json
  inflating: foodb_2020_04_07_json/CompoundSubstituent.json
  inflating: foodb_2020_04_07_json/CompoundsFlavor.json
  inflating: foodb_2020_04_07_json/MapItemsPathway.json
  inflating: foodb_2020_04_07_json/NcbiTaxonomyMap.json
  inflating: foodb_2020_04_07_json/CompoundOntologyTerm.json
  inflating: foodb_2020_04_07_json/Sequence.json
  inflating: foodb_2020_04_07_json/Flavor.json
  inflating: foodb_2020_04_07_json/Pathway.json
  inflating: foodb_2020_04_07_json/PdbIdentifier.json
yichuanma95 commented 2 years ago

Repo is here at https://github.com/yichuanma95/foodb_json.git

yichuanma95 commented 2 years ago

The repo I provided contains info about the data's mapping.

yichuanma95 commented 2 years ago

While working on the API, I have noticed inconsistencies between the downloaded data and the browsable data on the FooDB website.

-The FooDB website stated there were 70926 compounds, but the compound.json file had 70477 entries, so several hundred entries are missing in the json file. -The website also stated 797 foods, but there were 992 foods in Food.json file

ericz1803 commented 2 years ago

Deployed to https://biothings.ncats.io/foodb.

Example record https://biothings.ncats.io/foodb/food/FOOD00914

colleenXu commented 2 years ago

Noting that the next step is writing a SmartAPI yaml for this API. An intern can try to do this, or I'll stick it in my to-do list...

andrewsu commented 2 years ago

Per 2022-08-24 meeting, tagging @yihangx to work on writing the SmartAPI annotation file. See instructions linked in step 3 of https://github.com/biothings/BioThings_Explorer_TRAPI/blob/main/docs/README-contributing-new-data-source.md

yihangx commented 2 years ago

@andrewsu I submitted pull request here: https://github.com/NCATS-Tangerine/translator-api-registry/pull/100. Since this is my first try, it may need some improvements. I am willing to talk to reviewer and make some changes.

yihangx commented 2 years ago

@andrewsu I tested the annotation file with local BTE instance, and I did not see a problem. You can find my yaml file here: https://github.com/yihangx/translator-api-registry/blob/master/foodb/smartapi.yaml

andrewsu commented 2 years ago

Great, for completeness, can you post an example query and a snippet of the result showing successful incorporation? Exactly what that snippet should look like isn't precisely defined, but examples can be found in these two comments for other data sources:

(also, did you mean to close this PR https://github.com/NCATS-Tangerine/translator-api-registry/pull/100?)

yihangx commented 2 years ago

@andrewsu I had problem finding a valid graph to test. I will coordinate with Colleen to test it this week.

Yes. I temporally closed the PR. Once I finish the test, I will reopen it.

colleenXu commented 1 year ago

The status is that This resource still needs SmartAPI/BTE annotation

colleenXu commented 11 months ago

Related infores stuff is ready:

colleenXu commented 10 months ago

Here's the SmartAPI yaml w/ x-bte annotation for BioThings FooDB. This yaml is registered in SmartAPI Registry.

I haven't made a PR to add this to BTE's regular use (for the config file, API_LIST variable): I'm waiting until we're closer to the next release cycle to make a PR with all the KPs we want to add.

Example query

send a POST request to the api-specific endpoint, BioThings FooDB only. Like `http://localhost:3000/v1/smartapi/f1b8f64c316a01d1722f0fb842499fe5/query`. This works even when the KP isn't included in BTE's config Put this in the request body: It's querying with Soybean oil (aka `foodb.food:FOOD00914`) ``` { "message": { "query_graph": { "nodes": { "n0": { "ids": ["foodb.food:FOOD00914"], "categories": ["biolink:Food"] }, "n1": { "categories": ["biolink:SmallMolecule"] } }, "edges": { "e01": { "subject": "n0", "object": "n1" } } } } } ``` You should get a response with this edge (from this [record in the BioThings API](https://biothings.ncats.io/foodb/food/FOOD00914), based on this [operation's example](https://github.com/NCATS-Tangerine/translator-api-registry/blob/408b5b92a6fb20c5586ae8864b8b4d083bd57473/biothings_foodb/smartapi.yaml#L601): * object: beta-Sitosterol (primary ID in SRI NodeNorm `PUBCHEM.COMPOUND:222284`, INCHIKEY in BioThings API is `KZJWDPNRJALLNS-VJSFXXLFSA-N`) ``` "c0f056b0b902447b3142cb16bb592081": { "predicate": "biolink:has_food_component", "subject": "foodb.food:FOOD00914", "object": "PUBCHEM.COMPOUND:222284", "attributes": [], "sources": [ { "resource_id": "infores:fooddb", "resource_role": "primary_knowledge_source" }, { "resource_id": "infores:biothings-foodb", "resource_role": "aggregator_knowledge_source", "upstream_resource_ids": [ "infores:fooddb" ] }, { "resource_id": "infores:service-provider-trapi", "resource_role": "aggregator_knowledge_source", "upstream_resource_ids": [ "infores:biothings-foodb" ] } ] }, ```


And some small notes:

colleenXu commented 8 months ago

Added to the PR linked above to add this to BTE's regular use (for the config file, API_LIST variable).

We'll try to get it into Translator's Lobster release (dev/CI -> Test this Friday)

tokebe commented 6 months ago

@colleenXu Should this issue be closed?

colleenXu commented 6 months ago

Yep, confirmed that it's live by posting the example query to https://bte.transltr.io/v1/query (Prod instance).