class Mspire::Ident::Pepxml::SearchSummary

Constants

DEFAULT_SEARCH_ID

Attributes

base_name[RW]
enzymatic_search_constraint[RW]

An EnzymaticSearchConstraint object (at the moment this is merely a hash with a few required keys

fragment_mass_type[RW]

required: ‘average’ or ‘monoisotopic’

modifications[RW]

an array of Mspire::Ident::Pepxml::Modification objects

out_data[RW]

required in v18-19, optional in later versions

out_data_type[RW]

required in v18-19, optional in later versions

parameters[RW]

the other search paramaters as a hash

precursor_mass_type[RW]

required: ‘average’ or ‘monoisotopic’

search_database[RW]

A SearchDatabase object (responds to :local_path and :type)

search_engine[RW]

the search engine used, SEQUEST, Mascot, Comet, etc.

search_id[RW]

by default, “1”

Public Class Methods

from_pepxml_node(node) click to toggle source
# File lib/mspire/ident/pepxml/search_summary.rb, line 81
def self.from_pepxml_node(node)
  self.new.from_pepxml_node(node)
end
new(hash={}, &block) click to toggle source

initializes modifications to an empty array

# File lib/mspire/ident/pepxml/search_summary.rb, line 58
def initialize(hash={}, &block)
  @modifications = []
  @search_id = DEFAULT_SEARCH_ID
  merge!(hash, &block)
end

Public Instance Methods

block_arg() click to toggle source
# File lib/mspire/ident/pepxml/search_summary.rb, line 49
def block_arg
  [@search_database = Mspire::Ident::Pepxml::SearchDatabase.new,
    @enzymatic_search_constraint = Mspire::Ident::Pepxml::EnzymaticSearchConstraint.new,
    @modifications,
    @parameters = Mspire::Ident::Pepxml::Parameters.new,
  ]
end
from_pepxml_node(node) click to toggle source
# File lib/mspire/ident/pepxml/search_summary.rb, line 85
def from_pepxml_node(node)
  raise NotImplementedError, "not implemented just yet (just use the raw xml node)"
end
to_xml(builder=nil) click to toggle source
# File lib/mspire/ident/pepxml/search_summary.rb, line 64
def to_xml(builder=nil)
  # TODO: out_data and out_data_type are optional in later pepxml versions...
  # should work that in...
  attrs = [:base_name, :search_engine, :precursor_mass_type, :fragment_mass_type, :out_data_type, :out_data, :search_id]
  hash = Hash[ attrs.map {|at| v=send(at) ; [at, v] if v }.compact ]
  xmlb = builder || Nokogiri::XML::Builder.new
  builder.search_summary(hash) do |xmlb|
    search_database.to_xml(xmlb)
    xmlb.enzymatic_search_constraint(enzymatic_search_constraint) if enzymatic_search_constraint
    modifications.each do |mod|
      mod.to_xml(xmlb)
    end
    parameters.to_xml(xmlb) if parameters
  end
  builder || xmlb.doc.root.to_xml 
end