Class: Mzml_reader

Inherits:
Object
  • Object
show all
Defined in:
lib/ms/curvefit/mzml_reader.rb

Class Method Summary collapse

Class Method Details

.get_data(file) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ms/curvefit/mzml_reader.rb', line 5

def self.get_data(file)
  mzs_out = []
  rts_out = []
  ints_out = []
  io = File.open(file)
  mzml = Mspire::Mzml.new(io)

  mzml.each do |spec|
    next unless spec.ms_level == 1
    ints = spec.intensities
    mzs = spec.mzs
    rt = spec.retention_time

    if ints.empty?;else
      ints.each_with_index do |i,j|
        mzs_out<<mzs[j]
        rts_out<<rt
        ints_out<<i
      end
    end
  end
  return mzs_out,rts_out,ints_out
end