class Mspire::Mzml::Chromatogram

Attributes

precursor[RW]

(optional) precursor isolations to the chromatogram currently being described

product[RW]

(optional) Description of product isolation to the chromatogram

Public Class Methods

from_xml(xml, link) click to toggle source
# 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
new(id) { |self| ... } click to toggle source
# File lib/mspire/mzml/chromatogram.rb, line 16
def initialize(id)
  @id = id
  params_initialize
  yield(self) if block_given?
end
Also aliased as: params_initialize

Public Instance Methods

intensities() click to toggle source
# File lib/mspire/mzml/chromatogram.rb, line 48
def intensities
  data_arrays[1]
end
params_initialize(id)
Alias for: new
times() click to toggle source
# File lib/mspire/mzml/chromatogram.rb, line 44
def times
  data_arrays[0]
end
to_xml(builder, default_ids) click to toggle source

see ChromatogramList for generating the entire list

Calls superclass method
# 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