def test_alpha_phylogenetic_alt_unknown_metric(self): table = self.get_data_path('two_feature_table.biom') tree = self.get_data_path('three_feature.tree') with self.assertRaisesRegex(ValueError, 'Unknown phylogenetic metric'): alpha_phylogenetic_alt(table=table, phylogeny=tree, metric='not-a-metric')
def test_alpha_phylogenetic_alt_empty_table(self): table = self.get_data_path('empty.biom') tree = self.get_data_path('three_feature.tree') with self.assertRaisesRegex(ValueError, "empty"): alpha_phylogenetic_alt(table=table, phylogeny=tree, metric='faith_pd')
def test_alpha_phylogenetic_alt_skbio_error_rewriting(self): table = self.get_data_path('two_feature_table.biom') tree = self.get_data_path('vaw.nwk') with self.assertRaisesRegex(ValueError, "The table does not " "appear to be completely represented " "by the phylogeny."): alpha_phylogenetic_alt(table=table, phylogeny=tree, metric='faith_pd')
def test_alpha_phylogenetic_alt(self): table = self.get_data_path('two_feature_table.biom') tree = self.get_data_path('three_feature.tree') actual = alpha_phylogenetic_alt(table=table, phylogeny=tree, metric='faith_pd') # expected computed with skbio.diversity.alpha_diversity expected = pd.Series({'S1': 0.75, 'S2': 1.0, 'S3': 1.0}, name='faith_pd') pdt.assert_series_equal(actual, expected)