From db8b12cc24e56ad6f5657f7ce967ba82d71a9e67 Mon Sep 17 00:00:00 2001 From: Nils Homer Date: Wed, 15 Jan 2025 16:10:42 -0700 Subject: [PATCH] more --- prymer/primer3/primer3_parameters.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/prymer/primer3/primer3_parameters.py b/prymer/primer3/primer3_parameters.py index 951afc8..d4cf8ec 100644 --- a/prymer/primer3/primer3_parameters.py +++ b/prymer/primer3/primer3_parameters.py @@ -62,7 +62,7 @@ class stores user input for internal probe design and maps it to the correct Pri ``` """ - +import typing from abc import ABC, abstractmethod from dataclasses import dataclass from dataclasses import fields @@ -78,6 +78,18 @@ class Primer3Parameters(ABC): target: Span task: Primer3TaskType + def as_amplicon_params(self) -> "AmpliconParameters": + """Use this method when you want to treat these parameters as amplicon parameters.""" + if isinstance(self, AmpliconParameters): + return typing.cast(AmpliconParameters, self) + raise Exception("The parameters are not amplicon parameters") + + def as_probe_params(self) -> "ProbeParameters": + """Use this method when you want to treat these parameters as probe parameters.""" + if isinstance(self, ProbeParameters): + return typing.cast(ProbeParameters, self) + raise Exception("The parameters are not amplicon parameters") + @abstractmethod def _to_input_tags(self) -> dict[Primer3InputTag, Any]: ...