def test_split_taxa(self): known_taxa = np.array([['Bacteria', 'cont. Proteobacteria', 'Gammaproteobacteria', 'c. Gammaproteobacteria', 'c. Gammaproteobacteria', 'c. Gammaproteobacteria', 'c. Gammaproteobacteria'], ['Bacteria', 'Proteobacteria', 'Gammaproteobacteria', 'Enterobacteriales', 'Enterbacteriaceae', 'Escherichia', 'coli']], dtype='|S32') known_levels = ['kingdom', 'phylum', 'p_class', 'p_order', 'family', 'genus', 'species'] test_taxa, test_levels = split_taxa(self.taxa, 7) self.assertEqual(known_levels, test_levels) npt.assert_array_equal(known_taxa, test_taxa)
def test_split_taxa(self): known_taxa = np.array([[ 'Bacteria', 'cont. Proteobacteria', 'Gammaproteobacteria', 'c. Gammaproteobacteria', 'c. Gammaproteobacteria', 'c. Gammaproteobacteria', 'c. Gammaproteobacteria' ], [ 'Bacteria', 'Proteobacteria', 'Gammaproteobacteria', 'Enterobacteriales', 'Enterbacteriaceae', 'Escherichia', 'coli' ]], dtype='|S32') known_levels = [ 'kingdom', 'phylum', 'p_class', 'p_order', 'family', 'genus', 'species' ] test_taxa, test_levels = split_taxa(self.taxa, 7) self.assertEqual(known_levels, test_levels) npt.assert_array_equal(known_taxa, test_taxa)
def test_split_taxa_error(self): with self.assertRaises(ValueError): split_taxa(['k__Bacteria; p__[Proteobacteria]; ' 'c__Gammaproteobacteria'], 7)
def test_split_taxa_error(self): with self.assertRaises(ValueError): split_taxa([ 'k__Bacteria; p__[Proteobacteria]; ' 'c__Gammaproteobacteria' ], 7)