Skip to content

Commit

Permalink
fix a bug in test_ARAXRanker again
Browse files Browse the repository at this point in the history
  • Loading branch information
chunyuma committed Aug 27, 2024
1 parent 7cda139 commit 87b802b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 8 additions & 1 deletion code/ARAX/ARAXQuery/Infer/scripts/infer_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,14 @@ def __init__(self):
self.bh = BiolinkHelper()

def __get_formated_edge_key(self, edge: Edge, primary_knowledge_source: str, kp: str = 'infores:rtx-kg2') -> str:
return f"{kp}:{edge.subject}-{edge.predicate}-{edge.object}-{primary_knowledge_source}"
qualifiers_dict = {qualifier.qualifier_type_id: qualifier.qualifier_value for qualifier in edge.qualifiers} if edge.qualifiers else dict()
qualified_predicate = qualifiers_dict.get("biolink:qualified_predicate")
qualified_object_direction = qualifiers_dict.get("biolink:object_direction_qualifier")
qualified_object_aspect = qualifiers_dict.get("biolink:object_aspect_qualifier")
qualified_portion = f"{qualified_predicate}--{qualified_object_direction}--{qualified_object_aspect}"
edge_key = f"{kp}:{edge.subject}--{edge.predicate}--{qualified_portion}--{edge.object}--{primary_knowledge_source}"

return edge_key

def __none_to_zero(self, val):
if val is None:
Expand Down
8 changes: 2 additions & 6 deletions code/ARAX/test/test_ARAX_ranker.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,8 @@ def test_ARAXRanker_test5_asset70():
break
total_results = len(message.results)

# # comment out this until the full build of xDTD
# assert rank_right_answer != -1
# assert (rank_right_answer < 0.1 * total_results) or (rank_right_answer < 0.3 * total_results)
assert rank_right_answer != -1
assert (rank_right_answer < 0.1 * total_results) or (rank_right_answer < 0.3 * total_results)

def test_ARAXRanker_test6_asset72():
# test 'Lomitapide treats Homozygous Familial Hypercholesterolemia'
Expand Down Expand Up @@ -324,7 +323,6 @@ def test_ARAXRanker_test9_asset614():
assert (rank_right_answer < 0.1 * total_results) or (rank_right_answer < 0.3 * total_results)


@pytest.mark.skip(reason="Skipping test_ARAXRanker_test9_asset615() because the probablity < 0.8, thus not included in the xDTD database")
def test_ARAXRanker_test9_asset619():
# test 'lansoprazole treats Gastroesophageal Reflux Disease'
expected_answer = 'lansoprazole'
Expand Down Expand Up @@ -384,8 +382,6 @@ def test_ARAXRanker_test9_asset619():
assert rank_right_answer != -1
assert (rank_right_answer < 0.1 * total_results) or (rank_right_answer < 0.3 * total_results)


@pytest.mark.skip(reason="Skipping test_ARAXRanker_test9_asset615() because the probablity < 0.8, thus not included in the xDTD database")
def test_ARAXRanker_test9_asset623():
# test 'rabeprazole treats Gastroesophageal Reflux Disease'
expected_answer = 'rabeprazole'
Expand Down

0 comments on commit 87b802b

Please sign in to comment.