Glossary
Monoisotopic mass table
The monoisotopic mass table for amino acids is a table listing the mass of each possible amino acid residue, where the value of the mass used is the monoisotopic mass of each residue.
Note: the monoisotopic mass of water is considered to be 18.01056 Da.
氨基酸的单同位素质量表是列出每个可能的氨基酸残基质量的表,其中使用的质量值是每个残基的单同位素质量。
注意:水的单同位素质量为18.01056 Da。
A 71.03711 C 103.00919 D 115.02694 E 129.04259 F 147.06841 G 57.02146 H 137.05891 I 113.08406 K 128.09496 L 113.08406 M 131.04049 N 114.04293 P 97.05276 Q 128.05858 R 156.10111 S 87.03203 T 101.04768 V 99.06841 W 186.07931 Y 163.06333
Problem
In a weighted alphabet, every symbol is assigned a positive real number called a weight. A string formed from a weighted alphabet is called a weighted string, and its weight is equal to the sum of the weights of its symbols.
The standard weight assigned to each member of the 20-symbol amino acid alphabet is the monoisotopic mass of the corresponding amino acid.
Given: A protein string of length at most 1000 aa.
Return: The total weight of . Consult the monoisotopic mass table.
问题
在加权字母表中,每个符号都分配有一个正整数,称为权重。由加权字母组成的字符串称为加权字符串,其权重 等于其符号的权重之和。
分配给20个符号氨基酸字母的每个成员的标准重量是相应氨基酸的单同位素质量。
给定:长度不超过1000个氨基酸的蛋白质串。
返回值:的总重量。查阅单同位素质量表。
Sample Dataset
SKADYEK
Sample Output
821.392
python解决方案
mass_dic = {'A': 71.03711, 'C':103.00919,'D':115.02694,'E':129.04259,
'F':147.06841, 'G':57.02146, 'H':137.05891, 'I':113.08406, 'K':128.09496,
'L':113.08406, 'M':131.04049, 'N':114.04293, 'P':97.05276, 'Q':128.05858,
'R':156.10111, 'S': 87.03203, 'T':101.04768, 'V':99.06841, 'W':186.07931,
'Y':163.06333 }
mass_str = 'SKADYEK'
sum = 0.0
for item in mass_str:
print(item, mass_dic[item])
sum += float(mass_dic[item])
print(sum)