Sha256: 3238302e60a908f4560a76a97d16f6e721f38fe2585b0498b1f2b5ab7f46405e

Contents?: true

Size: 1.11 KB

Versions: 13

Compression:

Stored size: 1.11 KB

Contents

require 'mspire/cv/paramable'
require 'mspire/mzml/scan'

module Mspire
  class Mzml

    # MUST supply a *child* term of MS:1000570 (spectra combination) only once
    #
    #     e.g.: MS:1000571 (sum of spectra)
    #     e.g.: MS:1000573 (median of spectra)
    #     e.g.: MS:1000575 (mean of spectra)
    #     e.g.: MS:1000795 (no combination)
    class ScanList < Array
      include Mspire::CV::Paramable

      def initialize
        params_init
        yield(self) if block_given?
      end

      def to_xml(builder, default_ids)
        builder.scanList(count: self.size) do |sl_n|
          super(sl_n)
          self.each do |scan|
            scan.to_xml(sl_n, default_ids)
          end
        end
        builder
      end

      def self.from_xml(xml, link)
        scan_list = self.new
        scan_n = scan_list.describe_from_xml!(xml, link[:ref_hash])
        if scan_n
          loop do
            scan_list << Mspire::Mzml::Scan.from_xml(scan_n, link)
            break unless scan_n = scan_n.next
          end
        end
        scan_list
      end

      alias_method :list_xml, :to_xml
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
mspire-0.9.2 lib/mspire/mzml/scan_list.rb
mspire-0.9.1 lib/mspire/mzml/scan_list.rb
mspire-0.9.0 lib/mspire/mzml/scan_list.rb
mspire-0.8.7 lib/mspire/mzml/scan_list.rb
mspire-0.8.6.2 lib/mspire/mzml/scan_list.rb
mspire-0.8.6.1 lib/mspire/mzml/scan_list.rb
mspire-0.8.6 lib/mspire/mzml/scan_list.rb
mspire-0.8.5 lib/mspire/mzml/scan_list.rb
mspire-0.8.4 lib/mspire/mzml/scan_list.rb
mspire-0.8.3 lib/mspire/mzml/scan_list.rb
mspire-0.8.2 lib/mspire/mzml/scan_list.rb
mspire-0.8.1 lib/mspire/mzml/scan_list.rb
mspire-0.8.0 lib/mspire/mzml/scan_list.rb