def test_bad_values_fail(self): # Just confirm that the machinery works, anything more specific is just # restating the _valid_inputs dict which is more declarative than a # unit-test anyways. with self.assertRaisesRegex(ValueError, 'trim_length'): denoise_other(self.demux_seqs, self.ref, -123) with self.assertRaisesRegex(ValueError, 'min_reads'): denoise_other(self.demux_seqs, self.ref, 100, min_reads=-1)
def test_defaults(self): fp = self.get_data_path('expected/other-default.biom') exp_tab = biom.load_table(fp) exp_rep_seqs = list( skbio.io.read(self.get_data_path('expected/other-default.fasta'), 'fasta', constructor=skbio.DNA, lowercase='ignore')) for seq in exp_rep_seqs: del seq.metadata['description'] obs_tab, rep_seqs, stats = denoise_other(self.demux_seqs, self.ref, 100) rep_seqs = _sort_seqs(rep_seqs) exp_rep_seqs = _sort_seqs(exp_rep_seqs) self.assertEqual(rep_seqs, exp_rep_seqs) self.assertEqual(obs_tab, exp_tab) self.assertEqual(list(stats.columns), STATS_HEADER[1:]) self.assertEqual(len(stats), 0)
def test_all_reads_filtered(self): with self.assertRaisesRegex(ValueError, 'filter'): denoise_other(self.demux_seqs, self.ref, 10000)