Skip to content

Commit

Permalink
Refactor/property (#35)
Browse files Browse the repository at this point in the history
* remove `deleter` and `setter` for `property`

* remove (deleter, setter) associated params

* `CHANGELOG.md` updated
  • Loading branch information
AHReccese authored Dec 31, 2024
1 parent 3a4c8f0 commit b44f560
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 43 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- `equality` operator overload
- `gc_clamp` property
- `single_runs` property
### Changed
- `property` deleter & setter removed
## [0.1] - 2024-11-27
### Added
- `MeltingTemperature` enum
Expand Down
2 changes: 0 additions & 2 deletions opr/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
PRIMER_SEQUENCE_LENGTH_WARNING = "The recommended range for primer length is between 18 and 30."
PRIMER_SEQUENCE_VALID_BASES_ERROR = "Primer sequence should only contain the nucleotide bases A, T, C, and G."
PRIMER_SEQUENCE_VALID_GC_CONTENT_RANGE_WARNING = "The recommended range for GC content is between 30% and 80%."
PRIMER_READ_ONLY_ATTRIBUTE_ERROR = "This attribute is read-only."
PRIMER_NOT_REMOVABLE_ATTRIBUTE_ERROR = "This attribute is not removable."

PRIMER_ADDITION_ERROR = "You can only add two Primer objects."
PRIMER_MULTIPLICATION_ERROR = "The primer sequence can only be multiplied by an integer."
Expand Down
41 changes: 0 additions & 41 deletions opr/primer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from .params import VALID_BASES
from .params import PRIMER_SEQUENCE_TYPE_ERROR, PRIMER_SEQUENCE_LENGTH_WARNING, PRIMER_SEQUENCE_VALID_BASES_ERROR, PRIMER_SEQUENCE_VALID_GC_CONTENT_RANGE_WARNING
from .params import PRIMER_LOWER_LENGTH, PRIMER_HIGHEST_LENGTH, PRIMER_LOWEST_GC_RANGE, PRIMER_HIGHEST_GC_RANGE
from .params import PRIMER_READ_ONLY_ATTRIBUTE_ERROR, PRIMER_NOT_REMOVABLE_ATTRIBUTE_ERROR
from .params import DNA_COMPLEMENT_MAP
from .params import PRIMER_ADDITION_ERROR, PRIMER_MULTIPLICATION_ERROR
from .params import PRIMER_MELTING_TEMPERATURE_NOT_IMPLEMENTED_ERROR
Expand Down Expand Up @@ -149,14 +148,6 @@ def sequence(self):
"""
return self._sequence

@sequence.setter
def sequence(self, _):
raise OPRBaseError(PRIMER_READ_ONLY_ATTRIBUTE_ERROR)

@sequence.deleter
def sequence(self, _):
raise OPRBaseError(PRIMER_NOT_REMOVABLE_ATTRIBUTE_ERROR)

@property
def molecular_weight(self):
"""
Expand All @@ -169,14 +160,6 @@ def molecular_weight(self):
self._molecular_weight = molecular_weight_calc(self._sequence)
return self._molecular_weight

@molecular_weight.setter
def molecular_weight(self, _):
raise OPRBaseError(PRIMER_READ_ONLY_ATTRIBUTE_ERROR)

@molecular_weight.deleter
def molecular_weight(self, _):
self._molecular_weight = None

@property
def gc_content(self):
"""
Expand All @@ -191,14 +174,6 @@ def gc_content(self):
warn(PRIMER_SEQUENCE_VALID_GC_CONTENT_RANGE_WARNING, RuntimeWarning)
return self._gc_content

@gc_content.setter
def gc_content(self, _):
raise OPRBaseError(PRIMER_READ_ONLY_ATTRIBUTE_ERROR)

@gc_content.deleter
def gc_content(self, _):
raise OPRBaseError(PRIMER_NOT_REMOVABLE_ATTRIBUTE_ERROR)

@property
def gc_clamp(self):
"""
Expand All @@ -210,14 +185,6 @@ def gc_clamp(self):
self._gc_clamp = gc_clamp_calc(self._sequence)
return self._gc_clamp

@gc_clamp.setter
def gc_clamp(self, _):
raise OPRBaseError(PRIMER_READ_ONLY_ATTRIBUTE_ERROR)

@gc_clamp.deleter
def gc_clamp(self, _):
raise OPRBaseError(PRIMER_NOT_REMOVABLE_ATTRIBUTE_ERROR)

@property
def single_runs(self):
"""
Expand All @@ -238,14 +205,6 @@ def single_runs(self):
self._single_runs[base] = single_run_length(self._sequence, base)
return self._single_runs

@single_runs.setter
def single_runs(self, _):
raise OPRBaseError(PRIMER_READ_ONLY_ATTRIBUTE_ERROR)

@single_runs.deleter
def single_runs(self, _):
raise OPRBaseError(PRIMER_NOT_REMOVABLE_ATTRIBUTE_ERROR)

def melting_temperature(self, method=MeltingTemperature.BASIC):
"""
Calculate(if needed) the melting temperature.
Expand Down

0 comments on commit b44f560

Please sign in to comment.