Skip to content

Commit

Permalink
small cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
korikuzma committed Nov 14, 2024
1 parent 4dccbf4 commit 4b01496
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/metakb/load_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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}
"""
Expand Down
2 changes: 1 addition & 1 deletion src/metakb/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/database/test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = """
Expand Down

0 comments on commit 4b01496

Please sign in to comment.