module Mspire::ErrorRate::Decoy

Public Instance Methods

fppr(num_target, num_decoy, pi_not=1.0) click to toggle source

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

# 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) click to toggle source

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

# 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