Sha256: 4ec65c6400bddc406797c9d45a9a3c0f7a524d87f83e706f93898764772dd0f4

Contents?: true

Size: 1.6 KB

Versions: 1

Compression:

Stored size: 1.6 KB

Contents

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


class BioworksToPepXMLTest < Test::Unit::TestCase

  def initialize(arg)
    super(arg)
    @tfiles = File.dirname(__FILE__) + '/tfiles/'
    @tf_mzxml_path = @tfiles + "yeast_gly_mzXML"
    @tf_bioworks_xml = @tfiles + "bioworks_small.xml"
    @tf_params = @tfiles + "bioworks32.params"
    @tf_opd1 = @tfiles + "opd1/bioworks.000.oldparams.xml"
    @tf_opd1_mzxml = @tfiles + "opd1/000.mzXML.timeIndex"
    @no_delete = false
    @out_path = @tfiles + 'pepxml/'
    @cmd = "ruby -I#{File.join(File.dirname(__FILE__), "..", "lib")} -S bioworks_to_pepxml.rb "
  end

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

  def _basic(cmd, prc)
    puts "Performing: #{cmd}"
    puts `#{cmd}`
    %w(000 020).each do |file|
      ffile = @out_path + file + ".xml"
      prc.call(ffile)
    end
  end

  def test_basic
    cmd = "#{@cmd} -p #{@tf_params} -o #{@out_path} #{@tf_bioworks_xml} -m #{@tf_mzxml_path} -d /work/special/path"
    prc = proc {|file| 
      assert(File.exist?(file), "#{file} exists")
    }
    _basic(cmd, prc)
    unless @no_delete then FileUtils.rm_rf(@out_path) end
  end

  def test_database
    cmd = "#{@cmd} -p #{@tf_params} -o #{@out_path} #{@tf_bioworks_xml} -m #{@tf_mzxml_path}" 
    db_re = /C:\\Xcalibur\\database\\ecoli_K12_ncbi_20060321.fasta/
    assert_match(db_re, IO.read(@tf_params))
    prc = proc {|file|
      assert(File.exist?(file))
      assert_no_match(db_re, IO.read(file))
    }
    _basic(cmd, prc)
    unless @no_delete then FileUtils.rm_rf(@out_path) end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mspire-0.1.5 test/tc_bioworks_to_pepxml.rb