class Ms::Ident::Pepxml::AminoacidModification

Modified aminoacid, static or variable unless otherwise stated, all attributes can be anything

Attributes

aminoacid[RW]

The amino acid (one letter code)

binary[RW]

‘Y’ if each peptide must have only modified or unmodified aminoacid, ‘N’ if a peptide may contain both modified and unmodified aminoacid

mass[RW]

Mass of modified aminoacid, Float

massdiff[RW]

Mass difference with respect to unmodified aminoacid, as a Float

peptide_terminus[RW]

whether modification can reside only at protein terminus (specified ‘n’, ‘c’, or ‘nc’)

symbol[RW]

Symbol used by search engine to designate this modification

variable[RW]

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

Public Class Methods

new(hash={}) click to toggle source
# File lib/ms/ident/pepxml/modifications.rb, line 30
def initialize(hash={})
  merge!(hash)
end

Public Instance Methods

to_xml(builder=nil) click to toggle source

returns the builder or an xml string if no builder supplied

# 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