Class: Mspire::Ident::Pepxml::SearchSummary
- Inherits:
-
Object
- Object
- Mspire::Ident::Pepxml::SearchSummary
- Includes:
- Merge
- Defined in:
- lib/mspire/ident/pepxml/search_summary.rb
Constant Summary collapse
- DEFAULT_SEARCH_ID =
'1'
Instance Attribute Summary collapse
-
#base_name ⇒ Object
Returns the value of attribute base_name.
-
#enzymatic_search_constraint ⇒ Object
An EnzymaticSearchConstraint object (at the moment this is merely a hash with a few required keys.
-
#fragment_mass_type ⇒ Object
required: ‘average’ or ‘monoisotopic’.
-
#modifications ⇒ Object
an array of Mspire::Ident::Pepxml::Modification objects.
-
#out_data ⇒ Object
required in v18-19, optional in later versions.
-
#out_data_type ⇒ Object
required in v18-19, optional in later versions.
-
#parameters ⇒ Object
the other search paramaters as a hash.
-
#precursor_mass_type ⇒ Object
required: ‘average’ or ‘monoisotopic’.
-
#search_database ⇒ Object
A SearchDatabase object (responds to :local_path and :type).
-
#search_engine ⇒ Object
the search engine used, SEQUEST, Mascot, Comet, etc.
-
#search_id ⇒ Object
by default, “1”.
Class Method Summary collapse
Instance Method Summary collapse
- #block_arg ⇒ Object
- #from_pepxml_node(node) ⇒ Object
-
#initialize(hash = {}, &block) ⇒ SearchSummary
constructor
initializes modifications to an empty array.
- #to_xml(builder = nil) ⇒ Object
Methods included from Merge
Constructor Details
#initialize(hash = {}, &block) ⇒ SearchSummary
initializes modifications to an empty array
58 59 60 61 62 |
# File 'lib/mspire/ident/pepxml/search_summary.rb', line 58 def initialize(hash={}, &block) @modifications = [] @search_id = DEFAULT_SEARCH_ID merge!(hash, &block) end |
Instance Attribute Details
#base_name ⇒ Object
Returns the value of attribute base_name.
26 27 28 |
# File 'lib/mspire/ident/pepxml/search_summary.rb', line 26 def base_name @base_name end |
#enzymatic_search_constraint ⇒ Object
An EnzymaticSearchConstraint object (at the moment this is merely a hash with a few required keys
47 48 49 |
# File 'lib/mspire/ident/pepxml/search_summary.rb', line 47 def enzymatic_search_constraint @enzymatic_search_constraint end |
#fragment_mass_type ⇒ Object
required: ‘average’ or ‘monoisotopic’
44 45 46 |
# File 'lib/mspire/ident/pepxml/search_summary.rb', line 44 def fragment_mass_type @fragment_mass_type end |
#modifications ⇒ Object
an array of Mspire::Ident::Pepxml::Modification objects
34 35 36 |
# File 'lib/mspire/ident/pepxml/search_summary.rb', line 34 def modifications @modifications end |
#out_data ⇒ Object
required in v18-19, optional in later versions
30 31 32 |
# File 'lib/mspire/ident/pepxml/search_summary.rb', line 30 def out_data @out_data end |
#out_data_type ⇒ Object
required in v18-19, optional in later versions
28 29 30 |
# File 'lib/mspire/ident/pepxml/search_summary.rb', line 28 def out_data_type @out_data_type end |
#parameters ⇒ Object
the other search paramaters as a hash
38 39 40 |
# File 'lib/mspire/ident/pepxml/search_summary.rb', line 38 def parameters @parameters end |
#precursor_mass_type ⇒ Object
required: ‘average’ or ‘monoisotopic’
42 43 44 |
# File 'lib/mspire/ident/pepxml/search_summary.rb', line 42 def precursor_mass_type @precursor_mass_type end |
#search_database ⇒ Object
A SearchDatabase object (responds to :local_path and :type)
36 37 38 |
# File 'lib/mspire/ident/pepxml/search_summary.rb', line 36 def search_database @search_database end |
#search_engine ⇒ Object
the search engine used, SEQUEST, Mascot, Comet, etc.
40 41 42 |
# File 'lib/mspire/ident/pepxml/search_summary.rb', line 40 def search_engine @search_engine end |
#search_id ⇒ Object
by default, “1”
32 33 34 |
# File 'lib/mspire/ident/pepxml/search_summary.rb', line 32 def search_id @search_id end |
Class Method Details
.from_pepxml_node(node) ⇒ Object
81 82 83 |
# File 'lib/mspire/ident/pepxml/search_summary.rb', line 81 def self.from_pepxml_node(node) self.new.from_pepxml_node(node) end |
Instance Method Details
#block_arg ⇒ Object
49 50 51 52 53 54 55 |
# 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) ⇒ Object
85 86 87 |
# 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) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# 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 |