biothings / biothings_explorer

TRAPI service for BioThings Explorer
https://explorer.biothings.io
Apache License 2.0
10 stars 10 forks source link

BTE creative-mode: inferred edges should include the qualifier-set from the starting query QEdge #834

Closed colleenXu closed 1 week ago

colleenXu commented 1 month ago

Currently: for MVP2 queries (chem - affects - gene), BTE's response has inferred edges with predicate affects and no qualifiers.

Screen Shot 2024-07-18 at 2 56 27 PM

However, it looks like the inferred edge should include the qualifier-set specified in the starting query:

Jackson @tokebe and I agree that it makes sense to make this change.


I've posted to the related Feedback issues involving BTE:

colleenXu commented 1 month ago

An example:

MVP2-type query - QEdge has `qualifier_constraints.qualifier_set`

``` { "nodes": { "ON": { "ids": [ "NCBIGene:154" ], "categories": [ "biolink:Gene" ] }, "SN": { "categories": [ "biolink:ChemicalEntity" ] } }, "edges": { "t_edge": { "object": "ON", "subject": "SN", "predicates": [ "biolink:affects" ], "knowledge_type": "inferred", "qualifier_constraints": [ { "qualifier_set": [ { "qualifier_type_id": "biolink:qualified_predicate", "qualifier_value": "biolink:causes" }, { "qualifier_type_id": "biolink:object_aspect_qualifier", "qualifier_value": "activity_or_abundance" }, { "qualifier_type_id": "biolink:object_direction_qualifier", "qualifier_value": "decreased" } ] } ] } } } ```

Current BTE inferred edge in response to this query

``` { "subject": "CHEBI:15903", "object": "NCBIGene:154", "predicate": "biolink:affects", "sources": [ { "resource_id": "infores:biothings-explorer", "resource_role": "primary_knowledge_source" } ], "attributes": [ { "attribute_type_id": "biolink:support_graphs", "value": [ "inferred-CHEBI:15903-affects-NCBIGene:154-support0" ] }, { "attribute_type_id": "biolink:knowledge_level", "value": "prediction" }, { "attribute_type_id": "biolink:agent_type", "value": "computational_model" } ] } ```

What we want: BTE inferred edge with qualifier-set from starting query

``` { "subject": "CHEBI:15903", "object": "NCBIGene:154", "predicate": "biolink:affects", "qualifiers": [ { "qualifier_type_id": "biolink:qualified_predicate", "qualifier_value": "biolink:causes" }, { "qualifier_type_id": "biolink:object_aspect_qualifier", "qualifier_value": "activity_or_abundance" }, { "qualifier_type_id": "biolink:object_direction_qualifier", "qualifier_value": "decreased" } ], "sources": [ { "resource_id": "infores:biothings-explorer", "resource_role": "primary_knowledge_source" } ], "attributes": [ { "attribute_type_id": "biolink:support_graphs", "value": [ "inferred-CHEBI:15903-affects-NCBIGene:154-support0" ] }, { "attribute_type_id": "biolink:knowledge_level", "value": "prediction" }, { "attribute_type_id": "biolink:agent_type", "value": "computational_model" } ] } ```

tokebe commented 1 month ago

Deployed to dev. Appears to be behaving properly.

colleenXu commented 1 month ago

I see one issue on our end: the inferred edge's qualified_predicate has a formatting issue (missing biolink prefix).

response: permethin_increases_gene.json.zip You'll need to use jless to view this, since ARAX-CI UI isn't properly showing the inferred edge qualifier sets.

example inferred edge, look at qualified_predicate value

This is the first result's inferred edge `"inferred-CHEBI:34911-affects-NCBIGene:7124"` ``` { "subject": "CHEBI:34911", "object": "NCBIGene:7124", "predicate": "biolink:affects", "sources": [ { "resource_id": "infores:biothings-explorer", "resource_role": "primary_knowledge_source" } ], "attributes": [ { "attribute_type_id": "biolink:support_graphs", "value": [ "inferred-CHEBI:34911-affects-NCBIGene:7124-support0" ] }, { "attribute_type_id": "biolink:knowledge_level", "value": "prediction" }, { "attribute_type_id": "biolink:agent_type", "value": "computational_model" } ], "qualifiers": [ { "qualifier_type_id": "qualified_predicate", "qualifier_value": "causes" }, { "qualifier_type_id": "object_aspect_qualifier", "qualifier_value": "activity_or_abundance" }, { "qualifier_type_id": "object_direction_qualifier", "qualifier_value": "increased" } ] } ```

Query I ran

from an example in https://github.com/biothings/biothings_explorer/issues/842#issue-2439391488 ``` { "message": { "query_graph": { "nodes": { "start": { "categories": ["biolink:ChemicalEntity"], "ids": ["CHEBI:34911"] }, "end": { "categories": ["biolink:Gene"] } }, "edges": { "t_edge": { "subject": "start", "object": "end", "predicates": ["biolink:affects"], "knowledge_type": "inferred", "qualifier_constraints": [ { "qualifier_set": [ { "qualifier_type_id": "biolink:qualified_predicate", "qualifier_value": "biolink:causes" }, { "qualifier_type_id": "biolink:object_aspect_qualifier", "qualifier_value": "activity_or_abundance" }, { "qualifier_type_id": "biolink:object_direction_qualifier", "qualifier_value": "increased" } ] } ] } } } } } ```

FYI: This ARAX UI issue is happening even if I fix the qualified_predicate values (use sed to find-replace, adding the biolink-prefix). I've let Eric Deutsch know in this Translator Slack thread and attached the fixed json.

colleenXu commented 1 month ago

It looks good and is deployed to CI! Now response's creative-mode inferred edges have qualified_predicate values with the biolink prefix (biolink:causes).

I did local testing, using the latest main branches (key commit is this one?).

I also tested after deploying, sending a query to the UI-CI and it worked as-intended. See https://github.com/NCATSTranslator/Feedback/issues/914#issuecomment-2282358299

I've posted to the related Feedback issues involving BTE:

tokebe commented 1 week ago

Relevant changes deployed to Prod.