diff --git a/shepherd_server/openapi-config.yaml b/shepherd_server/openapi-config.yaml index 8328f89..cae12f8 100644 --- a/shepherd_server/openapi-config.yaml +++ b/shepherd_server/openapi-config.yaml @@ -4,7 +4,7 @@ contact: x-id: https://github.com/maximusunc x-role: responsible developer description: '

Shepherd: Translator Autonomous Relay Agent Platform' -version: 0.4.0 +version: 0.4.1 servers: - description: Default server url: https://shepherd.renci.org diff --git a/workers/bte_lookup/templates/Chem-decreases-Gene/Chem-DecreaseAnotherGeneThatUpregs-Gene.json b/workers/bte_lookup/templates/Chem-decreases-Gene/Chem-DecreaseAnotherGeneThatUpregs-Gene.json index ed8cc75..c187539 100644 --- a/workers/bte_lookup/templates/Chem-decreases-Gene/Chem-DecreaseAnotherGeneThatUpregs-Gene.json +++ b/workers/bte_lookup/templates/Chem-decreases-Gene/Chem-DecreaseAnotherGeneThatUpregs-Gene.json @@ -1,54 +1,54 @@ { - "message": { - "query_graph": { - "nodes": { - "sn": { - "categories":["biolink:ChemicalEntity"] - }, - "nA": { - "categories":["biolink:Gene", "biolink:Protein"], - "is_set": true - }, - "on": { - "categories":["biolink:Gene", "biolink:Protein"] - } - }, - "edges": { - "eA": { - "subject": "sn", - "object": "nA", - "predicates": ["biolink:affects"], - "qualifier_constraints": [ - { - "qualifier_set": [ - { - "qualifier_type_id": "biolink:object_direction_qualifier", - "qualifier_value": "decreased" - }, - { - "qualifier_type_id": "biolink:object_aspect_qualifier", - "qualifier_value": "activity_or_abundance" - } - ] - } - ] - }, - "eB": { - "subject": "nA", - "object": "on", - "predicates": ["biolink:regulates"], - "qualifier_constraints": [ - { - "qualifier_set": [ - { - "qualifier_type_id": "biolink:object_direction_qualifier", - "qualifier_value": "upregulated" - } - ] - } - ] - } - } - } + "query_graph": { + "nodes": { + "$source": { + "ids": ["$source_id"], + "categories": ["biolink:ChemicalEntity"] + }, + "nA": { + "categories": ["biolink:Gene", "biolink:Protein"], + "is_set": true + }, + "$target": { + "ids": ["$target_id"], + "categories": ["biolink:Gene", "biolink:Protein"] + } + }, + "edges": { + "eA": { + "subject": "$source", + "object": "nA", + "predicates": ["biolink:affects"], + "qualifier_constraints": [ + { + "qualifier_set": [ + { + "qualifier_type_id": "biolink:object_direction_qualifier", + "qualifier_value": "decreased" + }, + { + "qualifier_type_id": "biolink:object_aspect_qualifier", + "qualifier_value": "activity_or_abundance" + } + ] + } + ] + }, + "eB": { + "subject": "nA", + "object": "$target", + "predicates": ["biolink:regulates"], + "qualifier_constraints": [ + { + "qualifier_set": [ + { + "qualifier_type_id": "biolink:object_direction_qualifier", + "qualifier_value": "upregulated" + } + ] + } + ] + } } -} \ No newline at end of file + } +} diff --git a/workers/bte_lookup/templates/Chem-decreases-Gene/Chem-IncreaseAnotherGeneThatDownregs-Gene.json b/workers/bte_lookup/templates/Chem-decreases-Gene/Chem-IncreaseAnotherGeneThatDownregs-Gene.json index 90b51ab..0219c66 100644 --- a/workers/bte_lookup/templates/Chem-decreases-Gene/Chem-IncreaseAnotherGeneThatDownregs-Gene.json +++ b/workers/bte_lookup/templates/Chem-decreases-Gene/Chem-IncreaseAnotherGeneThatDownregs-Gene.json @@ -1,54 +1,54 @@ { - "message": { - "query_graph": { - "nodes": { - "sn": { - "categories":["biolink:ChemicalEntity"] - }, - "nA": { - "categories":["biolink:Gene", "biolink:Protein"], - "is_set": true - }, - "on": { - "categories":["biolink:Gene", "biolink:Protein"] - } - }, - "edges": { - "eA": { - "subject": "sn", - "object": "nA", - "predicates": ["biolink:affects"], - "qualifier_constraints": [ - { - "qualifier_set": [ - { - "qualifier_type_id": "biolink:object_direction_qualifier", - "qualifier_value": "increased" - }, - { - "qualifier_type_id": "biolink:object_aspect_qualifier", - "qualifier_value": "activity_or_abundance" - } - ] - } - ] - }, - "eB": { - "subject": "nA", - "object": "on", - "predicates": ["biolink:regulates"], - "qualifier_constraints": [ - { - "qualifier_set": [ - { - "qualifier_type_id": "biolink:object_direction_qualifier", - "qualifier_value": "downregulated" - } - ] - } - ] - } - } - } + "query_graph": { + "nodes": { + "$source": { + "ids": ["$source_id"], + "categories": ["biolink:ChemicalEntity"] + }, + "nA": { + "categories": ["biolink:Gene", "biolink:Protein"], + "is_set": true + }, + "$target": { + "ids": ["$target_id"], + "categories": ["biolink:Gene", "biolink:Protein"] + } + }, + "edges": { + "eA": { + "subject": "$source", + "object": "nA", + "predicates": ["biolink:affects"], + "qualifier_constraints": [ + { + "qualifier_set": [ + { + "qualifier_type_id": "biolink:object_direction_qualifier", + "qualifier_value": "increased" + }, + { + "qualifier_type_id": "biolink:object_aspect_qualifier", + "qualifier_value": "activity_or_abundance" + } + ] + } + ] + }, + "eB": { + "subject": "nA", + "object": "$target", + "predicates": ["biolink:regulates"], + "qualifier_constraints": [ + { + "qualifier_set": [ + { + "qualifier_type_id": "biolink:object_direction_qualifier", + "qualifier_value": "downregulated" + } + ] + } + ] + } } -} \ No newline at end of file + } +} diff --git a/workers/bte_lookup/templates/Chem-decreases-Gene/Chem-decreasesGene.json b/workers/bte_lookup/templates/Chem-decreases-Gene/Chem-decreasesGene.json index 5091b09..7adee1a 100644 --- a/workers/bte_lookup/templates/Chem-decreases-Gene/Chem-decreasesGene.json +++ b/workers/bte_lookup/templates/Chem-decreases-Gene/Chem-decreasesGene.json @@ -1,35 +1,35 @@ { - "message": { - "query_graph": { - "nodes": { - "sn": { - "categories":["biolink:ChemicalEntity"] - }, - "on": { - "categories":["biolink:Gene", "biolink:Protein"] - } - }, - "edges": { - "eA": { - "subject": "sn", - "object": "on", - "predicates": ["biolink:affects"], - "qualifier_constraints": [ - { - "qualifier_set": [ - { - "qualifier_type_id": "biolink:object_direction_qualifier", - "qualifier_value": "decreased" - }, - { - "qualifier_type_id": "biolink:object_aspect_qualifier", - "qualifier_value": "activity_or_abundance" - } - ] - } - ] - } - } - } + "query_graph": { + "nodes": { + "$source": { + "ids": ["$source_id"], + "categories": ["biolink:ChemicalEntity"] + }, + "$target": { + "ids": ["$target_id"], + "categories": ["biolink:Gene", "biolink:Protein"] + } + }, + "edges": { + "eA": { + "subject": "$source", + "object": "$target", + "predicates": ["biolink:affects"], + "qualifier_constraints": [ + { + "qualifier_set": [ + { + "qualifier_type_id": "biolink:object_direction_qualifier", + "qualifier_value": "decreased" + }, + { + "qualifier_type_id": "biolink:object_aspect_qualifier", + "qualifier_value": "activity_or_abundance" + } + ] + } + ] + } } -} \ No newline at end of file + } +} diff --git a/workers/bte_lookup/templates/Chem-decreases-Gene/Chem-negatively_correlated-Gene.json b/workers/bte_lookup/templates/Chem-decreases-Gene/Chem-negatively_correlated-Gene.json index 872b3b7..7f1131e 100644 --- a/workers/bte_lookup/templates/Chem-decreases-Gene/Chem-negatively_correlated-Gene.json +++ b/workers/bte_lookup/templates/Chem-decreases-Gene/Chem-negatively_correlated-Gene.json @@ -1,21 +1,21 @@ { - "message": { - "query_graph": { - "nodes": { - "sn": { - "categories":["biolink:ChemicalEntity"] - }, - "on": { - "categories":["biolink:Gene", "biolink:Protein"] - } - }, - "edges": { - "eA": { - "subject": "sn", - "object": "on", - "predicates": ["biolink:negatively_correlated_with"] - } - } - } + "query_graph": { + "nodes": { + "$source": { + "ids": ["$source_id"], + "categories": ["biolink:ChemicalEntity"] + }, + "$target": { + "ids": ["$target_id"], + "categories": ["biolink:Gene", "biolink:Protein"] + } + }, + "edges": { + "eA": { + "subject": "$source", + "object": "$target", + "predicates": ["biolink:negatively_correlated_with"] + } } -} \ No newline at end of file + } +} diff --git a/workers/bte_lookup/templates/Chem-decreases-Gene/Chem-physically_interacts-GeneThatDownregs-Gene.json b/workers/bte_lookup/templates/Chem-decreases-Gene/Chem-physically_interacts-GeneThatDownregs-Gene.json index 309a5c6..4ff8d97 100644 --- a/workers/bte_lookup/templates/Chem-decreases-Gene/Chem-physically_interacts-GeneThatDownregs-Gene.json +++ b/workers/bte_lookup/templates/Chem-decreases-Gene/Chem-physically_interacts-GeneThatDownregs-Gene.json @@ -1,40 +1,40 @@ { - "message": { - "query_graph": { - "nodes": { - "sn": { - "categories":["biolink:ChemicalEntity"] - }, - "nA": { - "categories":["biolink:Gene", "biolink:Protein"], - "is_set": true - }, - "on": { - "categories":["biolink:Gene", "biolink:Protein"] - } - }, - "edges": { - "eA": { - "subject": "sn", - "object": "nA", - "predicates": ["biolink:physically_interacts_with"] - }, - "eB": { - "subject": "nA", - "object": "on", - "predicates": ["biolink:regulates"], - "qualifier_constraints": [ - { - "qualifier_set": [ - { - "qualifier_type_id": "biolink:object_direction_qualifier", - "qualifier_value": "downregulated" - } - ] - } - ] - } - } - } + "query_graph": { + "nodes": { + "$source": { + "ids": ["$source_id"], + "categories": ["biolink:ChemicalEntity"] + }, + "nA": { + "categories": ["biolink:Gene", "biolink:Protein"], + "is_set": true + }, + "$target": { + "ids": ["$target_id"], + "categories": ["biolink:Gene", "biolink:Protein"] + } + }, + "edges": { + "eA": { + "subject": "$source", + "object": "nA", + "predicates": ["biolink:physically_interacts_with"] + }, + "eB": { + "subject": "nA", + "object": "$target", + "predicates": ["biolink:regulates"], + "qualifier_constraints": [ + { + "qualifier_set": [ + { + "qualifier_type_id": "biolink:object_direction_qualifier", + "qualifier_value": "downregulated" + } + ] + } + ] + } } -} \ No newline at end of file + } +} diff --git a/workers/bte_lookup/templates/Chem-increases-Gene/Chem-DecreaseAnotherGeneThatDownregs-Gene.json b/workers/bte_lookup/templates/Chem-increases-Gene/Chem-DecreaseAnotherGeneThatDownregs-Gene.json index 09bcd3f..0f47412 100644 --- a/workers/bte_lookup/templates/Chem-increases-Gene/Chem-DecreaseAnotherGeneThatDownregs-Gene.json +++ b/workers/bte_lookup/templates/Chem-increases-Gene/Chem-DecreaseAnotherGeneThatDownregs-Gene.json @@ -1,54 +1,54 @@ { - "message": { - "query_graph": { - "nodes": { - "sn": { - "categories":["biolink:ChemicalEntity"] - }, - "nA": { - "categories":["biolink:Gene", "biolink:Protein"], - "is_set": true - }, - "on": { - "categories":["biolink:Gene", "biolink:Protein"] - } - }, - "edges": { - "eA": { - "subject": "sn", - "object": "nA", - "predicates": ["biolink:affects"], - "qualifier_constraints": [ - { - "qualifier_set": [ - { - "qualifier_type_id": "biolink:object_direction_qualifier", - "qualifier_value": "decreased" - }, - { - "qualifier_type_id": "biolink:object_aspect_qualifier", - "qualifier_value": "activity_or_abundance" - } - ] - } - ] - }, - "eB": { - "subject": "nA", - "object": "on", - "predicates": ["biolink:regulates"], - "qualifier_constraints": [ - { - "qualifier_set": [ - { - "qualifier_type_id": "biolink:object_direction_qualifier", - "qualifier_value": "downregulated" - } - ] - } - ] - } - } - } + "query_graph": { + "nodes": { + "$source": { + "ids": ["$source_id"], + "categories": ["biolink:ChemicalEntity"] + }, + "nA": { + "categories": ["biolink:Gene", "biolink:Protein"], + "is_set": true + }, + "$target": { + "ids": ["$target_id"], + "categories": ["biolink:Gene", "biolink:Protein"] + } + }, + "edges": { + "eA": { + "subject": "$source", + "object": "nA", + "predicates": ["biolink:affects"], + "qualifier_constraints": [ + { + "qualifier_set": [ + { + "qualifier_type_id": "biolink:object_direction_qualifier", + "qualifier_value": "decreased" + }, + { + "qualifier_type_id": "biolink:object_aspect_qualifier", + "qualifier_value": "activity_or_abundance" + } + ] + } + ] + }, + "eB": { + "subject": "nA", + "object": "$target", + "predicates": ["biolink:regulates"], + "qualifier_constraints": [ + { + "qualifier_set": [ + { + "qualifier_type_id": "biolink:object_direction_qualifier", + "qualifier_value": "downregulated" + } + ] + } + ] + } } -} \ No newline at end of file + } +} diff --git a/workers/bte_lookup/templates/Chem-increases-Gene/Chem-IncreaseAnotherGeneThatUpregs-Gene.json b/workers/bte_lookup/templates/Chem-increases-Gene/Chem-IncreaseAnotherGeneThatUpregs-Gene.json index 6f3dd82..62d73ab 100644 --- a/workers/bte_lookup/templates/Chem-increases-Gene/Chem-IncreaseAnotherGeneThatUpregs-Gene.json +++ b/workers/bte_lookup/templates/Chem-increases-Gene/Chem-IncreaseAnotherGeneThatUpregs-Gene.json @@ -1,54 +1,54 @@ { - "message": { - "query_graph": { - "nodes": { - "sn": { - "categories":["biolink:ChemicalEntity"] - }, - "nA": { - "categories":["biolink:Gene", "biolink:Protein"], - "is_set": true - }, - "on": { - "categories":["biolink:Gene", "biolink:Protein"] - } - }, - "edges": { - "eA": { - "subject": "sn", - "object": "nA", - "predicates": ["biolink:affects"], - "qualifier_constraints": [ - { - "qualifier_set": [ - { - "qualifier_type_id": "biolink:object_direction_qualifier", - "qualifier_value": "increased" - }, - { - "qualifier_type_id": "biolink:object_aspect_qualifier", - "qualifier_value": "activity_or_abundance" - } - ] - } - ] - }, - "eB": { - "subject": "nA", - "object": "on", - "predicates": ["biolink:regulates"], - "qualifier_constraints": [ - { - "qualifier_set": [ - { - "qualifier_type_id": "biolink:object_direction_qualifier", - "qualifier_value": "upregulated" - } - ] - } - ] - } - } - } + "query_graph": { + "nodes": { + "$source": { + "ids": ["$source_id"], + "categories": ["biolink:ChemicalEntity"] + }, + "nA": { + "categories": ["biolink:Gene", "biolink:Protein"], + "is_set": true + }, + "$target": { + "ids": ["$target_id"], + "categories": ["biolink:Gene", "biolink:Protein"] + } + }, + "edges": { + "eA": { + "subject": "$source", + "object": "nA", + "predicates": ["biolink:affects"], + "qualifier_constraints": [ + { + "qualifier_set": [ + { + "qualifier_type_id": "biolink:object_direction_qualifier", + "qualifier_value": "increased" + }, + { + "qualifier_type_id": "biolink:object_aspect_qualifier", + "qualifier_value": "activity_or_abundance" + } + ] + } + ] + }, + "eB": { + "subject": "nA", + "object": "$target", + "predicates": ["biolink:regulates"], + "qualifier_constraints": [ + { + "qualifier_set": [ + { + "qualifier_type_id": "biolink:object_direction_qualifier", + "qualifier_value": "upregulated" + } + ] + } + ] + } } -} \ No newline at end of file + } +} diff --git a/workers/bte_lookup/templates/Chem-increases-Gene/Chem-increasesGene.json b/workers/bte_lookup/templates/Chem-increases-Gene/Chem-increasesGene.json index 6131e1a..fcac3a4 100644 --- a/workers/bte_lookup/templates/Chem-increases-Gene/Chem-increasesGene.json +++ b/workers/bte_lookup/templates/Chem-increases-Gene/Chem-increasesGene.json @@ -1,35 +1,35 @@ { - "message": { - "query_graph": { - "nodes": { - "sn": { - "categories":["biolink:ChemicalEntity"] - }, - "on": { - "categories":["biolink:Gene", "biolink:Protein"] - } - }, - "edges": { - "eA": { - "subject": "sn", - "object": "on", - "predicates": ["biolink:affects"], - "qualifier_constraints": [ - { - "qualifier_set": [ - { - "qualifier_type_id": "biolink:object_direction_qualifier", - "qualifier_value": "increased" - }, - { - "qualifier_type_id": "biolink:object_aspect_qualifier", - "qualifier_value": "activity_or_abundance" - } - ] - } - ] - } - } - } + "query_graph": { + "nodes": { + "$source": { + "ids": ["$source_id"], + "categories": ["biolink:ChemicalEntity"] + }, + "$target": { + "ids": ["$target_id"], + "categories": ["biolink:Gene", "biolink:Protein"] + } + }, + "edges": { + "eA": { + "subject": "$source", + "object": "$target", + "predicates": ["biolink:affects"], + "qualifier_constraints": [ + { + "qualifier_set": [ + { + "qualifier_type_id": "biolink:object_direction_qualifier", + "qualifier_value": "increased" + }, + { + "qualifier_type_id": "biolink:object_aspect_qualifier", + "qualifier_value": "activity_or_abundance" + } + ] + } + ] + } } -} \ No newline at end of file + } +} diff --git a/workers/bte_lookup/templates/Chem-increases-Gene/Chem-physically_interacts-GeneThatUpregs-Gene.json b/workers/bte_lookup/templates/Chem-increases-Gene/Chem-physically_interacts-GeneThatUpregs-Gene.json index 1c01673..122031f 100644 --- a/workers/bte_lookup/templates/Chem-increases-Gene/Chem-physically_interacts-GeneThatUpregs-Gene.json +++ b/workers/bte_lookup/templates/Chem-increases-Gene/Chem-physically_interacts-GeneThatUpregs-Gene.json @@ -1,40 +1,40 @@ { - "message": { - "query_graph": { - "nodes": { - "sn": { - "categories":["biolink:ChemicalEntity"] - }, - "nA": { - "categories":["biolink:Gene", "biolink:Protein"], - "is_set": true - }, - "on": { - "categories":["biolink:Gene", "biolink:Protein"] - } - }, - "edges": { - "eA": { - "subject": "sn", - "object": "nA", - "predicates": ["biolink:physically_interacts_with"] - }, - "eB": { - "subject": "nA", - "object": "on", - "predicates": ["biolink:regulates"], - "qualifier_constraints": [ - { - "qualifier_set": [ - { - "qualifier_type_id": "biolink:object_direction_qualifier", - "qualifier_value": "upregulated" - } - ] - } - ] - } - } - } + "query_graph": { + "nodes": { + "$source": { + "ids": ["$source_id"], + "categories": ["biolink:ChemicalEntity"] + }, + "nA": { + "categories": ["biolink:Gene", "biolink:Protein"], + "is_set": true + }, + "$target": { + "ids": ["$target_id"], + "categories": ["biolink:Gene", "biolink:Protein"] + } + }, + "edges": { + "eA": { + "subject": "$source", + "object": "nA", + "predicates": ["biolink:physically_interacts_with"] + }, + "eB": { + "subject": "nA", + "object": "$target", + "predicates": ["biolink:regulates"], + "qualifier_constraints": [ + { + "qualifier_set": [ + { + "qualifier_type_id": "biolink:object_direction_qualifier", + "qualifier_value": "upregulated" + } + ] + } + ] + } } -} \ No newline at end of file + } +} diff --git a/workers/bte_lookup/templates/Chem-increases-Gene/Chem-positively_correlated-Gene.json b/workers/bte_lookup/templates/Chem-increases-Gene/Chem-positively_correlated-Gene.json index a0f434d..e53b5e6 100644 --- a/workers/bte_lookup/templates/Chem-increases-Gene/Chem-positively_correlated-Gene.json +++ b/workers/bte_lookup/templates/Chem-increases-Gene/Chem-positively_correlated-Gene.json @@ -1,21 +1,21 @@ { - "message": { - "query_graph": { - "nodes": { - "sn": { - "categories":["biolink:ChemicalEntity"] - }, - "on": { - "categories":["biolink:Gene", "biolink:Protein"] - } - }, - "edges": { - "eA": { - "subject": "sn", - "object": "on", - "predicates": ["biolink:positively_correlated_with"] - } - } - } + "query_graph": { + "nodes": { + "$source": { + "ids": ["$source_id"], + "categories": ["biolink:ChemicalEntity"] + }, + "$target": { + "ids": ["$target_id"], + "categories": ["biolink:Gene", "biolink:Protein"] + } + }, + "edges": { + "eA": { + "subject": "$source", + "object": "$target", + "predicates": ["biolink:positively_correlated_with"] + } } -} \ No newline at end of file + } +} diff --git a/workers/bte_lookup/templates/Chem-physically_interacts-Gene.json b/workers/bte_lookup/templates/Chem-physically_interacts-Gene.json index e12f08f..51f8675 100644 --- a/workers/bte_lookup/templates/Chem-physically_interacts-Gene.json +++ b/workers/bte_lookup/templates/Chem-physically_interacts-Gene.json @@ -1,21 +1,21 @@ { - "message": { - "query_graph": { - "nodes": { - "sn": { - "categories":["biolink:ChemicalEntity"] - }, - "on": { - "categories":["biolink:Gene", "biolink:Protein"] - } - }, - "edges": { - "eA": { - "subject": "sn", - "object": "on", - "predicates": ["biolink:physically_interacts_with"] - } - } - } + "query_graph": { + "nodes": { + "$source": { + "ids": ["$source_id"], + "categories": ["biolink:ChemicalEntity"] + }, + "$target": { + "ids": ["$target_id"], + "categories": ["biolink:Gene", "biolink:Protein"] + } + }, + "edges": { + "eA": { + "subject": "$source", + "object": "$target", + "predicates": ["biolink:physically_interacts_with"] + } } -} \ No newline at end of file + } +} diff --git a/workers/bte_lookup/templates/Drug-treats-Disease/Chem-decreaseGeneWithFunctionGainIn-Disease.json b/workers/bte_lookup/templates/Drug-treats-Disease/Chem-decreaseGeneWithFunctionGainIn-Disease.json index 285a45f..e964a67 100644 --- a/workers/bte_lookup/templates/Drug-treats-Disease/Chem-decreaseGeneWithFunctionGainIn-Disease.json +++ b/workers/bte_lookup/templates/Drug-treats-Disease/Chem-decreaseGeneWithFunctionGainIn-Disease.json @@ -1,52 +1,52 @@ { - "message": { - "query_graph": { - "nodes": { - "sn": { - "categories":["biolink:ChemicalEntity"] - }, - "nA": { - "categories":["biolink:Gene"], - "is_set": true - }, - "on": { - "categories":["biolink:DiseaseOrPhenotypicFeature"] - } - }, - "edges": { - "eA": { - "subject": "sn", - "object": "nA", - "qualifier_constraints": [ - { - "qualifier_set": [ - { - "qualifier_type_id": "biolink:object_direction_qualifier", - "qualifier_value": "decreased" - }, - { - "qualifier_type_id": "biolink:object_aspect_qualifier", - "qualifier_value": "activity_or_abundance" - } - ] - } - ] - }, - "eB": { - "subject": "nA", - "object": "on", - "qualifier_constraints": [ - { - "qualifier_set": [ - { - "qualifier_type_id": "biolink:subject_form_or_variant_qualifier", - "qualifier_value": "gain_of_function_variant_form" - } - ] - } - ] - } - } - } + "query_graph": { + "nodes": { + "$source": { + "ids": ["$source_id"], + "categories": ["biolink:ChemicalEntity"] + }, + "nA": { + "categories": ["biolink:Gene"], + "is_set": true + }, + "$target": { + "ids": ["$target_id"], + "categories": ["biolink:DiseaseOrPhenotypicFeature"] + } + }, + "edges": { + "eA": { + "subject": "$source", + "object": "nA", + "qualifier_constraints": [ + { + "qualifier_set": [ + { + "qualifier_type_id": "biolink:object_direction_qualifier", + "qualifier_value": "decreased" + }, + { + "qualifier_type_id": "biolink:object_aspect_qualifier", + "qualifier_value": "activity_or_abundance" + } + ] + } + ] + }, + "eB": { + "subject": "nA", + "object": "$target", + "qualifier_constraints": [ + { + "qualifier_set": [ + { + "qualifier_type_id": "biolink:subject_form_or_variant_qualifier", + "qualifier_value": "gain_of_function_variant_form" + } + ] + } + ] + } } -} \ No newline at end of file + } +} diff --git a/workers/bte_lookup/templates/Drug-treats-Disease/Chem-increaseGeneWithFunctionLossIn-Disease.json b/workers/bte_lookup/templates/Drug-treats-Disease/Chem-increaseGeneWithFunctionLossIn-Disease.json index 50e2452..bde9437 100644 --- a/workers/bte_lookup/templates/Drug-treats-Disease/Chem-increaseGeneWithFunctionLossIn-Disease.json +++ b/workers/bte_lookup/templates/Drug-treats-Disease/Chem-increaseGeneWithFunctionLossIn-Disease.json @@ -1,52 +1,52 @@ { - "message": { - "query_graph": { - "nodes": { - "sn": { - "categories":["biolink:ChemicalEntity"] - }, - "nA": { - "categories":["biolink:Gene"], - "is_set": true - }, - "on": { - "categories":["biolink:DiseaseOrPhenotypicFeature"] - } - }, - "edges": { - "eA": { - "subject": "sn", - "object": "nA", - "qualifier_constraints": [ - { - "qualifier_set": [ - { - "qualifier_type_id": "biolink:object_direction_qualifier", - "qualifier_value": "increased" - }, - { - "qualifier_type_id": "biolink:object_aspect_qualifier", - "qualifier_value": "activity_or_abundance" - } - ] - } - ] - }, - "eB": { - "subject": "nA", - "object": "on", - "qualifier_constraints": [ - { - "qualifier_set": [ - { - "qualifier_type_id": "biolink:subject_form_or_variant_qualifier", - "qualifier_value": "loss_of_function_variant_form" - } - ] - } - ] - } - } - } + "query_graph": { + "nodes": { + "$source": { + "ids": ["$source_id"], + "categories": ["biolink:ChemicalEntity"] + }, + "nA": { + "categories": ["biolink:Gene"], + "is_set": true + }, + "$target": { + "ids": ["$target_id"], + "categories": ["biolink:DiseaseOrPhenotypicFeature"] + } + }, + "edges": { + "eA": { + "subject": "$source", + "object": "nA", + "qualifier_constraints": [ + { + "qualifier_set": [ + { + "qualifier_type_id": "biolink:object_direction_qualifier", + "qualifier_value": "increased" + }, + { + "qualifier_type_id": "biolink:object_aspect_qualifier", + "qualifier_value": "activity_or_abundance" + } + ] + } + ] + }, + "eB": { + "subject": "nA", + "object": "$target", + "qualifier_constraints": [ + { + "qualifier_set": [ + { + "qualifier_type_id": "biolink:subject_form_or_variant_qualifier", + "qualifier_value": "loss_of_function_variant_form" + } + ] + } + ] + } } -} \ No newline at end of file + } +} diff --git a/workers/bte_lookup/templates/Drug-treats-Disease/Chem-interacts,correlated,associated-Gene-biomarker,associated_condition-DoP.json b/workers/bte_lookup/templates/Drug-treats-Disease/Chem-interacts,correlated,associated-Gene-biomarker,associated_condition-DoP.json index f442547..9f9e3da 100644 --- a/workers/bte_lookup/templates/Drug-treats-Disease/Chem-interacts,correlated,associated-Gene-biomarker,associated_condition-DoP.json +++ b/workers/bte_lookup/templates/Drug-treats-Disease/Chem-interacts,correlated,associated-Gene-biomarker,associated_condition-DoP.json @@ -1,33 +1,37 @@ { - "message": { - "query_graph": { - "nodes": { - "sn": { - "categories":["biolink:ChemicalEntity"] - }, - "nA": { - "categories":["biolink:Gene"], - "is_set": true - }, - "on": { - "categories":["biolink:DiseaseOrPhenotypicFeature"] - } - }, - "edges": { - "eA": { - "subject": "sn", - "object": "nA", - "predicates": ["biolink:physically_interacts_with", "biolink:correlated_with", "biolink:associated_with"] - }, - "eB": { - "subject": "nA", - "object": "on", - "predicates": [ - "biolink:gene_associated_with_condition", - "biolink:biomarker_for" - ] - } - } - } + "query_graph": { + "nodes": { + "$source": { + "ids": ["$source_id"], + "categories": ["biolink:ChemicalEntity"] + }, + "nA": { + "categories": ["biolink:Gene"], + "is_set": true + }, + "$target": { + "ids": ["$target_id"], + "categories": ["biolink:DiseaseOrPhenotypicFeature"] + } + }, + "edges": { + "eA": { + "subject": "$source", + "object": "nA", + "predicates": [ + "biolink:physically_interacts_with", + "biolink:correlated_with", + "biolink:associated_with" + ] + }, + "eB": { + "subject": "nA", + "object": "$target", + "predicates": [ + "biolink:gene_associated_with_condition", + "biolink:biomarker_for" + ] + } } -} \ No newline at end of file + } +} diff --git a/workers/bte_lookup/templates/Drug-treats-Disease/Chem-regulates,affects-Gene-biomarker,associated_condition-DoP.json b/workers/bte_lookup/templates/Drug-treats-Disease/Chem-regulates,affects-Gene-biomarker,associated_condition-DoP.json index 44e585e..5924f2e 100644 --- a/workers/bte_lookup/templates/Drug-treats-Disease/Chem-regulates,affects-Gene-biomarker,associated_condition-DoP.json +++ b/workers/bte_lookup/templates/Drug-treats-Disease/Chem-regulates,affects-Gene-biomarker,associated_condition-DoP.json @@ -1,33 +1,33 @@ { - "message": { - "query_graph": { - "nodes": { - "sn": { - "categories":["biolink:ChemicalEntity"] - }, - "nA": { - "categories":["biolink:Gene"], - "is_set": true - }, - "on": { - "categories":["biolink:DiseaseOrPhenotypicFeature"] - } - }, - "edges": { - "eA": { - "subject": "sn", - "object": "nA", - "predicates": ["biolink:regulates", "biolink:affects"] - }, - "eB": { - "subject": "nA", - "object": "on", - "predicates": [ - "biolink:gene_associated_with_condition", - "biolink:biomarker_for" - ] - } - } - } + "query_graph": { + "nodes": { + "$source": { + "ids": ["$source_id"], + "categories": ["biolink:ChemicalEntity"] + }, + "nA": { + "categories": ["biolink:Gene"], + "is_set": true + }, + "$target": { + "ids": ["$target_id"], + "categories": ["biolink:DiseaseOrPhenotypicFeature"] + } + }, + "edges": { + "eA": { + "subject": "$source", + "object": "nA", + "predicates": ["biolink:regulates", "biolink:affects"] + }, + "eB": { + "subject": "nA", + "object": "$target", + "predicates": [ + "biolink:gene_associated_with_condition", + "biolink:biomarker_for" + ] + } } -} \ No newline at end of file + } +} diff --git a/workers/bte_lookup/templates/Drug-treats-Disease/Chem-regulates,affects-Gene-cause,contribute,affects-DoP.json b/workers/bte_lookup/templates/Drug-treats-Disease/Chem-regulates,affects-Gene-cause,contribute,affects-DoP.json index 79bff8b..7dd5941 100644 --- a/workers/bte_lookup/templates/Drug-treats-Disease/Chem-regulates,affects-Gene-cause,contribute,affects-DoP.json +++ b/workers/bte_lookup/templates/Drug-treats-Disease/Chem-regulates,affects-Gene-cause,contribute,affects-DoP.json @@ -1,34 +1,34 @@ { - "message": { - "query_graph": { - "nodes": { - "sn": { - "categories":["biolink:ChemicalEntity"] - }, - "nA": { - "categories":["biolink:Gene"], - "is_set": true - }, - "on": { - "categories":["biolink:DiseaseOrPhenotypicFeature"] - } - }, - "edges": { - "eA": { - "subject": "sn", - "object": "nA", - "predicates": ["biolink:regulates", "biolink:affects"] - }, - "eB": { - "subject": "nA", - "object": "on", - "predicates": [ - "biolink:affects", - "biolink:causes", - "biolink:contributes_to" - ] - } - } - } + "query_graph": { + "nodes": { + "$source": { + "ids": ["$source_id"], + "categories": ["biolink:ChemicalEntity"] + }, + "nA": { + "categories": ["biolink:Gene"], + "is_set": true + }, + "$target": { + "ids": ["$target_id"], + "categories": ["biolink:DiseaseOrPhenotypicFeature"] + } + }, + "edges": { + "eA": { + "subject": "$source", + "object": "nA", + "predicates": ["biolink:regulates", "biolink:affects"] + }, + "eB": { + "subject": "nA", + "object": "$target", + "predicates": [ + "biolink:affects", + "biolink:causes", + "biolink:contributes_to" + ] + } } -} \ No newline at end of file + } +} diff --git a/workers/bte_lookup/templates/Drug-treats-Disease/Chem-treats-DoP-causes,part-DoP.json b/workers/bte_lookup/templates/Drug-treats-Disease/Chem-treats-DoP-causes,part-DoP.json index 27b1fcf..a08ce90 100644 --- a/workers/bte_lookup/templates/Drug-treats-Disease/Chem-treats-DoP-causes,part-DoP.json +++ b/workers/bte_lookup/templates/Drug-treats-Disease/Chem-treats-DoP-causes,part-DoP.json @@ -1,33 +1,30 @@ { - "message": { - "query_graph": { - "nodes": { - "sn": { - "categories":["biolink:ChemicalEntity"] - }, - "nA": { - "categories":["biolink:DiseaseOrPhenotypicFeature"], - "is_set": true - }, - "on": { - "categories":["biolink:DiseaseOrPhenotypicFeature"] - } - }, - "edges": { - "eA": { - "subject": "sn", - "object": "nA", - "predicates": ["biolink:treats"] - }, - "eB": { - "subject": "nA", - "object": "on", - "predicates": [ - "biolink:part_of", - "biolink:causes" - ] - } - } - } + "query_graph": { + "nodes": { + "$source": { + "ids": ["$source_id"], + "categories": ["biolink:ChemicalEntity"] + }, + "nA": { + "categories": ["biolink:DiseaseOrPhenotypicFeature"], + "is_set": true + }, + "$target": { + "ids": ["$target_id"], + "categories": ["biolink:DiseaseOrPhenotypicFeature"] + } + }, + "edges": { + "eA": { + "subject": "$source", + "object": "nA", + "predicates": ["biolink:treats"] + }, + "eB": { + "subject": "nA", + "object": "$target", + "predicates": ["biolink:part_of", "biolink:causes"] + } } -} \ No newline at end of file + } +} diff --git a/workers/bte_lookup/templates/Drug-treats-Disease/Chem-treats-DoP-similar,part-DoP.json b/workers/bte_lookup/templates/Drug-treats-Disease/Chem-treats-DoP-similar,part-DoP.json index 9087f61..57ed1f2 100644 --- a/workers/bte_lookup/templates/Drug-treats-Disease/Chem-treats-DoP-similar,part-DoP.json +++ b/workers/bte_lookup/templates/Drug-treats-Disease/Chem-treats-DoP-similar,part-DoP.json @@ -1,33 +1,30 @@ { - "message": { - "query_graph": { - "nodes": { - "sn": { - "categories":["biolink:ChemicalEntity"] - }, - "nA": { - "categories":["biolink:DiseaseOrPhenotypicFeature"], - "is_set": true - }, - "on": { - "categories":["biolink:DiseaseOrPhenotypicFeature"] - } - }, - "edges": { - "eA": { - "subject": "sn", - "object": "nA", - "predicates": ["biolink:treats"] - }, - "eB": { - "subject": "on", - "object": "nA", - "predicates": [ - "biolink:similar_to", - "biolink:has_part" - ] - } - } - } + "query_graph": { + "nodes": { + "$source": { + "ids": ["$source_id"], + "categories": ["biolink:ChemicalEntity"] + }, + "nA": { + "categories": ["biolink:DiseaseOrPhenotypicFeature"], + "is_set": true + }, + "$target": { + "ids": ["$target_id"], + "categories": ["biolink:DiseaseOrPhenotypicFeature"] + } + }, + "edges": { + "eA": { + "subject": "$source", + "object": "nA", + "predicates": ["biolink:treats"] + }, + "eB": { + "subject": "$target", + "object": "nA", + "predicates": ["biolink:similar_to", "biolink:has_part"] + } } -} \ No newline at end of file + } +} diff --git a/workers/bte_lookup/templates/Drug-treats-Disease/Chem-treats-DoP.json b/workers/bte_lookup/templates/Drug-treats-Disease/Chem-treats-DoP.json index f0e746a..122d749 100644 --- a/workers/bte_lookup/templates/Drug-treats-Disease/Chem-treats-DoP.json +++ b/workers/bte_lookup/templates/Drug-treats-Disease/Chem-treats-DoP.json @@ -1,21 +1,21 @@ { - "message": { - "query_graph": { - "nodes": { - "sn": { - "categories":["biolink:ChemicalEntity"] - }, - "on": { - "categories":["biolink:DiseaseOrPhenotypicFeature"] - } - }, - "edges": { - "eA": { - "subject": "sn", - "object": "on", - "predicates": ["biolink:treats_or_applied_or_studied_to_treat"] - } - } - } + "query_graph": { + "nodes": { + "$source": { + "ids": ["$source_id"], + "categories": ["biolink:ChemicalEntity"] + }, + "$target": { + "ids": ["$target_id"], + "categories": ["biolink:DiseaseOrPhenotypicFeature"] + } + }, + "edges": { + "eA": { + "subject": "$source", + "object": "$target", + "predicates": ["biolink:treats_or_applied_or_studied_to_treat"] + } } -} \ No newline at end of file + } +} diff --git a/workers/bte_lookup/templates/Drug-treats-Disease/Chem-treats-PhenoOfDisease.json b/workers/bte_lookup/templates/Drug-treats-Disease/Chem-treats-PhenoOfDisease.json index a1b6fd7..f401daa 100644 --- a/workers/bte_lookup/templates/Drug-treats-Disease/Chem-treats-PhenoOfDisease.json +++ b/workers/bte_lookup/templates/Drug-treats-Disease/Chem-treats-PhenoOfDisease.json @@ -1,30 +1,30 @@ { - "message": { - "query_graph": { - "nodes": { - "sn": { - "categories":["biolink:ChemicalEntity"] - }, - "nA": { - "categories":["biolink:PhenotypicFeature"], - "is_set": true - }, - "on": { - "categories":["biolink:DiseaseOrPhenotypicFeature"] - } - }, - "edges": { - "eA": { - "subject": "sn", - "object": "nA", - "predicates": ["biolink:treats_or_applied_or_studied_to_treat"] - }, - "eB": { - "subject": "on", - "object": "nA", - "predicates": ["biolink:has_phenotype"] - } - } - } + "query_graph": { + "nodes": { + "$source": { + "ids": ["$source_id"], + "categories": ["biolink:ChemicalEntity"] + }, + "nA": { + "categories": ["biolink:PhenotypicFeature"], + "is_set": true + }, + "$target": { + "ids": ["$target_id"], + "categories": ["biolink:DiseaseOrPhenotypicFeature"] + } + }, + "edges": { + "eA": { + "subject": "$source", + "object": "nA", + "predicates": ["biolink:treats_or_applied_or_studied_to_treat"] + }, + "eB": { + "subject": "$target", + "object": "nA", + "predicates": ["biolink:has_phenotype"] + } } -} \ No newline at end of file + } +} diff --git a/workers/bte_lookup/templates/Drug-treats-Disease/ChemDecreasesLikelihood-Disease.json b/workers/bte_lookup/templates/Drug-treats-Disease/ChemDecreasesLikelihood-Disease.json index 36e6da7..e6f1d14 100644 --- a/workers/bte_lookup/templates/Drug-treats-Disease/ChemDecreasesLikelihood-Disease.json +++ b/workers/bte_lookup/templates/Drug-treats-Disease/ChemDecreasesLikelihood-Disease.json @@ -1,35 +1,34 @@ { - "message": { - "query_graph": { - "nodes": { - "sn": { - "categories": - ["ChemicalEntity"] - }, - "on": { - "categories":["biolink:DiseaseOrPhenotypicFeature"] - } - }, - "edges": { - "eA": { - "subject": "sn", - "object": "on", - "qualifier_constraints": [ - { - "qualifier_set": [ - { - "qualifier_type_id": "biolink:object_direction_qualifier", - "qualifier_value": "decreased" - }, - { - "qualifier_type_id": "biolink:object_aspect_qualifier", - "qualifier_value": "likelihood" - } - ] - } - ] - } - } - } + "query_graph": { + "nodes": { + "$source": { + "ids": ["$source_id"], + "categories": ["ChemicalEntity"] + }, + "$target": { + "ids": ["$target_id"], + "categories": ["biolink:DiseaseOrPhenotypicFeature"] + } + }, + "edges": { + "eA": { + "subject": "$source", + "object": "$target", + "qualifier_constraints": [ + { + "qualifier_set": [ + { + "qualifier_type_id": "biolink:object_direction_qualifier", + "qualifier_value": "decreased" + }, + { + "qualifier_type_id": "biolink:object_aspect_qualifier", + "qualifier_value": "likelihood" + } + ] + } + ] + } } -} \ No newline at end of file + } +} diff --git a/workers/bte_lookup/templates/NonChem-treats-Disease/NonChem-treats-DoP.json b/workers/bte_lookup/templates/NonChem-treats-Disease/NonChem-treats-DoP.json index f351c6b..30928b6 100644 --- a/workers/bte_lookup/templates/NonChem-treats-Disease/NonChem-treats-DoP.json +++ b/workers/bte_lookup/templates/NonChem-treats-Disease/NonChem-treats-DoP.json @@ -1,22 +1,25 @@ { - "message": { - "query_graph": { - "nodes": { - "sn": { - "categories": - ["biolink:Procedure", "biolink:Treatment", "biolink:ClinicalIntervention"] - }, - "on": { - "categories":["biolink:DiseaseOrPhenotypicFeature"] - } - }, - "edges": { - "eA": { - "subject": "sn", - "object": "on", - "predicates": ["biolink:treats"] - } - } - } + "query_graph": { + "nodes": { + "$source": { + "ids": ["$source_id"], + "categories": [ + "biolink:Procedure", + "biolink:Treatment", + "biolink:ClinicalIntervention" + ] + }, + "$target": { + "ids": ["$target_id"], + "categories": ["biolink:DiseaseOrPhenotypicFeature"] + } + }, + "edges": { + "eA": { + "subject": "$source", + "object": "$target", + "predicates": ["biolink:treats"] + } } -} \ No newline at end of file + } +} diff --git a/workers/bte_lookup/templates/NonChem-treats-Disease/Procedure-decreasesLikelihood-Disease.json b/workers/bte_lookup/templates/NonChem-treats-Disease/Procedure-decreasesLikelihood-Disease.json index ad8796a..466f122 100644 --- a/workers/bte_lookup/templates/NonChem-treats-Disease/Procedure-decreasesLikelihood-Disease.json +++ b/workers/bte_lookup/templates/NonChem-treats-Disease/Procedure-decreasesLikelihood-Disease.json @@ -1,35 +1,34 @@ { - "message": { - "query_graph": { - "nodes": { - "sn": { - "categories": - ["Procedure"] - }, - "on": { - "categories":["biolink:DiseaseOrPhenotypicFeature"] - } - }, - "edges": { - "eA": { - "subject": "sn", - "object": "on", - "qualifier_constraints": [ - { - "qualifier_set": [ - { - "qualifier_type_id": "biolink:object_direction_qualifier", - "qualifier_value": "decreased" - }, - { - "qualifier_type_id": "biolink:object_aspect_qualifier", - "qualifier_value": "likelihood" - } - ] - } - ] - } - } - } + "query_graph": { + "nodes": { + "$source": { + "ids": ["$source_id"], + "categories": ["Procedure"] + }, + "$target": { + "ids": ["$target_id"], + "categories": ["biolink:DiseaseOrPhenotypicFeature"] + } + }, + "edges": { + "eA": { + "subject": "$source", + "object": "$target", + "qualifier_constraints": [ + { + "qualifier_set": [ + { + "qualifier_type_id": "biolink:object_direction_qualifier", + "qualifier_value": "decreased" + }, + { + "qualifier_type_id": "biolink:object_aspect_qualifier", + "qualifier_value": "likelihood" + } + ] + } + ] + } } -} \ No newline at end of file + } +} diff --git a/workers/bte_lookup/templates/NonChem-treats-Disease/Treatment-related_to-DoP.json b/workers/bte_lookup/templates/NonChem-treats-Disease/Treatment-related_to-DoP.json index 726dc06..b9863f4 100644 --- a/workers/bte_lookup/templates/NonChem-treats-Disease/Treatment-related_to-DoP.json +++ b/workers/bte_lookup/templates/NonChem-treats-Disease/Treatment-related_to-DoP.json @@ -1,21 +1,21 @@ { - "message": { - "query_graph": { - "nodes": { - "sn": { - "categories":["biolink:Treatment"] - }, - "on": { - "categories":["biolink:DiseaseOrPhenotypicFeature"] - } - }, - "edges": { - "eA": { - "subject": "sn", - "object": "on", - "predicates": ["biolink:related_to"] - } - } - } + "query_graph": { + "nodes": { + "$source": { + "ids": ["$source_id"], + "categories": ["biolink:Treatment"] + }, + "$target": { + "ids": ["$target_id"], + "categories": ["biolink:DiseaseOrPhenotypicFeature"] + } + }, + "edges": { + "eA": { + "subject": "$source", + "object": "$target", + "predicates": ["biolink:related_to"] + } } -} \ No newline at end of file + } +} diff --git a/workers/bte_lookup/templates/less-promising/m3-Disease-SeqVar-Gene-Chem.json b/workers/bte_lookup/templates/less-promising/m3-Disease-SeqVar-Gene-Chem.json index 90b46d1..82dcc53 100644 --- a/workers/bte_lookup/templates/less-promising/m3-Disease-SeqVar-Gene-Chem.json +++ b/workers/bte_lookup/templates/less-promising/m3-Disease-SeqVar-Gene-Chem.json @@ -1,37 +1,37 @@ { - "message": { - "query_graph": { - "nodes": { - "on": { - "categories":["biolink:Disease"] - }, - "nA": { - "categories":["biolink:SequenceVariant"], - "is_set": true - }, - "nB": { - "categories":["biolink:Gene"], - "is_set": true - }, - "sn": { - "categories":["biolink:ChemicalEntity"] - } - }, - "edges": { - "eA": { - "subject": "on", - "object": "nA" - }, - "eB": { - "subject": "nA", - "object": "nB" - }, - "eC": { - "subject": "nB", - "object": "sn", - "predicates": ["biolink:regulated_by", "biolink:affected_by"] - } - } - } + "query_graph": { + "nodes": { + "$target": { + "ids": ["$target_id"], + "categories": ["biolink:Disease"] + }, + "nA": { + "categories": ["biolink:SequenceVariant"], + "is_set": true + }, + "nB": { + "categories": ["biolink:Gene"], + "is_set": true + }, + "$source": { + "ids": ["$source_id"], + "categories": ["biolink:ChemicalEntity"] + } + }, + "edges": { + "eA": { + "subject": "$target", + "object": "nA" + }, + "eB": { + "subject": "nA", + "object": "nB" + }, + "eC": { + "subject": "nB", + "object": "$source", + "predicates": ["biolink:regulated_by", "biolink:affected_by"] + } } -} \ No newline at end of file + } +} diff --git a/workers/bte_lookup/templates/less-promising/m5-Disease-Pheno-Gene-Chem.json b/workers/bte_lookup/templates/less-promising/m5-Disease-Pheno-Gene-Chem.json index a9ff676..a937f1b 100644 --- a/workers/bte_lookup/templates/less-promising/m5-Disease-Pheno-Gene-Chem.json +++ b/workers/bte_lookup/templates/less-promising/m5-Disease-Pheno-Gene-Chem.json @@ -1,39 +1,39 @@ { - "message": { - "query_graph": { - "nodes": { - "on": { - "categories":["biolink:Disease"] - }, - "nA": { - "categories":["biolink:PhenotypicFeature"], - "is_set": true - }, - "nB": { - "categories":["biolink:Gene"], - "is_set": true - }, - "sn": { - "categories":["biolink:ChemicalEntity"] - } - }, - "edges": { - "eA": { - "subject": "on", - "object": "nA", - "predicates": ["biolink:has_phenotype"] - }, - "eB": { - "subject": "nA", - "object": "nB", - "predicates": ["biolink:regulated_by", "biolink:affected_by"] - }, - "eC": { - "subject": "nB", - "object": "sn", - "predicates": ["biolink:regulated_by", "biolink:affected_by"] - } - } - } + "query_graph": { + "nodes": { + "$target": { + "ids": ["$target_id"], + "categories": ["biolink:Disease"] + }, + "nA": { + "categories": ["biolink:PhenotypicFeature"], + "is_set": true + }, + "nB": { + "categories": ["biolink:Gene"], + "is_set": true + }, + "$source": { + "ids": ["$source_id"], + "categories": ["biolink:ChemicalEntity"] + } + }, + "edges": { + "eA": { + "subject": "$target", + "object": "nA", + "predicates": ["biolink:has_phenotype"] + }, + "eB": { + "subject": "nA", + "object": "nB", + "predicates": ["biolink:regulated_by", "biolink:affected_by"] + }, + "eC": { + "subject": "nB", + "object": "$source", + "predicates": ["biolink:regulated_by", "biolink:affected_by"] + } } -} \ No newline at end of file + } +} diff --git a/workers/bte_lookup/templates/less-promising/m6-Disease-Gene-Gene-Chem.json b/workers/bte_lookup/templates/less-promising/m6-Disease-Gene-Gene-Chem.json index 012b177..4fb0e3b 100644 --- a/workers/bte_lookup/templates/less-promising/m6-Disease-Gene-Gene-Chem.json +++ b/workers/bte_lookup/templates/less-promising/m6-Disease-Gene-Gene-Chem.json @@ -1,39 +1,39 @@ { - "message": { - "query_graph": { - "nodes": { - "on": { - "categories":["biolink:Disease"] - }, - "nA": { - "categories":["biolink:Gene"], - "is_set": true - }, - "nB": { - "categories":["biolink:Gene"], - "is_set": true - }, - "sn": { - "categories":["biolink:ChemicalEntity"] - } - }, - "edges": { - "eA": { - "subject": "on", - "object": "nA", - "predicates": ["biolink:caused_by"] - }, - "eB": { - "subject": "nA", - "object": "nB", - "predicates": ["biolink:physically_interacts_with"] - }, - "eC": { - "subject": "nB", - "object": "sn", - "predicates": ["biolink:regulated_by", "biolink:affected_by"] - } - } - } + "query_graph": { + "nodes": { + "$target": { + "ids": ["$target_id"], + "categories": ["biolink:Disease"] + }, + "nA": { + "categories": ["biolink:Gene"], + "is_set": true + }, + "nB": { + "categories": ["biolink:Gene"], + "is_set": true + }, + "$source": { + "ids": ["$source_id"], + "categories": ["biolink:ChemicalEntity"] + } + }, + "edges": { + "eA": { + "subject": "$target", + "object": "nA", + "predicates": ["biolink:caused_by"] + }, + "eB": { + "subject": "nA", + "object": "nB", + "predicates": ["biolink:physically_interacts_with"] + }, + "eC": { + "subject": "nB", + "object": "$source", + "predicates": ["biolink:regulated_by", "biolink:affected_by"] + } } -} \ No newline at end of file + } +} diff --git a/workers/bte_lookup/worker.py b/workers/bte_lookup/worker.py index 1572d63..2abff22 100644 --- a/workers/bte_lookup/worker.py +++ b/workers/bte_lookup/worker.py @@ -6,6 +6,7 @@ import time import uuid from pathlib import Path +from string import Template from typing import Any, Dict, Optional import httpx @@ -186,6 +187,8 @@ def get_params( Optional[str], Optional[str], Optional[str], + Optional[str], + Optional[str], dict[str, str], ]: """Obtain some important parameters from the query graph.""" @@ -211,8 +214,10 @@ def get_params( } return ( + edge["subject"], subject_type, subject_curie, + edge["object"], object_type, object_curie, predicate, @@ -273,20 +278,44 @@ def match_templates( def fill_templates( paths: list[Path], query_body: Dict, + subject_key: Optional[str], subject_curie: Optional[str], + object_key: Optional[str], object_curie: Optional[str], ) -> list[Dict]: filled_templates: list[Dict] = [] for path in paths: - with open(path, "r") as file: - template = json.load(file) - if subject_curie is not None: - template["message"]["query_graph"]["nodes"]["sn"]["ids"] = [subject_curie] - if object_curie is not None: - template["message"]["query_graph"]["nodes"]["on"]["ids"] = [object_curie] - filled_templates.append(template) - if query_body.get("log_level") is not None: - template["log_level"] = query_body["log_level"] + with open(path, "r", encoding="utf-8") as file: + template = Template(file.read()) + if subject_curie: + qs = template.substitute( + source=subject_key, + target=object_key, + source_id=subject_curie, + target_id="", + ) + else: + qs = template.substitute( + source=subject_key, + target=object_key, + target_id=object_curie, + source_id="", + ) + query = json.loads(qs) + if subject_curie: + del query["query_graph"]["nodes"][object_key]["ids"] + else: + del query["query_graph"]["nodes"][subject_key]["ids"] + message = { + "message": query, + "parameters": query_body.get("parameters") or {}, + } + if "log_level" in query_body: + message["log_level"] = query_body["log_level"] + if message["message"].get("knowledge_graph") is not None: + del message["message"]["knowledge_graph"] + message["workflow"] = [{"id": "lookup"}] + filled_templates.append(message) return filled_templates @@ -302,9 +331,16 @@ def expand_bte_query(query_dict: dict[str, Any], logger: logging.Logger) -> list query_graph = query_dict["message"].get("query_graph") if query_graph is None: return [] - subject_type, subject_curie, object_type, object_curie, predicate, qualifiers = ( - get_params(query_graph) - ) + ( + subject_key, + subject_type, + subject_curie, + object_key, + object_type, + object_curie, + predicate, + qualifiers, + ) = get_params(query_graph) matched_template_paths = match_templates( subject_type, @@ -314,19 +350,16 @@ def expand_bte_query(query_dict: dict[str, Any], logger: logging.Logger) -> list logger, ) - templates = fill_templates( - matched_template_paths, query_dict, subject_curie, object_curie + filled_templates = fill_templates( + matched_template_paths, + query_dict, + subject_key, + subject_curie, + object_key, + object_curie, ) - final_templates = [] - - for template in templates: - if template["message"].get("knowledge_graph") is not None: - del template["message"]["knowledge_graph"] - template["workflow"] = [{"id": "lookup"}] - final_templates.append(template) - - return final_templates + return filled_templates async def process_task(task, parent_ctx, logger, limiter):