Module: Mspire::Mzml::DataArrayContainerLike
- Includes:
- CV::Paramable
- Included in:
- Chromatogram, Spectrum
- Defined in:
- lib/mspire/mzml/data_array_container_like.rb
Instance Attribute Summary collapse
-
#data_arrays ⇒ Object
(optional) an array of Mspire::Mzml::DataArray.
-
#data_processing ⇒ Object
(optional) an Mspire::Mzml::DataProcessing object.
-
#id ⇒ Object
(required) the spectrum id matching this general pattern: S+=S+( S+=S+)*).
-
#index ⇒ Object
(required [at xml write time]) the index in the spectrum list.
Attributes included from CV::Paramable
Instance Method Summary collapse
- #default_array_length ⇒ Object
- #initialize(id, opts = {params: []}) ⇒ Object
-
#to_xml(builder, opts = {}, &block) ⇒ Object
see SpectrumList for generating the entire list the opt key :sub_elements can be used to pass in subelements whose to_xml methods will be called.
Methods included from CV::Paramable
#describe!, #describe_many!, #find_param_by_accession, #find_param_value_by_accession, #param_exists_by_accession?
Instance Attribute Details
#data_arrays ⇒ Object
(optional) an array of Mspire::Mzml::DataArray
27 28 29 |
# File 'lib/mspire/mzml/data_array_container_like.rb', line 27 def data_arrays @data_arrays end |
#data_processing ⇒ Object
(optional) an Mspire::Mzml::DataProcessing object
20 21 22 |
# File 'lib/mspire/mzml/data_array_container_like.rb', line 20 def data_processing @data_processing end |
#id ⇒ Object
(required) the spectrum id matching this general pattern: S+=S+( S+=S+)*)
14 15 16 |
# File 'lib/mspire/mzml/data_array_container_like.rb', line 14 def id @id end |
#index ⇒ Object
(required [at xml write time]) the index in the spectrum list
17 18 19 |
# File 'lib/mspire/mzml/data_array_container_like.rb', line 17 def index @index end |
Instance Method Details
#default_array_length ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/mspire/mzml/data_array_container_like.rb', line 34 def default_array_length if @data_arrays if @data_arrays.first @data_arrays.first.size else 0 end else 0 end end |
#initialize(id, opts = {params: []}) ⇒ Object
29 30 31 32 |
# File 'lib/mspire/mzml/data_array_container_like.rb', line 29 def initialize(id, opts={params: []}) @id = id describe_many!(opts[:params]) end |
#to_xml(builder, opts = {}, &block) ⇒ Object
see SpectrumList for generating the entire list the opt key :sub_elements can be used to pass in subelements whose to_xml methods will be called.
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/mspire/mzml/data_array_container_like.rb', line 49 def to_xml(builder, opts={}, &block) atts = {id: @id, index: @index, defaultArrayLength: default_array_length} atts[:dataProcessingRef] = @data_processing.id if @data_processing atts.merge!(opts) raise "#{self.class} object must have index at xml writing time!" unless atts[:index] builder.spectrum(atts) do |sp_n| super(sp_n) # params block.call(sp_n) if block Mspire::Mzml::DataArray.list_xml(@data_arrays, sp_n) if @data_arrays end builder end |