Skip to content

Commit

Permalink
Merge pull request #6 from TranslatorSRI/pqfix
Browse files Browse the repository at this point in the history
fixes a bug in pq_int
  • Loading branch information
cbizon authored Dec 18, 2023
2 parents f145b6d + 4f27f6d commit 0edf2ec
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/descender.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ def create_pq_to_descendant_int_ids(self,rc):
# Create a dictionary from pq to all of its descendant integer ids
# First, pull the integer id for every pq
pql = list(self.pq_to_descendants.keys())
pq_iids = rc.pipeline_gets(3, pql, True).values()
pq_int_ids = {pq:iid for pq,iid in zip(pql, pq_iids)}
pq_int_ids = rc.pipeline_gets(3, pql, True)
# now convert pq_to_descendants into int id values
pq_to_descendant_int_ids = {}
for pq in self.pq_to_descendants:
Expand Down
46 changes: 46 additions & 0 deletions tests/test_trapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,52 @@ def test_profile_asthma():
response = client.post("/query", json= query_graph).json()
print("How many results?",len(response["message"]["results"]))

def test_affects():
m = {
"message": {
"query_graph": {
"nodes": {
"subnode": {
"ids": [
"PUBCHEM.COMPOUND:70701426"
]
},
"objnode": {
"categories": [
"biolink:Gene"
]
}
},
"edges": {
"the_edge": {
"subject": "subnode",
"object": "objnode",
"predicates": [
"biolink:affects"
],
"qualifier_constraints": [
{
"qualifier_set": [
{
"qualifier_type_id": "biolink:object_aspect_qualifier",
"qualifier_value": "activity"
},
{
"qualifier_type_id": "biolink:object_direction_qualifier",
"qualifier_value": "decreased"
}
]
}
]
}
}
}
}
}
response = client.post("/query", json=m)
print("How many results?",len(response.json()["message"]["results"]))
assert response.status_code == 200

def test_500():
# This is giving a 500, seems like it's getting into the double ended query by mistake.
m = {
Expand Down

0 comments on commit 0edf2ec

Please sign in to comment.