def test_uchime_denovo_no_chimeras(self): input_table = biom.Table( np.array([[3, 4, 2], [1, 0, 0], [4, 5, 6], [2, 2, 2]]), ['feature1', 'feature2', 'feature3', 'feature4'], ['sample1', 'sample2', 'sample3']) with redirected_stdio(stderr=os.devnull): chime, nonchime, stats = uchime_denovo( sequences=self.input_sequences, table=input_table) obs_chime = _read_seqs(chime) exp_chime = [] self.assertEqual(obs_chime, exp_chime) # sequences are reverse-sorted by abundance in output obs_nonchime = _read_seqs(nonchime) exp_nonchime = [ self.input_sequences_list[2], self.input_sequences_list[0], self.input_sequences_list[3], self.input_sequences_list[1] ] self.assertEqual(obs_nonchime, exp_nonchime) with stats.open() as stats_fh: stats_text = stats_fh.read() self.assertTrue('feature1' in stats_text) self.assertTrue('feature2' in stats_text) self.assertTrue('feature3' in stats_text) self.assertTrue('feature4' in stats_text) stats_lines = [e for e in stats_text.split('\n') if len(e) > 0] self.assertEqual(len(stats_lines), 4)
def test_uchime_denovo(self): with redirected_stdio(stderr=os.devnull): chime, nonchime, stats = uchime_denovo( sequences=self.input_sequences, table=self.input_table) obs_chime = _read_seqs(chime) exp_chime = [self.input_sequences_list[3]] self.assertEqual(obs_chime, exp_chime) # sequences are reverse-sorted by abundance in output obs_nonchime = _read_seqs(nonchime) exp_nonchime = [ self.input_sequences_list[0], self.input_sequences_list[1], self.input_sequences_list[2] ] self.assertEqual(obs_nonchime, exp_nonchime) with stats.open() as stats_fh: stats_text = stats_fh.read() self.assertTrue('feature1' in stats_text) self.assertTrue('feature2' in stats_text) self.assertTrue('feature3' in stats_text) self.assertTrue('feature4' in stats_text) stats_lines = [e for e in stats_text.split('\n') if len(e) > 0] self.assertEqual(len(stats_lines), 4)