Class: Mspire::Ident::Pepxml::AminoacidModification

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

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Merge

#merge!

Constructor Details

#initialize(hash = {}) ⇒ AminoacidModification



30
31
32
# File 'lib/mspire/ident/pepxml/modifications.rb', line 30

def initialize(hash={})
  merge!(hash)
end

Instance Attribute Details

#aminoacidObject

The amino acid (one letter code)



13
14
15
# File 'lib/mspire/ident/pepxml/modifications.rb', line 13

def aminoacid
  @aminoacid
end

#binaryObject

'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/mspire/ident/pepxml/modifications.rb', line 28

def binary
  @binary
end

#massObject

Mass of modified aminoacid, Float



17
18
19
# File 'lib/mspire/ident/pepxml/modifications.rb', line 17

def mass
  @mass
end

#massdiffObject

Mass difference with respect to unmodified aminoacid, as a Float



15
16
17
# File 'lib/mspire/ident/pepxml/modifications.rb', line 15

def massdiff
  @massdiff
end

#peptide_terminusObject

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



23
24
25
# File 'lib/mspire/ident/pepxml/modifications.rb', line 23

def peptide_terminus
  @peptide_terminus
end

#symbolObject

Symbol used by search engine to designate this modification



25
26
27
# File 'lib/mspire/ident/pepxml/modifications.rb', line 25

def symbol
  @symbol
end

#variableObject

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/mspire/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/mspire/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
  # Mspire::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