Class: Ms::Ident::Pepxml::TerminalModification

Inherits:
Object
  • Object
show all
Includes:
Merge
Defined in:
lib/ms/ident/pepxml/modifications.rb

Overview

Modified aminoacid, static or variable

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Merge

#merge!

Constructor Details

#initialize(hash = {}) ⇒ TerminalModification

Returns a new instance of TerminalModification.



67
68
69
# File 'lib/ms/ident/pepxml/modifications.rb', line 67

def initialize(hash={})
  hash.each {|k,v| send("#{k}=", v) }
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



65
66
67
# File 'lib/ms/ident/pepxml/modifications.rb', line 65

def description
  @description
end

#massObject

Mass of modified terminus



56
57
58
# File 'lib/ms/ident/pepxml/modifications.rb', line 56

def mass
  @mass
end

#massdiffObject

Mass difference with respect to unmodified terminus



54
55
56
# File 'lib/ms/ident/pepxml/modifications.rb', line 54

def massdiff
  @massdiff
end

#protein_terminusObject

whether modification can reside only at protein terminus (specified n or c)



64
65
66
# File 'lib/ms/ident/pepxml/modifications.rb', line 64

def protein_terminus
  @protein_terminus
end

#symbolObject

MSial symbol used by search engine to designate this modification



61
62
63
# File 'lib/ms/ident/pepxml/modifications.rb', line 61

def symbol
  @symbol
end

#terminusObject

n for N-terminus, c for C-terminus



52
53
54
# File 'lib/ms/ident/pepxml/modifications.rb', line 52

def terminus
  @terminus
end

#variableObject

Y if both modified and unmodified terminus could be present in the dataset, N if only modified terminus can be present



59
60
61
# File 'lib/ms/ident/pepxml/modifications.rb', line 59

def variable
  @variable
end

Instance Method Details

#to_xml(builder = nil) ⇒ Object

returns the builder or an xml string if no builder supplied



72
73
74
75
76
77
78
79
80
# File 'lib/ms/ident/pepxml/modifications.rb', line 72

def to_xml(builder=nil)
  xmlb = builder || Nokogiri::XML::Builder.new
  #short_element_xml_from_instance_vars("terminal_modification")
 attrs = [:terminus, :massdiff, :mass, :variable, :protein_terminus, :description].map {|at| v=send(at) ; [at,v] if v }
 hash = Hash[attrs] 
  hash[:massdiff] = hash[:massdiff].to_plus_minus_string
  xmlb.terminal_modification(hash)
  builder || xmlb.doc.root.to_xml
end