Class: Modifications
- Inherits:
-
Object
- Object
- Modifications
- Defined in:
- lib/ms/sim_modifications.rb
Instance Attribute Summary collapse
-
#modifications ⇒ Object
Returns the value of attribute modifications.
Instance Method Summary collapse
- #get_mods ⇒ Object
-
#initialize(mods) ⇒ Modifications
constructor
A new instance of Modifications.
Constructor Details
#initialize(mods) ⇒ Modifications
Returns a new instance of Modifications.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/ms/sim_modifications.rb', line 5 def initialize(mods) @modifications = mods @modifications = @modifications.split(/_/) if @modifications[0] != "false" get_mods else @modifications = nil end return @modifications end |
Instance Attribute Details
#modifications ⇒ Object
Returns the value of attribute modifications.
40 41 42 |
# File 'lib/ms/sim_modifications.rb', line 40 def modifications @modifications end |
Instance Method Details
#get_mods ⇒ Object
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 |