Sha256: ef0aa7e5e458bc1e98aa4fd3dbfb48e82bd5781e4c165c330cfbfe2c92a523b9

Contents?: true

Size: 1.64 KB

Versions: 1

Compression:

Stored size: 1.64 KB

Contents

require 'test/unit'
require File.dirname(__FILE__) + '/load_lib_path'
require File.dirname(__FILE__) + '/load_bin_path'


class FalsePositiveRateTest < Test::Unit::TestCase

  def initialize(arg)
    super(arg)
    @tfiles = File.dirname(__FILE__) + '/tfiles/'
    @tf_bioworks_esmall_xml = @tfiles + "bioworks_with_INV_small.xml" 
    @tf_bioworks_small_xml = @tfiles + "bioworks_small.xml"
    @tf_bioworks_shuff = @tfiles + "bioworks_with_SHUFF_small.xml"
    @cmd = "ruby -I#{LOAD_LIB_PATH} -S false_positive_rate.rb "
    @tf_html = "fpr.html"
    @tf_png = "fpr.png"
    @nodelete = false
  end

  def test_usage
    assert_match(/Usage:/, `#{@cmd}`)
  end

  def test_basic_double_dbs
    output = `#{@cmd} -pg -f #{@tf_bioworks_shuff} #{@tf_bioworks_small_xml} #{@tf_bioworks_small_xml}`
    assert_match('0.815', output, "precision")
    assert_match('0.369', output, "Gygi's fpr")
    assert_match('0.185', output, "fpr")
    assert_match('106', output, "num true positives")
    assert_match('24', output, "num false positives")
  end

  def test_basic_cat
    output = `#{@cmd} -o fpr.html -pg -f SHUFF_ #{@tf_bioworks_shuff}`
    puts output
    
    assert_match(/<table.*<\/table>/m, IO.read(@tf_html), "has html table in it")
    [@tf_html, @tf_png].each do |file|
      assert(File.exist?(file), "file #{file} exists")
      File.unlink(file) unless @nodelete
    end
  end

  def test_multiple_files
    output = `#{@cmd} -o fpr.html -pg -f SHUFF_,INV_ #{@tf_bioworks_shuff} #{@tf_bioworks_esmall_xml}`
    [@tf_html, @tf_png].each do |file|
      assert(File.exist?(file), "file #{file} exists")
      File.unlink(file) unless @nodelete
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mspire-0.1.3 test/tc_false_positive_rate.rb