/usr/lib/python2.7/dist-packages/cogent/data/molecular_weight.py is in python-cogent 1.9-9.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | #!/usr/bin/python
"""Data for molecular weight calculations on proteins and nucleotides."""
__author__ = "Rob Knight"
__copyright__ = "Copyright 2007-2016, The Cogent Project"
__credits__ = ["Rob Knight"]
__license__ = "GPL"
__version__ = "1.9"
__maintainer__ = "Rob Knight"
__email__ = "rob@spot.colorado.edu"
__status__ = "Production"
ProteinWeights = {
'A': 71.09,
'C': 103.16,
'D': 115.10,
'E': 129.13,
'F': 147.19,
'G': 57.07,
'H': 137.16,
'I': 113.18,
'K': 128.19,
'L': 113.18,
'M': 131.21,
'N': 114.12,
'P': 97.13,
'Q': 128.15,
'R': 156.20,
'S': 87.09,
'T': 101.12,
'V': 99.15,
'W': 186.23,
'Y': 163.19,
'U': 150.06,
}
RnaWeights = {
'A': 313.21,
'U': 290.17,
'C': 289.19,
'G': 329.21,
}
DnaWeights = {
'A': 297.21,
'T': 274.17,
'C': 273.19,
'G': 313.21,
}
ProteinWeightCorrection = 18.0 #terminal residues not dehydrated
DnaWeightCorrection = 61.96 #assumes 5' monophosphate, 3' OH
RnaWeightCorrection = DnaWeightCorrection
class WeightCalculator(object):
"""Calculates molecular weight of a non-degenerate sequence."""
def __init__(self, Weights, Correction):
"""Returns a new WeightCalculator object (class, so serializable)."""
self.Weights = Weights
self.Correction = Correction
def __call__(self, seq, correction=None):
"""Returns the molecular weight of a specified sequence."""
if not seq:
return 0
if correction is None:
correction = self.Correction
get_mw = self.Weights.get
return sum([get_mw(i, 0) for i in seq]) + correction
DnaMW = WeightCalculator(DnaWeights, DnaWeightCorrection)
RnaMW = WeightCalculator(RnaWeights, DnaWeightCorrection)
ProteinMW = WeightCalculator(ProteinWeights, ProteinWeightCorrection)
|