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

phase 3: use qualifier-hierarchy when processing QGraph qualifier-constraints -> picking MetaEdges #598

Closed
colleenXu opened this issue Mar 28, 2023 · 4 comments
Assignees

Comments

@colleenXu
Copy link
Collaborator

colleenXu commented Mar 28, 2023

We'd like to be able to traverse the qualifier hierarchy (similar to what we do with predicates and node categories), so we can correctly retrieve all the operations/MetaEdges that correspond to a particular qualifier-constraint from the original query QEdge...

this may come up as a potential issue as more querying is done with qualifier-constraints

  • timing: phase 3. this is a "making existing functionality better" thing
  • priority: high priority within phase 3?

Notes:

@colleenXu colleenXu changed the title handling qualifier-hierarchy for QGraph qualifier-constraints -> picking MetaEdges using qualifier-hierarchy when taking QGraph qualifier-constraints -> picking MetaEdges Mar 28, 2023
@colleenXu colleenXu changed the title using qualifier-hierarchy when taking QGraph qualifier-constraints -> picking MetaEdges using qualifier-hierarchy when processing QGraph qualifier-constraints -> picking MetaEdges Mar 28, 2023
@colleenXu colleenXu changed the title using qualifier-hierarchy when processing QGraph qualifier-constraints -> picking MetaEdges use qualifier-hierarchy when processing QGraph qualifier-constraints -> picking MetaEdges Mar 29, 2023
@colleenXu
Copy link
Collaborator Author

Update notes: opening post was last updated 4/4 evening

@colleenXu colleenXu changed the title use qualifier-hierarchy when processing QGraph qualifier-constraints -> picking MetaEdges phase 3: use qualifier-hierarchy when processing QGraph qualifier-constraints -> picking MetaEdges Apr 5, 2023
@rjawesome rjawesome self-assigned this Apr 10, 2023
@rjawesome
Copy link
Contributor

rjawesome commented Apr 13, 2023

PRs made for this issue. The qualifier expansion is currently used for non-TRAPI APIs in the PR.

Example Query I tested with (in the smartapi yaml for DGIdb, the constraints say activity, and biolink:causes respectively):
{
    "message": {
        "query_graph": {
            "nodes": {
                "n0": {
                    "ids":["CHEMBL.COMPOUND:CHEMBL266510"]
                },
                "n1": {
                    "categories":["biolink:Gene"]
               }
            },
            "edges": {
                "e0": {
                    "subject": "n0",
                    "object": "n1",
                    "qualifier_constraints": [
                        { 
                            "qualifier_set": [
                                {
                                    "qualifier_type_id": "object_aspect_qualifier",
                                    "qualifier_value": "activity_or_abundance"
                                },
                                {
                                    "qualifier_type_id": "qualified_predicate",
                                    "qualifier_value": "biolink:contributes_to"
                                }
                            ]
                        }
                    ]
                }
            }
        }
    }
}

@colleenXu
Copy link
Collaborator Author

Hmm. I think it's fine that "qualifier" expansion isn't done with TRAPI KPs right now. I think we'd need #597 addressed, and then we could think if qualifier expansion is needed to match the qualifier-constraints to MetaEdges from TRAPI KPs that have qualifier info...

@colleenXu
Copy link
Collaborator Author

Appears to work.

In this testing, BTE had console logs showing that object_direction_qualifier was correctly expanded from decreased to decreased and its child downregulated.

Automat hetio's meta_knowledge_graph shows that there's a SmallMolecule - regulates - downregulated (qualifier) Gene MetaEdge. So BTE likely used that MetaEdge to generate the sub-query; this shows that qualifier-hierarchy expansion is working (since I queried for the parent qualifier decreased).

console logs showing the qualifier hierarchy expansion
  bte:biothings-explorer-trapi:QEdge Expanded edges: affects_response_to,increases_response_to,decreases_response_to,regulates,disrupts,ameliorates,treats,exacerbates,has_adverse_event,has_side_effect,affects +2ms
  bte:biothings-explorer-trapi:QEdge Expanded edges: affects_response_to,increases_response_to,decreases_response_to,regulates,disrupts,ameliorates,treats,exacerbates,has_adverse_event,has_side_effect,affects +0ms
  bte:biothings-explorer-trapi:qedge2btedge KG Filters: {
  bte:biothings-explorer-trapi:qedge2btedge   "input_type": [
  bte:biothings-explorer-trapi:qedge2btedge     "SmallMolecule"
  bte:biothings-explorer-trapi:qedge2btedge   ],
  bte:biothings-explorer-trapi:qedge2btedge   "output_type": [
  bte:biothings-explorer-trapi:qedge2btedge     "Gene"
  bte:biothings-explorer-trapi:qedge2btedge   ],
  bte:biothings-explorer-trapi:qedge2btedge   "predicate": [
  bte:biothings-explorer-trapi:qedge2btedge     "affects_response_to",
  bte:biothings-explorer-trapi:qedge2btedge     "increases_response_to",
  bte:biothings-explorer-trapi:qedge2btedge     "decreases_response_to",
  bte:biothings-explorer-trapi:qedge2btedge     "regulates",
  bte:biothings-explorer-trapi:qedge2btedge     "disrupts",
  bte:biothings-explorer-trapi:qedge2btedge     "ameliorates",
  bte:biothings-explorer-trapi:qedge2btedge     "treats",
  bte:biothings-explorer-trapi:qedge2btedge     "exacerbates",
  bte:biothings-explorer-trapi:qedge2btedge     "has_adverse_event",
  bte:biothings-explorer-trapi:qedge2btedge     "has_side_effect",
  bte:biothings-explorer-trapi:qedge2btedge     "affects"
  bte:biothings-explorer-trapi:qedge2btedge   ],
  bte:biothings-explorer-trapi:qedge2btedge   "qualifiers": [
  bte:biothings-explorer-trapi:qedge2btedge     {
  bte:biothings-explorer-trapi:qedge2btedge       "object_direction_qualifier": [
  bte:biothings-explorer-trapi:qedge2btedge         "downregulated",
  bte:biothings-explorer-trapi:qedge2btedge         "decreased"
  bte:biothings-explorer-trapi:qedge2btedge       ]
  bte:biothings-explorer-trapi:qedge2btedge     }
  bte:biothings-explorer-trapi:qedge2btedge   ]
  bte:biothings-explorer-trapi:qedge2btedge } +0ms

Closing issue

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

No branches or pull requests

2 participants