require_relative '../../macroape' module Macroape module CLI module FindThreshold def self.main(argv) doc = <<-EOS.strip_doc Command-line format: #{run_tool_cmd} [...] [options] Options: [-d ] [--pcm] - treat the input file as Position Count Matrix. PCM-to-PWM transformation to be done internally. [--boundary lower|upper] Lower boundary (default) means that the obtained P-value is less than or equal to the requested P-value [-b (pvalue, threshold, real_pvalue) do infos << {expected_pvalue: pvalue, threshold: threshold / discretization, real_pvalue: real_pvalue, recognized_words: pwm.vocabulary_volume * real_pvalue } end if pvalue_boundary == :lower pwm.thresholds(*pvalues, &collect_infos_proc) else pwm.weak_thresholds(*pvalues, &collect_infos_proc) end puts Helper.threshold_infos_string(infos, {discretization: discretization, background: background, pvalue_boundary: pvalue_boundary} ) rescue => err $stderr.puts "\n#{err}\n#{err.backtrace.first(5).join("\n")}\n\nUse --help option for help\n\n#{doc}" end end end end