class Mspire::Mzml::Run
Attributes
chromatogram_list[RW]
takes a ChromatogramList
object (a special array of chromatograms)
default_instrument_configuration[RW]
required
default_source_file[RW]
optional
id[RW]
required
sample[RW]
optional
spectrum_list[RW]
a SpectrumList
object (a special array of spectra)
start_time_stamp[RW]
optional
Public Class Methods
from_xml(io, xml, link)
click to toggle source
expects link to have the following keys:
:ref_hash :instrument_config_hash :source_file_hash :sample_hash :data_processing_hash :spectrum_default_data_processing :chromatogram_default_data_processing :index_list
# File lib/mspire/mzml/run.rb, line 70 def self.from_xml(io, xml, link) # expects that the DataProcessing objects to link to have *already* been # parsed (parse the defaultDataProcessingRef's after grabbing the # index, then grab the DataProcessing object associated with that id). obj = self.new(xml[:id], link[:instrument_configuration_hash][xml[:defaultInstrumentConfigurationRef]] ) obj.start_time_stamp = xml[:startTimeStamp] link[:default_instrument_configuration] = obj.default_instrument_configuration # two optional object refs if def_source_ref=xml[:defaultSourceFileRef] obj.default_source_file = link[:source_file_hash][def_source_ref] end if sample_ref=xml[:sampleRef] obj.sample = link[:sample_hash][sample_ref] end obj.describe_from_xml!(xml, link[:ref_hash]) index_list = link[:index_list] [:spectrum, :chromatogram].each do |list_type| next unless (byte_index = index_list[list_type]) io_index = IOIndex.new(io, byte_index, link) list_obj = Mspire::Mzml.const_get(list_type.to_s.capitalize + "List") .new(link["#{list_type}_default_data_processing".to_sym], io_index, Hash[byte_index.ids.each_with_index.map.to_a] ) obj.send(list_type.to_s + "_list=", list_obj) end obj end
new(id, default_instrument_configuration) { |self| ... }
click to toggle source
yields self if given a block
# File lib/mspire/mzml/run.rb, line 33 def initialize(id, default_instrument_configuration) @id = id @default_instrument_configuration = default_instrument_configuration params_init if block_given? yield self end end
Public Instance Methods
to_xml(builder)
click to toggle source
Calls superclass method
Mspire::Paramable#to_xml
# File lib/mspire/mzml/run.rb, line 42 def to_xml(builder) atts = { id: @id, defaultInstrumentConfigurationRef: @default_instrument_configuration.id } atts[:defaultSourceFileRef] = @default_source_file.id if @default_source_file atts[:sampleRef] = @sample.id if @sample atts[:startTimeStamp] = @start_time_stamp if @start_time_stamp default_ids = { instrument_configuration: @default_instrument_configuration.id } builder.run(atts) do |run_n| super(run_n) spectrum_list.to_xml(run_n, default_ids) if spectrum_list chromatogram_list.to_xml(run_n, default_ids) if chromatogram_list end builder end