def test_iterative_prediction(self): os.chdir(default_wd) reffolder = self.get_ref_folder() resfolder = self.get_res_folder() os.mkdir(resfolder) species_list = ['nasonia', 'zebrafish', 'tomato'] # run augustus several times with different parameter sets for species in species_list: testtmpfile = os.path.join( resfolder, 'aug.' + species + '.1-1M_tmp.gff') self.process([ augustusbin, '--species=' + species, f'{tmpdir}chr2L.sm.fa', '--softmasking=on', '--predictionEnd=1000000' ], testtmpfile) # filter output testfile = os.path.join(resfolder, 'aug.' + species + '.1-1M.gff') afilter.pred(testtmpfile, testfile) os.remove(testtmpfile) # compare results self.assertEqualFolders(reffolder, resfolder)
def test_iterative_prediction_with_hints(self): os.chdir(default_wd) reffolder = self.get_ref_folder() resfolder = self.get_res_folder() os.mkdir(resfolder) if not os.path.isfile('data/tmp/chr2L.sm.fa'): TestAugustus.init_test_data() for i in range(0, 3): testtmpfile = os.path.join( resfolder, f'aug.nasonia.hints.{str(i)}_tmp.gff') self.process([ augustusbin, '--species=nasonia', f'{tmpdir}chr2L.sm.fa', '--softmasking=on', '--predictionStart=' + str(i * 2000000), '--predictionEnd=' + str((i + 1) * 2000000 + 50000), '--hintsfile=../../docs/tutorial2015/results/hints.gff', '--extrinsicCfgFile=extrinsic.M.RM.E.W.cfg' ], testtmpfile) # filter output testfile = os.path.join( resfolder, f'aug.nasonia.hints.{str(i)}.gff') afilter.pred(testtmpfile, testfile) os.remove(testtmpfile) # compare results self.assertEqualFolders(reffolder, resfolder)
def test_alternatives_from_sampling(self): os.chdir(default_wd) resfolder = resultdir + self.test_alternatives_from_sampling.__name__ + '/' os.mkdir(resfolder) with open(resfolder + 'augustus_tmp.gff', 'w') as file: cmd = [ augustusbin, '../../examples/autoAug/genome.fa', '--species=caenorhabditis', '--alternatives-from-sampling=on', '--minexonintronprob=0.08', '--minmeanexonintronprob=0.4', '--maxtracks=3' ] p = subprocess.Popen(cmd, stdout=file, stderr=subprocess.PIPE, universal_newlines=True) p.wait() error = p.stderr.read() p.stderr.close() self.assertEqual(error, '', error) # filter output file self.assertTrue(os.path.isfile(resfolder + 'augustus_tmp.gff'), 'Output file was not created as expected!') afilter.pred(resfolder + 'augustus_tmp.gff', resfolder + 'augustus.gff') os.remove(resfolder + 'augustus_tmp.gff') # compare results if TestAugustus.opt_compare: diff = comp.compare_folder( refdir + self.test_alternatives_from_sampling.__name__ + '/', resfolder, html=TestAugustus.opt_html) self.assertEqual(diff, '', diff)
def test_format_and_error_out(self): os.chdir(default_wd) resfolder = resultdir + self.test_format_and_error_out.__name__ + '/' os.mkdir(resfolder) cmd = [ augustusbin, '../../examples/autoAug/genome.fa', '--species=caenorhabditis', '--gff3=on', '--softmasking=1', '--outfile=' + resfolder + 'augustus_tmp.gff3', '--errfile=' + resfolder + 'augustus.err' ] p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) p.wait() error = p.stderr.read() p.stdout.close() p.stderr.close() self.assertEqual(error, '', error) # filter output file self.assertTrue(os.path.isfile(resfolder + 'augustus_tmp.gff3'), 'Output file was not created as expected!') afilter.pred(resfolder + 'augustus_tmp.gff3', resfolder + 'augustus.gff3') os.remove(resfolder + 'augustus_tmp.gff3') # compare results if TestAugustus.opt_compare: diff = comp.compare_folder( refdir + self.test_format_and_error_out.__name__ + '/', resfolder, html=TestAugustus.opt_html) self.assertEqual(diff, '', diff)
def test_utr_on(self): os.chdir(default_wd) resfolder = resultdir + self.test_utr_on.__name__ + '/' os.mkdir(resfolder) with open(resfolder + 'aug_utr_on_tmp.gff', 'w') as file: p = subprocess.Popen([ augustusbin, '--species=human', '--UTR=on', '--softmasking=0', '../../examples/example.fa' ], stdout=file, stderr=subprocess.PIPE, universal_newlines=True) rc = p.wait() error = p.stderr.read() p.stderr.close() self.assertEqual(error, '', error) self.assertEqual(rc, 0, 'Returncode not 0!') self.assertTrue(os.path.isfile((resfolder + 'aug_utr_on_tmp.gff')), 'Output file was not created as expected!') # filter output file afilter.pred(resfolder + 'aug_utr_on_tmp.gff', resfolder + 'aug_utr_on.gff') os.remove(resfolder + 'aug_utr_on_tmp.gff') # compare results if TestAugustus.opt_compare: diff = comp.compare_folder(refdir + self.test_utr_on.__name__ + '/', resfolder, html=TestAugustus.opt_html) self.assertEqual(diff, '', diff)
def test_iterative_prediction_with_hints(self): os.chdir(default_wd) resfolder = resultdir + self.test_iterative_prediction_with_hints.__name__ + '/' proc_list = [] if not os.path.isfile('data/tmp/chr2L.sm.fa'): init_test_data() os.mkdir(resfolder) for i in range(0, 3): with open(resfolder + 'aug.nasonia.hints.' + str(i) + '_tmp.gff', 'w') as file: proc_list.append( subprocess.Popen([ augustusbin, '--species=nasonia', 'data/tmp/chr2L.sm.fa', '--softmasking=on', '--predictionStart=' + str(i * 2000000), '--predictionEnd=' + str((i + 1) * 2000000 + 50000), '--hintsfile=../docs/tutorial2015/results/hints.gff', '--extrinsicCfgFile=extrinsic.M.RM.E.W.cfg' ], stdout=file, stderr=subprocess.PIPE, universal_newlines=True)) for p in proc_list: p.wait() for p in proc_list: error = p.stderr.read() p.stderr.close() self.assertEqual(error, '', error) # filter output for i in range(0, 3): source = resfolder + 'aug.nasonia.hints.' + str(i) + '_tmp.gff' self.assertTrue(os.path.isfile(source), 'Output file was not created as expected!') target = resfolder + 'aug.nasonia.hints.' + str(i) + '.gff' afilter.pred(source, target) os.remove(source) # compare results if TestAugustus.opt_compare: diff = comp.compare_folder( refdir + self.test_iterative_prediction_with_hints.__name__ + '/', resfolder, html=TestAugustus.opt_html) self.assertEqual(diff, '', diff)
def test_iterative_prediction(self): os.chdir(default_wd) resfolder = resultdir + self.test_iterative_prediction.__name__ + '/' species_list = ['nasonia', 'zebrafish', 'tomato'] proc_list = [] # run augustus several times with different parameter sets os.mkdir(resfolder) for species in species_list: with open(resfolder + 'aug.' + species + '.1-1M_tmp.gff', 'w') as file: proc_list.append( subprocess.Popen([ augustusbin, '--species=' + species, 'data/tmp/chr2L.sm.fa', '--softmasking=on', '--predictionEnd=1000000' ], stdout=file, stderr=subprocess.PIPE, universal_newlines=True)) for p in proc_list: p.wait() for p in proc_list: error = p.stderr.read() p.stderr.close() self.assertEqual(error, '', error) # filter output for species in species_list: source = resfolder + 'aug.' + species + '.1-1M_tmp.gff' self.assertTrue(os.path.isfile(source), 'Output file was not created as expected!') target = resfolder + 'aug.' + species + '.1-1M.gff' afilter.pred(source, target) os.remove(source) # compare results if TestAugustus.opt_compare: diff = comp.compare_folder( refdir + self.test_iterative_prediction.__name__ + '/', resfolder, html=TestAugustus.opt_html) self.assertEqual(diff, '', diff)
def test_ab_initio_prediction(self): os.chdir(default_wd) reffolder = self.get_ref_folder() resfolder = self.get_res_folder() testtmpfile = os.path.join(resfolder, 'augustus_tmp.gff') testfile = os.path.join(resfolder, 'augustus.gff') os.mkdir(resfolder) self.process([ augustusbin, f'{exampledir}autoAug/genome.fa', '--softmasking=1', '--species=caenorhabditis' ], testtmpfile) # filter output file afilter.pred(testtmpfile, testfile) os.remove(testtmpfile) # compare results self.assertEqualFolders(reffolder, resfolder)
def test_utr_on(self): os.chdir(default_wd) reffolder = self.get_ref_folder() resfolder = self.get_res_folder() testtmpfile = os.path.join(resfolder, 'aug_utr_on_tmp.gff') testfile = os.path.join(resfolder, 'aug_utr_on.gff') os.mkdir(resfolder) self.process([ augustusbin, '--species=human', '--UTR=on', '--softmasking=0', f'{exampledir}example.fa' ], testtmpfile) # filter output file afilter.pred(testtmpfile, testfile) os.remove(testtmpfile) # compare results self.assertEqualFolders(reffolder, resfolder)
def test_hints_MPE(self): reffolder = self.get_ref_folder() resfolder = self.get_res_folder() testtmpfile = os.path.join(resfolder, 'aug_hints_MPE_tmp.gff') testfile = os.path.join(resfolder, 'aug_hints_MPE.gff') os.chdir(default_wd) os.mkdir(resfolder) self.process([ augustusbin, '--species=human', f'--hintsfile={exampledir}hints.gff', '--extrinsicCfgFile=../../config/extrinsic/extrinsic.MPE.cfg', f'{exampledir}example.fa' ], testtmpfile) # filter output file afilter.pred(testtmpfile, testfile) os.remove(testtmpfile) # compare results self.assertEqualFolders(reffolder, resfolder)
def test_alternatives_from_sampling(self): os.chdir(default_wd) reffolder = self.get_ref_folder() resfolder = self.get_res_folder() testtmpfile = os.path.join(resfolder, 'augustus_tmp.gff') testfile = os.path.join(resfolder, 'augustus.gff') os.mkdir(resfolder) cmd = [ augustusbin, f'{exampledir}autoAug/genome.fa', '--species=caenorhabditis', '--alternatives-from-sampling=on', '--minexonintronprob=0.08', '--minmeanexonintronprob=0.4', '--maxtracks=3' ] self.process(cmd, testtmpfile) # filter output file afilter.pred(testtmpfile, testfile) os.remove(testtmpfile) # compare results self.assertEqualFolders(reffolder, resfolder)
def test_format_and_error_out(self): os.chdir(default_wd) reffolder = self.get_ref_folder() resfolder = self.get_res_folder() testtmpfile = os.path.join(resfolder, 'augustus_tmp.gff3') testfile = os.path.join(resfolder, 'augustus.gff3') os.mkdir(resfolder) cmd = [ augustusbin, f'{exampledir}autoAug/genome.fa', '--species=caenorhabditis', '--gff3=on', '--softmasking=1', '--outfile=' + testtmpfile, '--errfile=' + resfolder + '/augustus.err' ] self.process(cmd) # filter output file self.assertTrue(os.path.isfile(testtmpfile), 'Output file was not created as expected!') afilter.pred(testtmpfile, testfile) os.remove(testtmpfile) # compare results self.assertEqualFolders(reffolder, resfolder)
def test_hints_MPE(self): dirname = self.test_hints_MPE.__name__ fname = "aug_hints_MPE.gff" tfname = "aug_hints_MPE_tmp.gff" os.chdir(default_wd) resfolder = resultdir + dirname + '/' os.mkdir(resfolder) with open(resfolder + tfname, 'w') as file: p = subprocess.Popen([ augustusbin, '--species=human', '--hintsfile=../../examples/hints.gff', '--extrinsicCfgFile=../../config/extrinsic/extrinsic.MPE.cfg', '../../examples/example.fa' ], stdout=file, stderr=subprocess.PIPE, universal_newlines=True) rc = p.wait() error = p.stderr.read() p.stderr.close() self.assertEqual(error, '', error) self.assertEqual(rc, 0, 'Returncode not 0!') self.assertTrue(os.path.isfile((resfolder + tfname)), 'Output file was not created as expected!') # filter output file afilter.pred(resfolder + tfname, resfolder + fname) os.remove(resfolder + tfname) # compare results if TestAugustus.opt_compare: diff = comp.compare_folder(refdir + dirname + '/', resfolder, html=TestAugustus.opt_html) self.assertEqual(diff, '', diff)