Class: Sample

Inherits:
Object
  • Object
show all
Defined in:
bin/lipidomic-search.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, merge_opts = {}) ⇒ Sample

Returns a new instance of Sample.



22
23
24
25
# File 'bin/lipidomic-search.rb', line 22

def initialize(file, merge_opts={})
  @file = file
  @spectrum = merge_ms1_spectra(file, DEFAULTS.merge(merge_opts))
end

Instance Attribute Details

#fileObject

Returns the value of attribute file.



20
21
22
# File 'bin/lipidomic-search.rb', line 20

def file
  @file
end

#spectrumObject

Returns the value of attribute spectrum.



21
22
23
# File 'bin/lipidomic-search.rb', line 21

def spectrum
  @spectrum
end

Instance Method Details

#merge_ms1_spectra(file, opts) ⇒ Object

returns a single spectrum object



28
29
30
31
32
33
# File 'bin/lipidomic-search.rb', line 28

def merge_ms1_spectra(file, opts)
  spectra = []
  spectra = MS::Mzml.foreach(file).select {|spec| spec.ms_level == 1 }.map(&:sort!)

  MS::Spectrum.merge(spectra, opts)
end