Sha256: cba6e733d46ea8c788ae74fc4af2beb21667327cdab756a56b8df7a8797cdd32

Contents?: true

Size: 993 Bytes

Versions: 6

Compression:

Stored size: 993 Bytes

Contents


# from percolator
# This is a trivial class (since q-values are so straightforward with regards
# to precision), but it allows us to work with q-values using the same
# interface as all other validators
class Validator::QValue

  # objs should respond_to :q_value
  # q-values: 0.0 means no false discoveries, 0.5 means 50% false discoveries
  # 1 - (the largest q value) is the precision
  def precision(objs)
    return 1.0 if objs.size == 0
    largest_q_value = objs.map {|v| v.q_value }.max
    prec = 1.0 - largest_q_value
  end


  # objs should respond_to :q_value
  # These should be added from low q-value to high q-value
  # The last q-value added determines the precision
  def increment_precision(objs)
    if objs.is_a?(SpecID::Pep) or objs.is_a?(SpecID::Prot)
      objs = [objs]
    end
    precision(objs)
  end

  alias_method :pephit_precision, :precision
  alias_method :prothit_precision, :precision
  alias_method :increment_pephits_precision, :increment_precision
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mspire-0.4.9 lib/validator/q_value.rb
mspire-0.3.9 lib/validator/q_value.rb
mspire-0.4.4 lib/validator/q_value.rb
mspire-0.4.2 lib/validator/q_value.rb
mspire-0.4.5 lib/validator/q_value.rb
mspire-0.4.7 lib/validator/q_value.rb