Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename AutoBA1BS1BS2PM2 to AutoPM2BA1bS1BS2 #143

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/criteria/auto_criteria.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

from src.api.annonars import AnnonarsClient
from src.core.config import Config
from src.criteria.auto_ba1_bs1_bs2_pm2 import AutoBA1BS1BS2PM2
from src.criteria.auto_bp7 import AutoBP7
from src.criteria.auto_pm1 import AutoPM1
from src.criteria.auto_pm2_ba1_bs1_bs2 import AutoPM2BA1BS1BS2
from src.criteria.auto_pm4_bp3 import AutoPM4BP3
from src.criteria.auto_pp2_bp1 import AutoPP2BP1
from src.criteria.auto_pp3_bp4 import AutoPP3BP4
Expand Down Expand Up @@ -100,7 +100,7 @@ def predict(self) -> Optional[ACMGResult]:
# BA1, BS1, BS2, PM2
try:
logger.info("Predicting BA1, BS1, BS2, and PM2 criteria.")
ba1bs1bs2pm2 = AutoBA1BS1BS2PM2(self.seqvar, variant_info.result, config=self.config)
ba1bs1bs2pm2 = AutoPM2BA1BS1BS2(self.seqvar, variant_info.result, config=self.config)
ba1bs1bs2pm2_prediction, ba1bs1bs2pm2_comment = ba1bs1bs2pm2.predict()
if not ba1bs1bs2pm2_prediction:
logger.error("Failed to predict BA1, BS1, BS2, and PM2 criteria.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
from src.utils import SeqVarTranscriptsHelper


class AutoBA1BS1BS2PM2:
"""Predicts BA1, BS1, BS2, PM2 criteria for sequence variants."""
class AutoPM2BA1BS1BS2:
"""Predicts PM2, BA1, BS1, BS2 criteria for sequence variants."""

def __init__(
self,
Expand Down Expand Up @@ -271,10 +271,12 @@ def _check_zyg(self, seqvar: SeqVar, variant_data: VariantResult) -> bool:

def predict(self) -> Tuple[Optional[BA1BS1BS2PM2], str]:
"""
Predicts the BA1, BS1, BS2, PM2 criteria for the sequence variant.
Predicts the PM2, BA1, BS1, BS2 criteria for the sequence variant.

Note:
Rules:
PM2: Absent from controls allele frequency data.

BA1: Allele frequency is >5%.

BS1: Allele frequency is between 1% and 5%.
Expand All @@ -283,8 +285,6 @@ def predict(self) -> Tuple[Optional[BA1BS1BS2PM2], str]:
(heterozygous), or X-linked (hemizygous) disorder, with full penetrance expected at an
early age.

PM2: Absent from controls allele frequency data.

Returns:
BA1BS1BS2PM2: The prediction result.
"""
Expand All @@ -311,8 +311,8 @@ def predict(self) -> Tuple[Optional[BA1BS1BS2PM2], str]:
self.prediction.BS2 = True

except AutoAcmgBaseException as e:
logger.error("Error occurred during BA1, BS1, BS2, PM2 prediction. Error: {}", e)
self.comment += f"An error occurred while predicting BA1, BS1, BS2, PM2 criteria: {e}"
logger.error("Error occurred during PM2, BA1, BS1, BS2 prediction. Error: {}", e)
self.comment += f"An error occurred while predicting PM2, BA1, BS1, BS2 criteria: {e}"
self.prediction = None

# Return the prediction result and explanation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"""Integration tests for `BA1`, `BS1`, `BS2`, `PM2` criteria using upstream server."""
"""Integration tests for `PM2`, `BA1`, `BS1`, `BS2` criteria using upstream server."""

from typing import Tuple

import pytest

from src.auto_acmg import AutoACMG
from src.core.config import Config
from src.criteria.auto_ba1_bs1_bs2_pm2 import AutoBA1BS1BS2PM2
from src.criteria.auto_criteria import AutoACMGCriteria
from src.criteria.auto_pm2_ba1_bs1_bs2 import AutoPM2BA1BS1BS2
from src.defs.annonars_variant import AnnonarsVariantResponse
from src.defs.genome_builds import GenomeRelease
from src.defs.seqvar import SeqVar
Expand All @@ -23,9 +23,9 @@
# ("NM_000277.2(PAH):c.707-7A>T", GenomeRelease.GRCh37, [True, False, False, False]),
# ("NM_000277.2(PAH):c.1242C>T", GenomeRelease.GRCh37, [False, True, True, False]),
# ("NM_000277.2(PAH):c.1A>G", GenomeRelease.GRCh37, [False, False, False, True]),
("NM_000277.2(PAH):c.503delA", GenomeRelease.GRCh37, [False, False, False, True]),
("NM_000277.1(PAH):c.814G>T", GenomeRelease.GRCh37, [False, False, False, True]),
("NM_000277.1(PAH):c.1162G>A", GenomeRelease.GRCh37, [False, False, False, True]),
("NM_000277.2(PAH):c.503delA", GenomeRelease.GRCh37, [True, False, False, False]),
("NM_000277.1(PAH):c.814G>T", GenomeRelease.GRCh37, [True, False, False, False]),
("NM_000277.1(PAH):c.1162G>A", GenomeRelease.GRCh37, [True, False, False, False]),
# ("NM_000277.1(PAH):c.722G>A", GenomeRelease.GRCh37, [False, False, False, True]),
# ("NM_000277.2(PAH):c.735G>A", GenomeRelease.GRCh37, (True, False, True, False)),
# ("NM_000314.6(PTEN):c.-1311T>C", GenomeRelease.GRCh37, (True, False, False, False)),
Expand Down Expand Up @@ -70,7 +70,7 @@
# ("NM_000277.2(PAH):c.504C>A", GenomeRelease.GRCh37, (False, False, False, True)),
],
)
def test_ba1_bs1_bs2_pm2(
def test_pm2_ba1_bs1_bs2(
variant_name: str,
genome_release: GenomeRelease,
expected_prediction: Tuple[bool, bool, bool, bool],
Expand All @@ -84,15 +84,15 @@ def test_ba1_bs1_bs2_pm2(
auto_acmg_criteria = AutoACMGCriteria(seqvar, config=config)
variant_info = auto_acmg_criteria._get_variant_info(seqvar)
assert isinstance(variant_info, AnnonarsVariantResponse)
# Then, predict BA1, BS1, BS2, PM2
auto_ba1_bs1_bs2_pm2 = AutoBA1BS1BS2PM2(seqvar, variant_info.result, config=config)
prediction, details = auto_ba1_bs1_bs2_pm2.predict()
# Then, predict PM2, BA1, BS1, BS2
auto_pm2_ba1_bs1_bs2 = AutoPM2BA1BS1BS2(seqvar, variant_info.result, config=config)
prediction, details = auto_pm2_ba1_bs1_bs2.predict()
print(details)
if expected_prediction is None:
assert prediction is None, f"Failed for {variant_name}"
else:
assert prediction
assert prediction.BA1 == expected_prediction[0], f"Failed for {variant_name}"
assert prediction.BS1 == expected_prediction[1], f"Failed for {variant_name}"
assert prediction.BS2 == expected_prediction[2], f"Failed for {variant_name}"
assert prediction.PM2 == expected_prediction[3], f"Failed for {variant_name}"
assert prediction.PM2 == expected_prediction[0], f"Failed for {variant_name}"
assert prediction.BA1 == expected_prediction[1], f"Failed for {variant_name}"
assert prediction.BS1 == expected_prediction[2], f"Failed for {variant_name}"
assert prediction.BS2 == expected_prediction[3], f"Failed for {variant_name}"
Loading