Sha256: b985413d7d318e30814eb79a3ea27c3f63e960796778a59e6ca2fdc2e4de28c1

Contents?: true

Size: 1.34 KB

Versions: 25

Compression:

Stored size: 1.34 KB

Contents

require 'spec_helper'

require 'mspire/mzml'
require 'mspire/mzml/spectrum'

describe Mspire::Mzml::Spectrum do

  describe 'creating an ms1 spectrum from xml' do
    before(:all) do
      @io = File.open(TESTFILES + "/mspire/mzml/j24z.idx_comp.3.mzML")
      @mzml = Mspire::Mzml.new(@io)
    end

    after(:all) do
      @io.close
    end

    it 'gathers key data for ms1 spectrum' do
      spec = @mzml.run.spectrum_list[0]

      # convenient access to common attributes 
      spec.retention_time.should == 1981.5726
      spec.ms_level.should == 1

      spec.precursor_mz.should be_nil
      spec.precursor_charge.should be_nil

      # array info
      spec.mzs.size.should == 20168
      spec.intensities.size.should == 20168

      params = spec.params
      params.size.should == 9
      params.first.should be_a(::CV::Param)
    end

    it 'gathers key data for ms2 spectrum' do
      spec = @mzml.run.spectrum_list[1]

      # convenient access to common attributes 
      spec.retention_time.should == 1982.1077
      spec.ms_level.should == 2

      spec.precursor_mz.should == 479.7644958496094
      spec.precursor_charge.should == 2 

      # array info
      spec.mzs.size.should == 315
      spec.intensities.size.should == 315

      params = spec.params
      params.size.should == 9
      params.first.should be_a(::CV::Param)
    end

  end

end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
mspire-0.10.8.0 spec/mspire/mzml/spectrum_spec.rb
mspire-0.10.7.3 spec/mspire/mzml/spectrum_spec.rb
mspire-0.10.7.2 spec/mspire/mzml/spectrum_spec.rb
mspire-0.10.7.1 spec/mspire/mzml/spectrum_spec.rb
mspire-0.10.7 spec/mspire/mzml/spectrum_spec.rb
mspire-0.10.6 spec/mspire/mzml/spectrum_spec.rb
mspire-0.10.5 spec/mspire/mzml/spectrum_spec.rb
mspire-0.10.4 spec/mspire/mzml/spectrum_spec.rb
mspire-0.10.3 spec/mspire/mzml/spectrum_spec.rb
mspire-0.10.2 spec/mspire/mzml/spectrum_spec.rb
mspire-0.10.1 spec/mspire/mzml/spectrum_spec.rb
mspire-0.10.0 spec/mspire/mzml/spectrum_spec.rb
mspire-0.9.2 spec/mspire/mzml/spectrum_spec.rb
mspire-0.9.1 spec/mspire/mzml/spectrum_spec.rb
mspire-0.9.0 spec/mspire/mzml/spectrum_spec.rb
mspire-0.8.7 spec/mspire/mzml/spectrum_spec.rb
mspire-0.8.6.2 spec/mspire/mzml/spectrum_spec.rb
mspire-0.8.6.1 spec/mspire/mzml/spectrum_spec.rb
mspire-0.8.6 spec/mspire/mzml/spectrum_spec.rb
mspire-0.8.5 spec/mspire/mzml/spectrum_spec.rb