示例#1
0
 def test_cache(self):
     np.random.seed(0)
     aligner, query, exp_fp = self.blast
     pred = FeatureAnnt([self.db], mkdtemp(dir=self.tmp_dir),
                        cache=self.cache)
     obs = pred(query, aligner=aligner)
     exp = pred.parse_tabular(exp_fp)
     self.assertEquals(exp['sseqid'].values, obs['sseqid'].values)
示例#2
0
 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)
示例#3
0
 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)
示例#4
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))
示例#5
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))
示例#6
0
 def test_filter_best(self):
     for test in self.filter_tests:
         df = FeatureAnnt.parse_tabular(test.input)
         df_filter = FeatureAnnt._filter_best(df)
         df_filter.to_csv(test.obs, sep='\t')
         self.assertTrue(cmp(test.exp, test.obs, shallow=False))
示例#7
0
 def test_blast(self):
     for aligner, query, exp_fp in self.blast:
         pred = FeatureAnnt([self.db], mkdtemp(dir=self.tmp_dir))
         obs = pred(query, aligner=aligner)
         exp = pred.parse_tabular(exp_fp)
         self.assertTrue(exp.equals(obs))
示例#8
0
 def test_filter_best(self):
     for test in self.filter_tests:
         df = FeatureAnnt.parse_tabular(test.input)
         df_filter = FeatureAnnt._filter_best(df)
         df_filter.to_csv(test.obs, sep='\t')
         self.assertTrue(cmp(test.exp, test.obs, shallow=False))
示例#9
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)
         exp = pred._filter_best(pred.parse_tabular(test.exp))
         self.assertTrue(exp.equals(obs))