def test_evaluate_taxonomy_sample_id_not_found_FAIL(self): with self.assertRaisesRegex( ValueError, 'Sample id not found in feature table: Peanut'): _evaluate_taxonomy( self.exp_taxa, self.obs_taxa, require_exp_ids=False, require_obs_ids=False, feature_table=self.obs_table, sample_id='Peanut')
def test_evaluate_taxonomy_plus_table_missing_features_in_table_FAIL(self): obs_table = self.obs_table.filter( ['47ad35356a9bfec68416d32e4f039021', 'c4269a6e9bd66eca53e710c9f9d9ad4f', '7a8d29c59b803baaed9cc1f04ce0dc33', '86adb6193435090318cf24df07770d07'], axis='observation') with self.assertRaisesRegex( ValueError, "Feature ids not found in feature table"): _evaluate_taxonomy( self.exp_taxa, self.obs_taxa, require_exp_ids=False, require_obs_ids=False, feature_table=obs_table, sample_id=None, level_range=range(6, 7))
def test_evaluate_taxonomy_sample_id_no_table(self): prf = _evaluate_taxonomy( self.exp_taxa, self.obs_taxa, require_exp_ids=False, require_obs_ids=False, feature_table=None, sample_id='HMPMockV1.1.Even1', level_range=range(0, 7)) prf_res_unw = self.prf_res_unw prf_res_unw['SampleID'] = 'HMPMockV1.1.Even1' pdt.assert_frame_equal(prf, prf_res_unw)
def test_evaluate_taxonomy_plus_table_no_sample_id(self): prf = _evaluate_taxonomy( self.exp_taxa, self.obs_taxa, require_exp_ids=False, require_obs_ids=False, feature_table=self.obs_table, sample_id=None, level_range=range(6, 7)) pdt.assert_frame_equal(prf, pd.DataFrame.from_dict( {'level': {0: 7}, 'Precision': {0: 0.6377837950426994}, 'Recall': {0: 0.19487462344605203}, 'F-measure': {0: 0.2985326855267221}})[[ 'level', 'Precision', 'Recall', 'F-measure']])
def test_evaluate_taxonomy_sample_id_plus_table(self): prf = _evaluate_taxonomy( self.exp_taxa, self.obs_taxa, require_exp_ids=False, require_obs_ids=False, feature_table=self.obs_table, sample_id='HMPMockV1.1.Even1', level_range=range(6, 7)) pdt.assert_frame_equal(prf, pd.DataFrame.from_dict( {'level': {0: 7}, 'Precision': {0: 0.5523983315954119}, 'Recall': {0: 0.19757575757575757}, 'F-measure': {0: 0.2910514387748094}, 'SampleID': {0: 'HMPMockV1.1.Even1'}})[[ 'level', 'Precision', 'Recall', 'F-measure', 'SampleID']])
def test_evaluate_taxonomy_basic(self): prf = _evaluate_taxonomy( self.exp_taxa, self.obs_taxa, require_exp_ids=False, require_obs_ids=False, feature_table=None, sample_id=None, level_range=range(0, 7)) pdt.assert_frame_equal(prf, self.prf_res_unw)