Module: Mspire::ErrorRate::Decoy

Extended by:
Decoy
Included in:
Decoy
Defined in:
lib/mspire/error_rate/decoy.rb

Class Method Summary collapse

Class Method Details

.fppr(num_target, num_decoy, pi_not = 1.0) ⇒ Object

the false positive predictive rate (sometimes called the false positive rate). This is 1 - precision



33
34
35
# File 'lib/mspire/error_rate/decoy.rb', line 33

def fppr(num_target, num_decoy, pi_not=1.0)
  1.0 - precision(num_target, num_decoy, pi_not=1.0)
end

.precision(num_target, num_decoy, pi_not = 1.0) ⇒ Object

this is the # true positives (found by estimating the number of false hits using the # decoy) pi_not is the ratio of decoy hits to the estimated false hits in the target set. A data set with a small fraction of true hits will have a pi_not close to 1. A data set where 40% of the hits are correct should have a pi_not of 0.6. For instance, Spivak uses a fixed pi_not of 0.9 in J. Proteome Res., 2009, 8 (7), pp 3737–3745



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/mspire/error_rate/decoy.rb', line 15

def precision(num_target, num_decoy, pi_not=1.0)
  num_target_f = num_target.to_f
  num_true_pos = num_target_f - (num_decoy.to_f * pi_not)
  precision =
    if num_target_f == 0.0
      if num_decoy.to_f > 0.0
        0.0
      else
        1.0
      end
    else
      num_true_pos/num_target_f
    end
  precision
end