Method: Modifications#get_mods

Defined in:
lib/ms/sim_modifications.rb

#get_modsObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/ms/sim_modifications.rb', line 16

def get_mods()
  mods = {}
  obo = Obo::Ontology.new(Obo::Ontology::DIR + '/mod.obo')
  @modifications.each do |mod|
    diff = nil
    residue = mod[9..mod.size-1]
    mod = (obo.id_to_element[mod[0..8]]).tagvalues
    xref = mod['xref']
    xref.each do |x|
      if x =~ /DiffFormula/
        diff = (x.split(/"/))[1]
      end
    end
    if mods[residue] == nil
      mods[residue] = [[mod['id'][0],diff]]
    else
      mds = mods[residue]
      mds<<[mod['id'][0],diff]
      mods[residue] = mds
    end
  end
  @modifications = mods
end