Skip to content

Commit

Permalink
Merge pull request #23 from bcgsc/bugfix/KBDEV-1231_wildtype_mismatch
Browse files Browse the repository at this point in the history
Bugfix/kbdev 1231 wildtype mismatch
  • Loading branch information
dustinbleile authored Aug 2, 2024
2 parents e0b062d + 86bdd4f commit 5c91c79
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pori_python/ipr/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ def ipr_report(
always_write_output_json: bool = False,
ipr_upload: bool = True,
interactive: bool = False,
graphkb_username: str = None,
graphkb_password: str = None,
graphkb_username: str = "",
graphkb_password: str = "",
graphkb_url: str = "",
generate_therapeutics: bool = False,
generate_comments: bool = True,
Expand Down
6 changes: 6 additions & 0 deletions tests/test_graphkb/test_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,12 @@ def test_genomic_coordinates(self, conn):
def test_tert_promoter(self, conn):
assert match.match_positional_variant(conn, "TERT:c.-124C>T")

def test_wildtype_match_error(self, conn):
for gkb_match in match.match_positional_variant(conn, "TP53:p.E285K"):
assert (
"wildtype" not in gkb_match["displayName"]
), f"TP53:p.E285K should not match {gkb_match['displayName']}"

@pytest.mark.skipif(
True, reason="GERO-303 - technically incorrect notation for GSC backwards compatibility."
)
Expand Down
41 changes: 41 additions & 0 deletions tests/test_ipr/test_annotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,39 @@
),
}

KBDEV1231_TP53_ERR_MATCH_WT = {
"altSeq": "",
"chromosome": "chr17",
"comments": "",
"endPosition": "",
"gene": "TP53",
"germline": False,
"hgvsCds": "ENST00000269305:c.853G>A",
"hgvsGenomic": "chr17:g.7673767C>T",
"hgvsProtein": "TP53:p.E285K",
"key": "c23a7b0387335e7a5ed6c1081a1822ae",
"library": "F145233;F145265",
"ncbiBuild": "GRCh38",
"normalAltCount": "",
"normalDepth": "",
"normalRefCount": "",
"proteinChange": "p.E285K",
"refSeq": "",
"rnaAltCount": 311,
"rnaDepth": 370,
"rnaRefCount": 59,
"startPosition": "",
"transcript": "ENST00000269305",
"tumourAltCopies": "",
"tumourAltCount": 64,
"tumourDepth": 100,
"tumourRefCopies": "",
"tumourRefCount": 36,
"variant": "TP53:p.E285K",
"variantType": "mut",
"zygosity": "",
}


@pytest.fixture(scope="module")
def graphkb_conn():
Expand Down Expand Up @@ -106,3 +139,11 @@ def test_annotate_structural_variants_tp53(self, graphkb_conn):
missing = pref_vars.difference(alt_vars).difference(known_issues)
print(alt_vars)
assert not missing, f"{key} missing{missing}: {diff}"

def test_wt_not_matched(self, graphkb_conn):
"""Verify wildtypes are not matched to mutations."""
disease = "cancer"
matches = annotate_positional_variants(graphkb_conn, [KBDEV1231_TP53_ERR_MATCH_WT], disease)
# KBDEV-1231 - wildtype - should not match. A mutation is not wildtype
wt_matches = sorted(set([m["kbVariant"] for m in matches if "wildtype" in m["kbVariant"]]))
assert not wt_matches, f"Mutation 'TP53:p.E285K' should NOT match {wt_matches}"
6 changes: 3 additions & 3 deletions tests/test_ipr/test_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import pytest
import sys
import uuid
from typing import Dict, Tuple, List
from unittest.mock import MagicMock, patch
from typing import Generator
from unittest.mock import patch

from pori_python.ipr.connection import IprConnection
from pori_python.ipr.main import command_interface
Expand All @@ -31,7 +31,7 @@ def get_test_file(name: str) -> str:


@pytest.fixture(scope="module")
def loaded_reports(tmp_path_factory) -> Dict:
def loaded_reports(tmp_path_factory) -> Generator:
json_file = tmp_path_factory.mktemp("inputs") / "content.json"
async_json_file = tmp_path_factory.mktemp("inputs") / "async_content.json"
patient_id = f"TEST_{str(uuid.uuid4())}"
Expand Down

0 comments on commit 5c91c79

Please sign in to comment.