Sha256: f6614e6b73da920396c04a57dc9ea99c4e562edcdaf62b3c90470fac977b2a9a

Contents?: true

Size: 540 Bytes

Versions: 5

Compression:

Stored size: 540 Bytes

Contents

require 'arrayclass'

module MS; end 

# charge_states are the possible charge states of the precursor
# parent references a scan
#                                 0  1         2      3 
MS::Precursor = Arrayclass.new(%w(mz intensity parent charge_states)) 

class MS::Precursor

  undef :intensity
  
  def intensity
    if self[1].nil?
      if s = self[2].spectrum
        self[1] = s.intensity_at_mz(self[0])
      else
        nil   # if we didn't read in the spectra, we can't get this value!
      end
    end
    self[1]
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mspire-0.4.9 lib/ms/precursor.rb
mspire-0.4.2 lib/ms/precursor.rb
mspire-0.4.4 lib/ms/precursor.rb
mspire-0.4.5 lib/ms/precursor.rb
mspire-0.4.7 lib/ms/precursor.rb