Beispiel #1
0
 def test_compilebwaoptions(self):
     ''' Make sure options supplied to constructor make it through to running '''
     bwa_path = self.mkbwa('$@')
     ops = {
         'R': None,
         'E': '',
         't': 3,
         'a': 5,
         'f': True,
         'j': 1,
         'bwa_path': bwa_path,
         'command': 'cmd'
     }
     bwa = BWASubTest(**ops)
     del ops['bwa_path']
     del ops['command']
     bwa.run('output')
     with open('output') as fh:
         result_output = fh.read().strip()
     print "Expect: {0}".format(ops)
     print "Result: {0}".format(result_output)
     for op, val in ops.items():
         uval = ''
         val = str(val)
         if val.lower() not in ('true', 'false'):
             uval = ' ' + val
         if val.lower() not in ('', 'none'):
             opval = '-{0}{1}'.format(op, uval)
             assert opval in result_output, '{0} not in {1}'.format(
                 opval, result_output)
         else:
             assert op not in result_output, '{0} should not be in {1}'.format(
                 op, result_output)
Beispiel #2
0
 def test_run_outputfile(self):
     ''' Test that output file can be specified and is used '''
     output_file = 'output.sai'
     output_text = "test output"
     path = self.mkbwa(output_text)
     bwa = BWASubTest(bwa_path=path, command='')
     # Should write output_text to output_file
     bwa.run(output_file)
     eq_(output_text, open(output_file).read().rstrip('\n'))
Beispiel #3
0
 def test_validfasta(self):
     ref = 'ref.fa'
     # Make copy in tempdir
     shutil.copy(REF_PATH, 'ref.fa')
     bwa = BWAIndex(ref, bwa_path=BWA_PATH)
     eq_(0, bwa.run())
     indexes = glob.glob(ref + '.*')
     print indexes
     eq_(len(indexes), 5, "Did not create all index files")
Beispiel #4
0
 def test_nooutputfile(self):
     ''' Ensure no output file is created '''
     os.mkdir('dir1')
     os.chdir('dir1')
     ref = 'ref.fa'
     # Make copy in tempdir
     shutil.copy(REF_PATH, 'ref.fa')
     bwa = BWAIndex(ref, bwa_path=BWA_PATH)
     eq_(0, bwa.run())
     assert not os.path.exists('bwa.sai')
     os.chdir('..')