Class: Ms::Ident::Pepxml::MsmsRunSummary
- Inherits:
-
Object
- Object
- Ms::Ident::Pepxml::MsmsRunSummary
- Includes:
- Merge
- Defined in:
- lib/ms/ident/pepxml/msms_run_summary.rb
Instance Attribute Summary collapse
-
#base_name ⇒ Object
The name of the pep xml file without any extension.
-
#ms_detector ⇒ Object
Returns the value of attribute ms_detector.
-
#ms_ionization ⇒ Object
Returns the value of attribute ms_ionization.
-
#ms_manufacturer ⇒ Object
The name of the mass spec manufacturer.
-
#ms_mass_analyzer ⇒ Object
Returns the value of attribute ms_mass_analyzer.
-
#ms_model ⇒ Object
Returns the value of attribute ms_model.
-
#pepxml_version ⇒ Object
Returns the value of attribute pepxml_version.
-
#raw_data ⇒ Object
Returns the value of attribute raw_data.
-
#raw_data_type ⇒ Object
Returns the value of attribute raw_data_type.
-
#sample_enzyme ⇒ Object
A SampleEnzyme object (responds to: name, cut, no_cut, sense).
-
#search_summary ⇒ Object
A SearchSummary object.
-
#spectrum_queries ⇒ Object
An array of spectrum_queries.
Class Method Summary collapse
Instance Method Summary collapse
- #block_arg ⇒ Object
-
#from_pepxml_node(node) ⇒ Object
peps correspond to search_results.
-
#initialize(hash = {}, &block) ⇒ MsmsRunSummary
constructor
takes a hash of name, value pairs if block given, yields a SampleEnzyme object, a SearchSummary and an array for SpectrumQueries.
-
#to_xml(builder = nil) ⇒ Object
optionally takes an xml builder object and returns the builder, or the xml string if no builder was given sets the index attribute of each spectrum query if it is not already set.
Methods included from Merge
Constructor Details
#initialize(hash = {}, &block) ⇒ MsmsRunSummary
takes a hash of name, value pairs if block given, yields a SampleEnzyme object, a SearchSummary and an array for SpectrumQueries
42 43 44 45 46 |
# File 'lib/ms/ident/pepxml/msms_run_summary.rb', line 42 def initialize(hash={}, &block) @spectrum_queries = [] merge!(hash, &block) block.call(block_arg) if block end |
Instance Attribute Details
#base_name ⇒ Object
The name of the pep xml file without any extension
15 16 17 |
# File 'lib/ms/ident/pepxml/msms_run_summary.rb', line 15 def base_name @base_name end |
#ms_detector ⇒ Object
Returns the value of attribute ms_detector.
20 21 22 |
# File 'lib/ms/ident/pepxml/msms_run_summary.rb', line 20 def ms_detector @ms_detector end |
#ms_ionization ⇒ Object
Returns the value of attribute ms_ionization.
23 24 25 |
# File 'lib/ms/ident/pepxml/msms_run_summary.rb', line 23 def ms_ionization @ms_ionization end |
#ms_manufacturer ⇒ Object
The name of the mass spec manufacturer
17 18 19 |
# File 'lib/ms/ident/pepxml/msms_run_summary.rb', line 17 def ms_manufacturer @ms_manufacturer end |
#ms_mass_analyzer ⇒ Object
Returns the value of attribute ms_mass_analyzer.
19 20 21 |
# File 'lib/ms/ident/pepxml/msms_run_summary.rb', line 19 def ms_mass_analyzer @ms_mass_analyzer end |
#ms_model ⇒ Object
Returns the value of attribute ms_model.
18 19 20 |
# File 'lib/ms/ident/pepxml/msms_run_summary.rb', line 18 def ms_model @ms_model end |
#pepxml_version ⇒ Object
Returns the value of attribute pepxml_version.
24 25 26 |
# File 'lib/ms/ident/pepxml/msms_run_summary.rb', line 24 def pepxml_version @pepxml_version end |
#raw_data ⇒ Object
Returns the value of attribute raw_data.
22 23 24 |
# File 'lib/ms/ident/pepxml/msms_run_summary.rb', line 22 def raw_data @raw_data end |
#raw_data_type ⇒ Object
Returns the value of attribute raw_data_type.
21 22 23 |
# File 'lib/ms/ident/pepxml/msms_run_summary.rb', line 21 def raw_data_type @raw_data_type end |
#sample_enzyme ⇒ Object
A SampleEnzyme object (responds to: name, cut, no_cut, sense)
27 28 29 |
# File 'lib/ms/ident/pepxml/msms_run_summary.rb', line 27 def sample_enzyme @sample_enzyme end |
#search_summary ⇒ Object
A SearchSummary object
29 30 31 |
# File 'lib/ms/ident/pepxml/msms_run_summary.rb', line 29 def search_summary @search_summary end |
#spectrum_queries ⇒ Object
An array of spectrum_queries
31 32 33 |
# File 'lib/ms/ident/pepxml/msms_run_summary.rb', line 31 def spectrum_queries @spectrum_queries end |
Class Method Details
.from_pepxml_node(node) ⇒ Object
66 67 68 |
# File 'lib/ms/ident/pepxml/msms_run_summary.rb', line 66 def self.from_pepxml_node(node) self.new.from_pepxml_node(node) end |
Instance Method Details
#block_arg ⇒ Object
33 34 35 36 37 |
# File 'lib/ms/ident/pepxml/msms_run_summary.rb', line 33 def block_arg [@sample_enzyme = Ms::Ident::Pepxml::SampleEnzyme.new, @search_summary = Ms::Ident::Pepxml::SearchSummary.new, @spectrum_queries ] end |
#from_pepxml_node(node) ⇒ Object
peps correspond to search_results
71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/ms/ident/pepxml/msms_run_summary.rb', line 71 def from_pepxml_node(node) @base_name = node['base_name'] @ms_manufacturer = node['msManufacturer'] @ms_model = node['msModel'] @ms_manufacturer = node['msIonization'] @ms_mass_analyzer = node['msMassAnalyzer'] @ms_detector = node['msDetector'] @raw_data_type = node['raw_data_type'] @raw_data = node['raw_data'] self end |
#to_xml(builder = nil) ⇒ Object
optionally takes an xml builder object and returns the builder, or the xml string if no builder was given sets the index attribute of each spectrum query if it is not already set
51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/ms/ident/pepxml/msms_run_summary.rb', line 51 def to_xml(builder=nil) xmlb = builder || Nokogiri::XML::Builder.new hash = {:base_name => base_name, :msManufacturer => ms_manufacturer, :msModel => ms_model, :msIonization => ms_ionization, :msMassAnalyzer => ms_mass_analyzer, :msDetector => ms_detector, :raw_data_type => raw_data_type, :raw_data => raw_data} hash.each {|k,v| hash.delete(k) unless v } xmlb.msms_run_summary(hash) do |xmlb| sample_enzyme.to_xml(xmlb) if sample_enzyme search_summary.to_xml(xmlb) if search_summary spectrum_queries.each_with_index do |sq,i| sq.index = i+1 unless sq.index sq.to_xml(xmlb) end end builder || xmlb.doc.root.to_xml end |