lib/validator/decoy.rb in mspire-0.4.5 vs lib/validator/decoy.rb in mspire-0.4.7
- old
+ new
@@ -7,14 +7,15 @@
attr_accessor :constraint
attr_accessor :decoy_on_match
attr_accessor :correct_wins
# This is the the number of incorrect target hits over the total decoy hits
- # The very rough, conservative ballpark estimate is the ratio of target hits
- # to decoy hits. This can be refined by removing the number of true target
+ # The percent incorrect targets (PIT) expressed as a fraction (== 1 - PI_0).
+ # The rough, conservative ballpark estimate is the ratio of target hits to
+ # decoy hits. This can be refined by removing the number of true target
# hits from the targets used to calculate it.
- attr_accessor :pi_zero
+ attr_accessor :frit
attr_accessor :last_pep_was_decoy
attr_accessor :increment_normal
attr_accessor :increment_decoy
@@ -23,16 +24,16 @@
attr_reader :normal_peps_just_submitted
DEFAULTS = {
:decoy_on_match => true,
:correct_wins => true,
- :pi_zero => 1.0,
+ :frit => 1.0,
}
def initialize(opts={})
merged = DEFAULTS.merge(opts)
- @constraint, @decoy_on_match, @correct_wins, @pi_zero = merged.values_at(:constraint, :decoy_on_match, :correct_wins, :pi_zero)
+ @constraint, @decoy_on_match, @correct_wins, @frit = merged.values_at(:constraint, :decoy_on_match, :correct_wins, :frit)
end
# returns [normal, decoy] (?? I think ??)
# reads the full protein reference
def partition(peps)
@@ -84,18 +85,18 @@
@increment_total_submitted += to_submit.size
(normal, decoy) = partition(to_submit)
@normal_peps_just_submitted = normal
@increment_normal += normal.size
@increment_decoy += decoy.size
- calc_precision(@increment_normal, @increment_decoy, @pi_zero)
+ calc_precision(@increment_normal, @increment_decoy, @frit)
end
def pephit_precision(peps, separate_peps=nil)
if separate_peps
- calc_precision(peps.size, separate_peps.size, @pi_zero)
+ calc_precision(peps.size, separate_peps.size, @frit)
else
(norm, decoy) = partition(peps)
- calc_precision(norm.size, decoy.size, @pi_zero)
+ calc_precision(norm.size, decoy.size, @frit)
end
end
def to_param_string
"decoy="+ ["{constraint=#{(constraint ? constraint.inspect : '')}", "decoy_on_match=#{@decoy_on_match}", "correct_wins=#{@correct_wins}}"].join(", ")