Sha256: 3d77934a01ca0106f5d46d017304baafbe829e5db6e5a8ba62dc4cdfc9e3196f

Contents?: true

Size: 1.31 KB

Versions: 5

Compression:

Stored size: 1.31 KB

Contents

require 'ms/mzml/list'
require 'ms/mzml/selected_ion'

module MS
  class Mzml
    # The method of precursor ion selection and activation
    class Precursor
      # (optional) the MS::Mzml::Spectrum object from which the precursor is
      # derived
      attr_accessor :spectrum

      # (optional)
      attr_accessor :isolation_window 

      # (optional) An array of ions that were selected.
      attr_accessor :selected_ions

      # (required) The type and energy level used for activation.
      attr_accessor :activation

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

      def initialize(spectrum_derived_from=nil)
        @spectrum=spectrum_derived_from
      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
        builder.precursor(atts) do |prec_n|
          @isolation_window.to_xml(prec_n) if @isolation_window
          MS::Mzml::SelectedIon.list_xml(@selected_ions, prec_n) if @selected_ions
          @activation.to_xml(prec_n) if @activation
        end
      end

      extend(MS::Mzml::List)

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mspire-0.6.26 lib/ms/mzml/precursor.rb
mspire-0.6.25 lib/ms/mzml/precursor.rb
mspire-0.6.24 lib/ms/mzml/precursor.rb
mspire-0.6.22 lib/ms/mzml/precursor.rb
mspire-0.6.21 lib/ms/mzml/precursor.rb