Class: Mspire::Mzml::Chromatogram
- Inherits:
-
Object
- Object
- Mspire::Mzml::Chromatogram
- Includes:
- DataArrayContainerLike
- Defined in:
- lib/mspire/mzml/chromatogram.rb
Instance Attribute Summary collapse
-
#precursor ⇒ Object
(optional) precursor isolations to the chromatogram currently being described.
-
#product ⇒ Object
(optional) Description of product isolation to the chromatogram.
Attributes included from DataArrayContainerLike
#data_arrays, #data_processing, #id, #index
Attributes included from CV::Paramable
#cv_params, #ref_param_groups, #user_params
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id) {|_self| ... } ⇒ Chromatogram
constructor
A new instance of Chromatogram.
- #intensities ⇒ Object
- #params_initialize ⇒ Object
- #times ⇒ Object
-
#to_xml(builder, default_ids) ⇒ Object
see ChromatogramList for generating the entire list.
Methods included from DataArrayContainerLike
#data_array_xml_atts, #default_array_length
Methods included from CV::Paramable
#accessionable_params, #describe!, #describe_from_xml!, #describe_many!, #describe_self_from_xml!, #each_accessionable_param, #each_param, #fetch, #fetch_by_accession, #param?, #param_by_accession, #params, #params?, #reject!, #replace!, #replace_many!
Constructor Details
#initialize(id) {|_self| ... } ⇒ Chromatogram
Returns a new instance of Chromatogram.
16 17 18 19 20 |
# File 'lib/mspire/mzml/chromatogram.rb', line 16 def initialize(id) @id = id params_initialize yield(self) if block_given? end |
Instance Attribute Details
#precursor ⇒ Object
(optional) precursor isolations to the chromatogram currently being described
11 12 13 |
# File 'lib/mspire/mzml/chromatogram.rb', line 11 def precursor @precursor end |
#product ⇒ Object
(optional) Description of product isolation to the chromatogram
14 15 16 |
# File 'lib/mspire/mzml/chromatogram.rb', line 14 def product @product end |
Class Method Details
.from_xml(xml, link) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/mspire/mzml/chromatogram.rb', line 22 def self.from_xml(xml, link) obj = self.new(xml[:id]) obj.data_processing = link[:data_processing_hash][xml[:dataProcessingRef]] || link[:spectrum_default_data_processing] xml_n = obj.describe_from_xml!(xml, link[:ref_hash]) loop do case xml_n.name when 'precursor' obj.precursor = Mspire::Mzml::Precursor.from_xml(xml_n, link) when 'product' obj.product = Mspire::Mzml::Product.from_xml(xml_n, link) when 'binaryDataArrayList' obj.data_arrays = Mspire::Mzml::DataArray.data_arrays_from_xml(xml_n, link) break end break unless xml_n = xml_n.next end obj end |
Instance Method Details
#intensities ⇒ Object
48 49 50 |
# File 'lib/mspire/mzml/chromatogram.rb', line 48 def intensities data_arrays[1] end |
#params_initialize ⇒ Object
7 |
# File 'lib/mspire/mzml/chromatogram.rb', line 7 alias_method :params_initialize, :initialize |
#times ⇒ Object
44 45 46 |
# File 'lib/mspire/mzml/chromatogram.rb', line 44 def times data_arrays[0] end |
#to_xml(builder, default_ids) ⇒ Object
see ChromatogramList for generating the entire list
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/mspire/mzml/chromatogram.rb', line 53 def to_xml(builder, default_ids) atts = data_array_xml_atts if @data_processing && default_ids[:chromatogram_data_processing] != @data_processing.id atts[:dataProcessingRef] = @data_processing.id end builder.chromatogram(atts) do |chrom_n| super(chrom_n) @precursor.to_xml(chrom_n) if @precursor @product.to_xml(chrom_n) if @product Mspire::Mzml::DataArray.list_xml(@data_arrays, chrom_n) if @data_arrays end end |