diff --git a/src/metakb/load_data.py b/src/metakb/load_data.py index 7f65cbac..ab47183a 100644 --- a/src/metakb/load_data.py +++ b/src/metakb/load_data.py @@ -412,8 +412,9 @@ def _add_study(tx: ManagedTransaction, study_in: dict) -> None: rel_line += f"MERGE (s) -[:IS_REPORTED_IN] -> ({name})\n" allele_origin = study.get("alleleOriginQualifier") - study["alleleOriginQualifier"] = allele_origin - match_line += "SET s.alleleOriginQualifier=$alleleOriginQualifier\n" + if allele_origin: + study["alleleOriginQualifier"] = allele_origin + match_line += "SET s.alleleOriginQualifier=$alleleOriginQualifier\n" gene_context_id = study.get("geneContextQualifier", {}).get("id") if gene_context_id: @@ -452,7 +453,7 @@ def _add_study(tx: ManagedTransaction, study_in: dict) -> None: rel_line += "MERGE (s) -[:HAS_TUMOR_TYPE] -> (tt)\n" query = f""" - MERGE (s:{study_type}:Statement {{ {study_keys} }}) + MERGE (s:{study_type}:StudyStatement:Statement {{ {study_keys} }}) {match_line} {rel_line} """ diff --git a/src/metakb/query.py b/src/metakb/query.py index b9181f46..9197c2ec 100644 --- a/src/metakb/query.py +++ b/src/metakb/query.py @@ -158,7 +158,7 @@ async def search_studies( >>> result = qh.search_studies("BRAF V600E") >>> result.study_ids[:3] ['moa.assertion:944', 'moa.assertion:911', 'moa.assertion:865'] - >>> result.studies[0].reportedIn[0].url + >>> result.studies[0].reportedIn[0].urls[0] 'https://www.accessdata.fda.gov/drugsatfda_docs/label/2020/202429s019lbl.pdf' Variation, disease, therapy, and gene terms are resolved via their respective diff --git a/tests/unit/database/test_database.py b/tests/unit/database/test_database.py index 9e46439e..f2c3b904 100644 --- a/tests/unit/database/test_database.py +++ b/tests/unit/database/test_database.py @@ -547,7 +547,9 @@ def test_study_rules( check_relation_count("Statement", "Method", "IS_SPECIFIED_BY", max_rels=None) check_relation_count("Statement", "Gene", "HAS_GENE_CONTEXT", max_rels=None) - expected_node_labels = [{"Statement", "VariantTherapeuticResponseStudyStatement"}] + expected_node_labels = [ + {"Statement", "StudyStatement", "VariantTherapeuticResponseStudyStatement"} + ] check_node_labels("Statement", expected_node_labels, 1) cite_query = """