Class: MS::Lipid::Search::Hit

Inherits:
Object
  • Object
show all
Defined in:
lib/ms/lipid/search/hit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}) ⇒ Hit

Returns a new instance of Hit.



22
23
24
# File 'lib/ms/lipid/search/hit.rb', line 22

def initialize(hash={})
  hash.each {|k,v| instance_variable_set("@#{k}", v) }
end

Instance Attribute Details

#db_isobar_groupObject

the db_isobar_group this hit is associated with. Each hit is only associated with a single db_isobar_group!



8
9
10
# File 'lib/ms/lipid/search/hit.rb', line 8

def db_isobar_group
  @db_isobar_group
end

#observed_mzObject

the experimental m/z value



10
11
12
# File 'lib/ms/lipid/search/hit.rb', line 10

def observed_mz
  @observed_mz
end

#probability_distributionObject

the probability distribution that can be used to determine its pvalue



20
21
22
# File 'lib/ms/lipid/search/hit.rb', line 20

def probability_distribution
  @probability_distribution
end

#pvalueObject

the probability the hit is due to random chance



12
13
14
# File 'lib/ms/lipid/search/hit.rb', line 12

def pvalue
  @pvalue
end

#qvalueObject

the FDR if the threshold accepts this pvalue. Note that this value is relative to the number of tests performed and not completely intrinsic to the hit itself.



16
17
18
# File 'lib/ms/lipid/search/hit.rb', line 16

def qvalue
  @qvalue
end

Instance Method Details

#deltaObject Also known as: amu

observed_mz - query m/z



27
28
29
# File 'lib/ms/lipid/search/hit.rb', line 27

def delta
  @observed_mz - @db_isobar_group.first.mz.to_f
end

#delta_absObject

the absolute value of distance from true val



34
35
36
# File 'lib/ms/lipid/search/hit.rb', line 34

def delta_abs
  delta.abs
end

#inspectObject



47
48
49
# File 'lib/ms/lipid/search/hit.rb', line 47

def inspect
  "<<#{super} -- <ppm=#{ppm} delta=#{delta} theoretical_mz=#{theoretical_mz}>>"
end

#ppmObject

parts per million (divided by theoretical m/z)



39
40
41
# File 'lib/ms/lipid/search/hit.rb', line 39

def ppm
  (delta / @db_isobar_group.first.mz) * 1e6
end

#theoretical_mzObject



43
44
45
# File 'lib/ms/lipid/search/hit.rb', line 43

def theoretical_mz
  @db_isobar_group.first.mz
end