Class: Ms::Ident::Pepxml::AminoacidModification
- Inherits:
-
Object
- Object
- Ms::Ident::Pepxml::AminoacidModification
- Includes:
- Merge
- Defined in:
- lib/ms/ident/pepxml/modifications.rb
Overview
Modified aminoacid, static or variable unless otherwise stated, all attributes can be anything
Instance Attribute Summary collapse
-
#aminoacid ⇒ Object
The amino acid (one letter code).
-
#binary ⇒ Object
‘Y’ if each peptide must have only modified or unmodified aminoacid, ‘N’ if a peptide may contain both modified and unmodified aminoacid.
-
#mass ⇒ Object
Mass of modified aminoacid, Float.
-
#massdiff ⇒ Object
Mass difference with respect to unmodified aminoacid, as a Float.
-
#peptide_terminus ⇒ Object
whether modification can reside only at protein terminus (specified ‘n’, ‘c’, or ‘nc’).
-
#symbol ⇒ Object
Symbol used by search engine to designate this modification.
-
#variable ⇒ Object
Y if both modified and unmodified aminoacid could be present in the dataset, N if only modified aminoacid can be present.
Instance Method Summary collapse
-
#initialize(hash = {}) ⇒ AminoacidModification
constructor
A new instance of AminoacidModification.
-
#to_xml(builder = nil) ⇒ Object
returns the builder or an xml string if no builder supplied.
Methods included from Merge
Constructor Details
#initialize(hash = {}) ⇒ AminoacidModification
Returns a new instance of AminoacidModification.
30 31 32 |
# File 'lib/ms/ident/pepxml/modifications.rb', line 30 def initialize(hash={}) merge!(hash) end |
Instance Attribute Details
#aminoacid ⇒ Object
The amino acid (one letter code)
13 14 15 |
# File 'lib/ms/ident/pepxml/modifications.rb', line 13 def aminoacid @aminoacid end |
#binary ⇒ Object
‘Y’ if each peptide must have only modified or unmodified aminoacid, ‘N’ if a peptide may contain both modified and unmodified aminoacid
28 29 30 |
# File 'lib/ms/ident/pepxml/modifications.rb', line 28 def binary @binary end |
#mass ⇒ Object
Mass of modified aminoacid, Float
17 18 19 |
# File 'lib/ms/ident/pepxml/modifications.rb', line 17 def mass @mass end |
#massdiff ⇒ Object
Mass difference with respect to unmodified aminoacid, as a Float
15 16 17 |
# File 'lib/ms/ident/pepxml/modifications.rb', line 15 def massdiff @massdiff end |
#peptide_terminus ⇒ Object
whether modification can reside only at protein terminus (specified ‘n’, ‘c’, or ‘nc’)
23 24 25 |
# File 'lib/ms/ident/pepxml/modifications.rb', line 23 def peptide_terminus @peptide_terminus end |
#symbol ⇒ Object
Symbol used by search engine to designate this modification
25 26 27 |
# File 'lib/ms/ident/pepxml/modifications.rb', line 25 def symbol @symbol end |
#variable ⇒ Object
Y if both modified and unmodified aminoacid could be present in the dataset, N if only modified aminoacid can be present
20 21 22 |
# File 'lib/ms/ident/pepxml/modifications.rb', line 20 def variable @variable end |
Instance Method Details
#to_xml(builder = nil) ⇒ Object
returns the builder or an xml string if no builder supplied
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/ms/ident/pepxml/modifications.rb', line 35 def to_xml(builder=nil) xmlb = builder || Nokogiri::XML::Builder.new # note massdiff: must begin with either + (nonnegative) or - [e.g. # +1.05446 or -2.3342] consider Numeric#to_plus_minus_string in # Ms::Ident::Pepxml attrs = [:aminoacid, :massdiff, :mass, :variable, :peptide_terminus, :symbol, :binary].map {|at| v=send(at) ; [at,v] if v }.compact hash = Hash[attrs] hash[:massdiff] = hash[:massdiff].to_plus_minus_string xmlb.aminoacid_modification(hash) builder || xmlb.doc.root.to_xml end |