class MS::Lipid::Ion

a lipid with modifications (typically the mods give it a charge so that it can be seen in the mass spec)

Attributes

lipid[RW]

an MS::Lipid object

modifications[RW]

an MS::Lipid::Modifications object

Public Class Methods

new(lipid, mods=[]) click to toggle source

the key attribute of a query

# File lib/ms/lipid/ion.rb, line 13
def initialize(lipid, mods=[])
  @lipid = lipid
  @modifications = mods
  @mz = nil
end

Public Instance Methods

inspect() click to toggle source
# File lib/ms/lipid/ion.rb, line 34
def inspect
  "<|| Ion mz=#{mz} #{lipid.inspect} + #{modifications.map(&:inspect).join(', ')} ||>"
end
mz() click to toggle source
# File lib/ms/lipid/ion.rb, line 19
def mz
  return @mz if @mz
  mass = @lipid.mass
  charge = 0
  @modifications.each do |mod|
    mass += mod.massdiff 
    charge += mod.charge
  end
  if charge == 0
    @mz = nil
  else
    @mz = mass / charge
  end
end