def test_BA_one_pred_method_simple(self): a = base_script + [ '--blast_in', self.blast_xml, '--blast_query', self.query_double, '--blast_db', blast_db, '--mode', 'simple', '--blast_regexp', r'(?<=\|)[A-Z0-9]*\.?\d*$', '--b_type', 'xml', '--html', self.html, '--json', self.json, '--csv', self.csv, '--pandas_dump', self.pandas_dump, '--prediction_method', 'rnafold', '--enable_overwrite', '--threads', '2', ] bb = call(a, cwd=root) self.assertEqual(bb, 0) # we have two input query sequences so output files will be numbered t = tab_output_equal( csvfile=iter2file_name(self.csv, True, 0), jsonfile=iter2file_name(self.json, True, 0), pdfile=iter2file_name(self.pandas_dump, True, 0), ) self.assertTrue(t) t = tab_output_equal( csvfile=iter2file_name(self.csv, True, 1), jsonfile=iter2file_name(self.json, True, 1), pdfile=iter2file_name(self.pandas_dump, True, 1), ) self.assertTrue(t) remove_files_with_try([ iter2file_name(self.csv, True, 0), iter2file_name(self.json, True, 0), iter2file_name(self.pandas_dump, True, 0), iter2file_name(self.html, True, 0), iter2file_name(self.csv, True, 1), iter2file_name(self.json, True, 1), iter2file_name(self.pandas_dump, True, 1), iter2file_name(self.html, True, 1) ], '')
def test_BA_one_pred_method_locarna(self): a = base_script + [ '--blast_in', blast_in, '--blast_query', blast_query, '--blast_db', blast_db, '--mode', 'locarna', '--b_type', 'xml', '--html', self.html, '--json', self.json, '--csv', self.csv, '--prediction_method', 'rnafold', '--enable_overwrite', ] bb = call(a, cwd=root) self.assertEqual(bb, 0) t = tab_output_equal( csvfile=self.csv, jsonfile=self.json, ) self.assertTrue(t)
def run(mm): bb = call(self.cmd + ['--prediction_method', mm], cwd=root) self.assertEqual(bb, 0) t = tab_output_equal( csvfile=self.csv, jsonfile=self.json, pdfile=self.pandas_dump, ) self.assertTrue(t)
def run(mm): bb = call(self.cmd + ['--prediction_method', mm], cwd=root) self.assertEqual(bb, 0) t = tab_output_equal( csvfile=self.csv, jsonfile=self.json, pdfile=self.pandas_dump, ) self.assertTrue(t) with open(self.json, 'r') as j: data = json.load(j) # check if prediction params are empty self.assertEqual(data['args']['pred_params'][mm], {})
def test_continuation2(self): with open(blast_output, 'r') as f, open(self.test_backup_file, 'w') as ff: data = blastsearchrecomputefromdict(json.load(f)) data.args.blast_in = blast_in data.args.json = None data.args.html = test_output_file data.args.sha1 = self.sha1 data.args.prediction_method += ['centroid'] new_structures = {'rnafold': []} for h in data.hits: n = copy(h.extension) n.letter_annotations['ss0'] = n.letter_annotations['rnafold'] del n.letter_annotations['rnafold'] new_structures['rnafold'].append(n) json.dump([blastsearchrecompute2dict(data)], ff, indent=2) out = lunch_with_args(self.args) self.assertEqual(1, 1) # test_output for i in range(len(out)): out[0].to_csv(self.csv) j_obj = json.dumps(blastsearchrecompute2dict(out[0]), indent=2) with open(self.json, 'w') as ff: ff.write(j_obj) out[0].write_results_fasta(self.fasta) out[0].write_results_structures(self.fasta_structures) t = tab_output_equal(csvfile=self.csv, jsonfile=self.json, fastafile=self.fasta, fastastructures=self.fasta_structures, ref_seqs_file=os.path.join( fwd, test_data_dir, 'simple.json')) self.assertEqual(t, True)