Sha256: b9fa8facbc4e5f97542c73f94d8b5f4416eca2204d7c89d3235f3999ab25fcf0

Contents?: true

Size: 1.35 KB

Versions: 4

Compression:

Stored size: 1.35 KB

Contents

require 'mspire/cv/paramable'

module Mspire
  class Mzml
    class Scan
      include Mspire::CV::Paramable

      # (optional) the Mspire::Mzml::Spectrum object from which the precursor is
      # derived.  (the sourceFileRef is derived from this spectrum object if
      # from_external_source_file == true)
      attr_accessor :spectrum

      # a boolean indicating the spectrum is from an external source file
      attr_accessor :from_external_source_file

      # an InstrumentConfiguration object
      attr_accessor :instrument_configuration

      # ScanWindow objects
      attr_accessor :scan_windows

      def initialize(opts={params: []}, &block)
        describe!(*opts[:params])
        block.call(self) if block
      end

      # takes a nokogiri node
      #def self.from_xml(xml)
      #end

      def to_xml(builder)
        atts = {}
        if @from_external_source_file
          atts[:sourceFileRef] = @spectrum.source_file.id
          atts[:externalSpectrumRef] = @spectrum.id
        else
          atts[:spectrumRef] = @spectrum.id if @spectrum
        end
        atts[:instrumentConfigurationRef] = @instrument_configuration.id if @instrument_configuration
        builder.scan(atts) do |prec_n|
          super(prec_n) # description
          ScanWindow.list_xml(@scan_windows, prec_n) if @scan_windows
        end
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mspire-0.7.5 lib/mspire/mzml/scan.rb
mspire-0.7.4 lib/mspire/mzml/scan.rb
mspire-0.7.3 lib/mspire/mzml/scan.rb
mspire-0.7.2 lib/mspire/mzml/scan.rb