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

Implement duplication - tandem setting to temporary fix the PVS1 criteria for duplication CNVs #205

Merged
merged 1 commit into from
Sep 10, 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/auto_acmg.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ def predict(self) -> Union[AutoACMGSeqVarResult, AutoACMGStrucVarResult, None]:
predictor_class = self.select_predictor(self.seqvar_result.data.hgnc_id)
predictor = predictor_class(self.seqvar, self.seqvar_result, self.config)
seqvar_prediction = predictor.predict()
logger.info("Prediction: {}", seqvar_prediction)
# logger.info("Prediction: {}", seqvar_prediction)
return seqvar_prediction

elif isinstance(self.strucvar, StrucVar):
Expand All @@ -501,7 +501,7 @@ def predict(self) -> Union[AutoACMGSeqVarResult, AutoACMGStrucVarResult, None]:
# ====== Predict ======
sp = DefaultStrucVarPredictor(self.strucvar, self.strucvar_result, self.config)
strucvar_prediction = sp.predict()
# logger.info("Prediction: {}", strucvar_prediction)
logger.info("Prediction: {}", strucvar_prediction)
return strucvar_prediction

else:
Expand Down
15 changes: 14 additions & 1 deletion src/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from typing_extensions import Annotated

from src.auto_acmg import AutoACMG
from src.core.config import settings
from src.defs.exceptions import AutoAcmgBaseException, InvalidGenomeBuild
from src.defs.genome_builds import GenomeRelease

Expand Down Expand Up @@ -38,6 +39,17 @@ def classify(
help=f"Accepted genome Releases: {', '.join(ALLOWED_GENOME_RELEASES)}",
),
] = "GRCh38",
duplication_tandem: Annotated[
bool,
typer.Option(
"--duplication-tandem",
"-dt",
help=(
"Flag to indicate if the duplication is in tandem AND disrupts reading frame AND "
"undergoes NMD."
),
),
] = False,
):
"""
Classify sequence variant on the ACMG guidelines.
Expand All @@ -52,7 +64,8 @@ def classify(
)
)
raise InvalidGenomeBuild("Invalid genome release")

# Temporary save the duplication tandem flag in the settings
settings.DUPLICATION_TANDEM = duplication_tandem
auto_acmg = AutoACMG(variant, genome_release_enum)
prediction = auto_acmg.predict()
prediction.save_to_file() if prediction else logger.error("No prediction was made.")
Expand Down
5 changes: 5 additions & 0 deletions src/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ class Settings(BaseSettings):
#: Username for genebe
GENEBE_USERNAME: str = ""

# ==== Temporary settings ===

#: Flag to indicate if the duplication is in tandem AND disrupts reading frame AND undergoes NMD
DUPLICATION_TANDEM: bool = False

#: Path to the root directory
@property
def PATH_TO_ROOT(self) -> str:
Expand Down
80 changes: 55 additions & 25 deletions src/strucvar/auto_pvs1.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from loguru import logger

from src.core.config import settings
from src.defs.auto_acmg import (
AutoACMGCriteria,
AutoACMGPrediction,
Expand Down Expand Up @@ -577,17 +578,26 @@ def lof_rm_gt_10pct_of_prot(

@staticmethod
def dup_disrupt_rf() -> bool:
"""Check if the duplication disrupts the reading frame."""
"""
Check if the duplication disrupts the reading frame.
NOT IMPLEMENTED!
"""
return False

@staticmethod
def proven_in_tandem() -> bool:
"""Check if the duplication is proven in tandem."""
"""
Check if the duplication is proven in tandem.
NOT IMPLEMENTED!
"""
return False

@staticmethod
def presumed_in_tandem() -> bool:
"""Check if the duplication is presumed in tandem."""
"""
Check if the duplication is presumed in tandem.
NOT IMPLEMENTED!
"""
return False


Expand Down Expand Up @@ -683,31 +693,51 @@ def verify_pvs1( # pragma: no cover
self.prediction_path = PVS1PredictionStrucVarPath.DEL7_2

elif strucvar.sv_type == StrucVarType.DUP:
self.comment_pvs1 = "Analysing the duplication variant. => "
if self.proven_in_tandem():
self.comment_pvs1 += " =>"
if self.dup_disrupt_rf() and self.undergo_nmd(
strucvar, var_data.exons, var_data.strand
):
self.prediction = PVS1Prediction.PVS1
self.prediction_path = PVS1PredictionStrucVarPath.DUP1
else:
self.prediction = PVS1Prediction.NotPVS1
self.prediction_path = PVS1PredictionStrucVarPath.DUP2_1
elif self.presumed_in_tandem():
self.comment_pvs1 += " =>"
if self.dup_disrupt_rf() and self.undergo_nmd(
strucvar, var_data.exons, var_data.strand
):
self.prediction = PVS1Prediction.PVS1_Strong
self.prediction_path = PVS1PredictionStrucVarPath.DUP3
else:
self.prediction = PVS1Prediction.NotPVS1
self.prediction_path = PVS1PredictionStrucVarPath.DUP2_2
self.comment_pvs1 = (
"THE CRITERIA RELY ON THE DUPLICATION_TANDEM SETTING. "
"Please, specify the entry in CLI or API. Per default, the criteria is set to "
"False (Not PVS1). "
)
self.comment_pvs1 += "Analysing the duplication variant. => "

if settings.DUPLICATION_TANDEM:
self.comment_pvs1 += (
"The duplication is in tandem AND disrupts reading frame AND undergoes NMD. "
)
self.prediction = PVS1Prediction.PVS1
self.prediction_path = PVS1PredictionStrucVarPath.DUP1
else:
self.comment_pvs1 += (
"The duplication is not in tandem OR does not disrupt reading frame OR "
"does not undergo NMD."
)
self.prediction = PVS1Prediction.NotPVS1
self.prediction_path = PVS1PredictionStrucVarPath.DUP4
self.prediction_path = PVS1PredictionStrucVarPath.DUP3

# if self.proven_in_tandem():
# self.comment_pvs1 += " =>"
# if self.dup_disrupt_rf() and self.undergo_nmd(
# strucvar, var_data.exons, var_data.strand
# ):
# self.prediction = PVS1Prediction.PVS1
# self.prediction_path = PVS1PredictionStrucVarPath.DUP1
# else:
# self.prediction = PVS1Prediction.NotPVS1
# self.prediction_path = PVS1PredictionStrucVarPath.DUP2_1
# elif self.presumed_in_tandem():
# self.comment_pvs1 += " =>"
# if self.dup_disrupt_rf() and self.undergo_nmd(
# strucvar, var_data.exons, var_data.strand
# ):
# self.prediction = PVS1Prediction.PVS1_Strong
# self.prediction_path = PVS1PredictionStrucVarPath.DUP3
# else:
# self.prediction = PVS1Prediction.NotPVS1
# self.prediction_path = PVS1PredictionStrucVarPath.DUP2_2

# else:
# self.prediction = PVS1Prediction.NotPVS1
# self.prediction_path = PVS1PredictionStrucVarPath.DUP4

else:
self.prediction = PVS1Prediction.NotSet
Expand Down
Loading