-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix : molecular_weight_calc function moved to functions.py * fix : basic_melting_temperature_calc function moved to functions.py * fix : unused imports removed * fix : autopep8 * fix : MeltingTemperature enum added to __init__.py * fix : melting_temperature method error fixed * doc : params.py docstring updated * fix : minor typo fixed * fix : minor bug in basic_melting_temperature_calc function fixed * fix : minor bug in __mul__ method fixed
- Loading branch information
1 parent
a058118
commit db961d0
Showing
4 changed files
with
50 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# -*- coding: utf-8 -*- | ||
"""OPR modules.""" | ||
from .params import OPR_VERSION | ||
from .primer import Primer | ||
from .primer import Primer, MeltingTemperature | ||
from .errors import OPRBaseError | ||
|
||
__version__ = OPR_VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# -*- coding: utf-8 -*- | ||
"""OPR functions.""" | ||
from .params import A_WEIGHT, T_WEIGHT, C_WEIGHT, G_WEIGHT, ANHYDROUS_MOLECULAR_WEIGHT_CONSTANT | ||
|
||
|
||
def molecular_weight_calc(sequence): | ||
""" | ||
Calculate molecular weight. | ||
:param sequence: primer nucleotides sequence | ||
:type sequence: str | ||
:return: molecular weight as float | ||
""" | ||
a_count = sequence.count('A') | ||
t_count = sequence.count('T') | ||
c_count = sequence.count('C') | ||
g_count = sequence.count('G') | ||
return (a_count * A_WEIGHT) + (t_count * T_WEIGHT) + (c_count * C_WEIGHT) + \ | ||
(g_count * G_WEIGHT) - ANHYDROUS_MOLECULAR_WEIGHT_CONSTANT | ||
|
||
|
||
def basic_melting_temperature_calc(sequence): | ||
""" | ||
Calculate basic melting temperature. | ||
:param sequence: primer nucleotides sequence | ||
:type sequence: str | ||
:return: melting temperature as float | ||
""" | ||
a_count = sequence.count('A') | ||
t_count = sequence.count('T') | ||
c_count = sequence.count('C') | ||
g_count = sequence.count('G') | ||
if len(sequence) <= 13: | ||
melting_temperature = (a_count + t_count) * 2 + (g_count + c_count) * 4 | ||
else: | ||
melting_temperature = 64.9 + 41 * ((g_count + c_count - 16.4) / (a_count + t_count + g_count + c_count)) | ||
return melting_temperature |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters