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]: ...