Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BTE and "reverse" semmed operations #227

Closed
andrewsu opened this issue Jul 27, 2021 · 4 comments
Closed

BTE and "reverse" semmed operations #227

andrewsu opened this issue Jul 27, 2021 · 4 comments
Assignees

Comments

@andrewsu
Copy link
Member

When issuing this query for ChemicalSubstances related to cyclic vomiting, we expect BTE to return a result for (at least) isopropyl alcohol. Currently BTE returns no results.

{
    "message": {
        "query_graph": {
            "nodes": {
                "n0": {
                    "ids": [
                        "HP:0002013"
                    ],
                    "categories": [
                        "biolink:DiseaseOrPhenotypicFeature"
                    ]
                },
                "n1": {
                    "categories": [
                        "biolink:ChemicalSubstance"
                    ]
                }
            },
            "edges": {
                "e0": {
                    "subject": "n0",
                    "object": "n1",
                    "predicates": [
                        "biolink:related_to"
                    ]
                }
            }
        }
    }
}

HP:0002013 should get translated to UMLS:C0042963 via http://pending.biothings.io/hpo/phenotype/HP:0002013, and then we should be able to get that UMLS:C0042963 is treated by isopropyl alcohol (UMLS:C0022237) via http://pending.biothings.io/semmedchemical/query?q=treats.umls:C0042963&limit=500&fields=name.

Source issue: NCATSTranslator/testing#91

@andrewsu
Copy link
Member Author

There are three options for solving this:

  1. adding in all reverse triples into the semmed APIs via the semmed parsers
  2. adding in reverse operations in x-bte
  3. adding logic within BTE to understand inverse edges and query appropriately

After discussion with @colleenXu, we will go forward with option 2 above -- Colleen will update x-bte for the semmedchemical API to test that this fixes this issue. Colleen will also consult their annotations of missing reverse edges to look at making sure we are (relatively) exhaustive.

@colleenXu colleenXu changed the title BTE not querying semmed correctly BTE missing reverse operations (semmed and more) Aug 2, 2021
@colleenXu colleenXu changed the title BTE missing reverse operations (semmed and more) BTE and "reverse" semmed operations Aug 17, 2021
@colleenXu
Copy link
Collaborator

colleenXu commented Aug 17, 2021

After talking with Andrew Su today, this ticket is on hold for two reasons.

  1. It involves more work than expected (refactoring BTE's code for processing the SEMMED APIs' responses)
  2. A separate effort is underway to update the SEMMED APIs and use a different structure and querying capabilities...

Details below:


The original inspiration for this ticket was "reverse" operations for SEMMED apis. However, only annotating the operations in x-bte did not result in successfully-executed operations (the saved yaml with these reverse operations added is here)...BTE looks to execute the query correctly, but doesn't seem to process it correctly to pick out the output IDs. One can try it themselves by converting the yaml to json, then saving it to the test/smartapi.json in bte-trapi, compiling their local instance, and then sending queries (POST) to the test/query endpoint of the local instance.

It looks like BTE's code for processing the SEMMED APIs' responses would need refactoring (recognizing the two different structures for reverse vs forward querying and processing them differently?).

Example: to get from the Disease "Congenital pectus carinatum" (UMLS:C0158731) to the chemicals that treat it, we can do this "reverse" query to SEMMED chemical API:

POST to https://biothings.ncats.io/semmedchemical/query?fields=umls

{
    "q":"C0158731",
    "scopes": "treats.umls"
}

The response looks like this:

[
    {
        "query": "C0158731",
        "_id": "C0027996",
        "_score": 7.2889276,
        "umls": "C0027996"
    },
    {
        "query": "C0158731",
        "_id": "C0074758",
        "_score": 7.254178,
        "umls": "C0074758"
    },...
]

This is a different structure compared to what BTE "sees" with forward querying, and I think it's being processed incorrectly by BTE's current code for handling SEMMED API responses...

@colleenXu
Copy link
Collaborator

need to check that this query works before closing...

@colleenXu
Copy link
Collaborator

I've confirmed that we are now able to do this query with semmeddb (after modifying it to use ChemicalEntity)....and get the expected result. This is because semmeddb is annotated with the reverse operations.

The SRI-ID resolver does equate HP:0002013 to UMLS:C0042963. However, it currently does not recognize UMLS:C0022237, so BTE does not have its name as isoproyl alcohol...

The query

{
    "message": {
        "query_graph": {
            "nodes": {
                "n0": {
                    "ids": ["HP:0002013"],
                    "categories": ["biolink:DiseaseOrPhenotypicFeature"]
                },
                "n1": {
                    "categories": ["biolink:ChemicalEntity"]
                }
            },
            "edges": {
                "e0": {
                    "subject": "n0",
                    "object": "n1",
                    "predicates": ["biolink:related_to"]
                }
            }
        }
    }
}

Returns a node

                "UMLS:C0022237": {
                    "categories": [
                        "biolink:SmallMolecule"
                    ],
                    "name": "UMLS:C0022237",

with this edge:

                "986fb6ffa0d0ad88e0fb6fbd15ab4bbe": {
                    "predicate": "biolink:treated_by",
                    "subject": "HP:0002013",
                    "object": "UMLS:C0022237",
                    "attributes": [
                        {
                            "attribute_type_id": "biolink:aggregator_knowledge_source",
                            "value": [
                                "infores:translator-biothings-explorer"
                            ],
                            "value_type_id": "biolink:InformationResource"
                        },
                        {
                            "attribute_type_id": "biolink:primary_knowledge_source",
                            "value": [
                                "infores:semmeddb"
                            ],
                            "value_type_id": "biolink:InformationResource"
                        },
                        {
                            "attribute_type_id": "biolink:aggregator_knowledge_source",
                            "value": [
                                "infores:biothings-semmeddb"
                            ],
                            "value_type_id": "biolink:InformationResource"
                        },
                        {
                            "attribute_type_id": "publications",
                            "value": [
                                "PMID:15632723",
                                "PMID:30108075"
                            ]
                        },
                        {
                            "attribute_type_id": "biolink:original_object",
                            "value": "C0042963"
                        },
                        {
                            "attribute_type_id": "biolink:original_predicate",
                            "value": "TREATS"
                        },
                        {
                            "attribute_type_id": "biolink:original_subject",
                            "value": "C0022237"
                        },
                        {
                            "attribute_type_id": "original_object_name",
                            "value": "Vomiting"
                        },
                        {
                            "attribute_type_id": "original_subject_name",
                            "value": "Isopropanol"
                        }
                    ]
                },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants