Sha256: e107e761bcb87481ce0f78904ef31c9e52dad953a277e5489787713dbe25cae6

Contents?: true

Size: 1.26 KB

Versions: 10

Compression:

Stored size: 1.26 KB

Contents

require 'ms/cv/paramable'

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

      # (optional) the MS::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

      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

10 entries across 10 versions & 1 rubygems

Version Path
mspire-0.6.25 lib/ms/mzml/scan.rb
mspire-0.6.24 lib/ms/mzml/scan.rb
mspire-0.6.22 lib/ms/mzml/scan.rb
mspire-0.6.21 lib/ms/mzml/scan.rb
mspire-0.6.20 lib/ms/mzml/scan.rb
mspire-0.6.19 lib/ms/mzml/scan.rb
mspire-0.6.18 lib/ms/mzml/scan.rb
mspire-0.6.12 lib/ms/mzml/scan.rb
mspire-0.6.11 lib/ms/mzml/scan.rb
mspire-0.6.9 lib/ms/mzml/scan.rb