diff --git a/code/ARAX/ARAXQuery/Infer/scripts/infer_utilities.py b/code/ARAX/ARAXQuery/Infer/scripts/infer_utilities.py index 8089b68ba..fe92d4376 100644 --- a/code/ARAX/ARAXQuery/Infer/scripts/infer_utilities.py +++ b/code/ARAX/ARAXQuery/Infer/scripts/infer_utilities.py @@ -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: diff --git a/code/ARAX/test/test_ARAX_ranker.py b/code/ARAX/test/test_ARAX_ranker.py index 7b6fa4b9a..4c95af79c 100644 --- a/code/ARAX/test/test_ARAX_ranker.py +++ b/code/ARAX/test/test_ARAX_ranker.py @@ -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' @@ -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' @@ -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'