Class: MS::Lipid::Ion
- Inherits:
-
Object
- Object
- MS::Lipid::Ion
- Defined in:
- lib/ms/lipid/ion.rb
Overview
a lipid with modifications (typically the mods give it a charge so that it can be seen in the mass spec)
Instance Attribute Summary collapse
-
#lipid ⇒ Object
an MS::Lipid object.
-
#modifications ⇒ Object
an MS::Lipid::Modifications object.
Instance Method Summary collapse
-
#initialize(lipid, mods = []) ⇒ Ion
constructor
the key attribute of a query.
- #inspect ⇒ Object
- #mz ⇒ Object
Constructor Details
#initialize(lipid, mods = []) ⇒ Ion
the key attribute of a query
13 14 15 16 17 |
# File 'lib/ms/lipid/ion.rb', line 13 def initialize(lipid, mods=[]) @lipid = lipid @modifications = mods @mz = nil end |
Instance Attribute Details
#lipid ⇒ Object
an MS::Lipid object
8 9 10 |
# File 'lib/ms/lipid/ion.rb', line 8 def lipid @lipid end |
#modifications ⇒ Object
an MS::Lipid::Modifications object
10 11 12 |
# File 'lib/ms/lipid/ion.rb', line 10 def modifications @modifications end |
Instance Method Details
#inspect ⇒ Object
34 35 36 |
# File 'lib/ms/lipid/ion.rb', line 34 def inspect "<|| Ion mz=#{mz} #{lipid.inspect} + #{modifications.map(&:inspect).join(', ')} ||>" end |
#mz ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# 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 |