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
#cv_params, #ref_param_groups, #user_params
Instance Method Summary collapse
- #default_array_length ⇒ 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
#accessionable_params, #describe!, #describe_many!, #fetch, #fetch_by_accession, #initialize, #param?, #param_by_accession, #params, #params?
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
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/mspire/mzml/data_array_container_like.rb', line 29 def default_array_length if @data_arrays if @data_arrays.first @data_arrays.first.size else 0 end else 0 end 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.
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/mspire/mzml/data_array_container_like.rb', line 44 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 |