def test_blast_wrong_input(self): pred = FeatureAnnt([self.db], self.tmp_dir) for i in self.neg_fp: for aligner in ['blastp', 'blastx']: with self.assertRaisesRegex( ApplicationError, r'(Error reading file)|(Invalid input file format)'): pred(i, aligner=aligner)
def test_cache_empty_db(self): np.random.seed(0) for test in self.tests: aligner, query, exp_fp = test.aligner, test.input, test.exp pred = FeatureAnnt([], mkdtemp(dir=self.tmp_dir), cache=self.cache) obs = pred(query, aligner=aligner) exp = pred._filter_best(pred.parse_tabular(exp_fp)) self.assertEqual(exp['sseqid'].values, obs['sseqid'].values)
def test_cache_initialize(self): np.random.seed(0) for test in self.tests: aligner, query = test.aligner, test.input pred = FeatureAnnt([self.db], mkdtemp(dir=self.tmp_dir), cache=DiamondCache()) pred(query, aligner=aligner) self.assertTrue(len(pred.cache.seqs) > 0)
def test_blast(self): for test in self.tests: pred = FeatureAnnt([self.db], mkdtemp(dir=self.tmp_dir)) obs = pred(test.input, aligner=test.aligner, outfmt='tab') exp = pred._filter_best(pred.parse_tabular('%s.diamond' % test.exp)) self.assertTrue(exp.equals(obs)) obs = pred(test.input, aligner=test.aligner, outfmt='sam') exp = pred._filter_id_cov(pred.parse_sam('%s.sam' % test.exp)) self.assertTrue(exp.equals(obs))