class Mass # http://expasy.org/tools/findmod/findmod_masses.html # still need to add the modifications MONO = { :A => 71.03711, :R => 156.10111, :N => 114.04293, :D => 115.02694, :C => 103.00919, :E => 129.04259, :Q => 128.05858, :G => 57.02146, :H => 137.05891, :I => 113.08406, :L => 113.08406, :K => 128.09496, :M => 131.04049, :F => 147.06841, :P => 97.05276, :S => 87.03203, :T => 101.04768, :W => 186.07931, :Y => 163.06333, :V => 99.06841, # uncommon :B => 172.048405, # average of aspartic acid and asparagine :U => 150.95364, # (selenocysteine) http://www.matrix-science.com/help/aa_help.html :X => 118.805716, # the average of the mono masses of the 20 amino acids :* => 118.805716, # same as X # elements etc. :h => 1.00783, :h_plus => 1.00728, :o => 15.9949146, :h2o => 18.01056, } AVG = { :A => 71.0788, :R => 156.1875, :N => 114.1038, :D => 115.0886, :C => 103.1388, :E => 129.1155, :Q => 128.1307, :G => 57.0519, :H => 137.1411, :I => 113.1594, :L => 113.1594, :K => 128.1741, :M => 131.1926, :F => 147.1766, :P => 97.1167, :S => 87.0782, :T => 101.1051, :W => 186.2132, :Y => 163.1760, :V => 99.1326, # uncommon :B => 172.1405, # average of aspartic acid and asparagine :U => 150.03, # (selenocysteine) http://www.matrix-science.com/help/aa_help.html :X => 118.88603, # the average of the masses of the 20 amino acids :* => 118.88603, # same as X # elements etc. :h => 1.00794, :h_plus => 1.00739, :o => 15.9994, :h2o => 18.01524, } # returns a fresh hash where it has been added to each amino acid the amount # specified in the array of a PepXML::Modifications object # if static_terminal_mods given than will create the following keys as # symbols as necessary: # add_C_term_protein # add_C_term_peptide # add_N_term_protein # add_N_term_peptide def self.add_static_masses(monoisotopic, static_mods, static_terminal_mods=nil) hash_to_use = if monoisotopic Mass::MONO else Mass::AVG end copy_hash = hash_to_use.dup static_mods.each do |mod| copy_hash[mod.aminoacid.to_sym] += mod.massdiff end static_terminal_mods.each do |mod| if x = mod.protein_terminus # its a protein terminus modification case x when 'n' copy_hash[:add_N_term_protein] = mod.massdiff when 'c' copy_hash[:add_C_term_protein] = mod.massdiff end else # its a peptide terminus modification case mod.terminus when 'n' copy_hash[:add_N_term_peptide] = mod.massdiff when 'c' copy_hash[:add_C_term_peptide] = mod.massdiff end end end copy_hash end end