def test_with_metadata(self): md = qiime2.CategoricalMetadataColumn( pd.Series(['milo', 'summer', 'russ'], name='pet', index=pd.Index(['S1', 'S2', 'S3'], name='id'))) heatmap(self.output_dir, self.table, metadata=md) self.assertBasicVizValidity(self.output_dir)
def test_table_ids_are_subset_of_metadata_ids(self): md = qiime2.CategoricalMetadataColumn( pd.Series(['milo', 'russ'], name='pet', index=pd.Index(['S1', 'S3'], name='id'))) with self.assertRaisesRegex(ValueError, 'not present.*S2'): heatmap(self.output_dir, self.table, metadata=md)
def test_with_feature_metadata(self): feature_md = qiime2.CategoricalMetadataColumn( pd.Series(['peanut', 'dog'], name='species', index=pd.Index(['O1', 'O2'], name='id'))) heatmap(self.output_dir, self.table, feature_metadata=feature_md) self.assertBasicVizValidity(self.output_dir)
def test_extra_metadata_ids(self): md = qiime2.MetadataCategory( pd.Series(['milo', 'summer', 'russ', 'peanut'], name='pet', index=['S1', 'S2', 'S3', 'S4'])) heatmap(self.output_dir, self.table, metadata=md) self.assertBasicVizValidity(self.output_dir)
def test_no_sample_cluster(self): md = qiime2.CategoricalMetadataColumn( pd.Series(['milo', 'summer', 'russ'], name='pet', index=pd.Index(['S1', 'S2', 'S3'], name='id'))) heatmap(self.output_dir, self.table, sample_metadata=md, cluster='features') self.assertBasicVizValidity(self.output_dir)
def test_with_sample_and_feature_metadata(self): md = qiime2.CategoricalMetadataColumn( pd.Series(['milo', 'summer', 'russ'], name='pet', index=pd.Index(['S1', 'S2', 'S3'], name='id'))) feature_md = qiime2.CategoricalMetadataColumn( pd.Series(['peanut', 'dog'], name='species', index=pd.Index(['O1', 'O2'], name='id'))) heatmap(self.output_dir, self.table, sample_metadata=md, feature_metadata=feature_md) self.assertBasicVizValidity(self.output_dir)
def test_with_title(self): heatmap(self.output_dir, self.table, title='foo') self.assertBasicVizValidity(self.output_dir)
def test_defaults(self): heatmap(self.output_dir, self.table) self.assertBasicVizValidity(self.output_dir)
def test_no_normalization(self): heatmap(self.output_dir, self.table, normalize=False) self.assertBasicVizValidity(self.output_dir, normalize=False)
def test_empty_table(self): empty_table = pd.DataFrame([], [], []) with self.assertRaisesRegex(ValueError, 'empty'): heatmap(self.output_dir, empty_table)
def test_table_ids_are_subset_of_metadata_ids(self): md = qiime2.MetadataCategory( pd.Series(['milo', 'russ'], name='pet', index=['S1', 'S3'])) with self.assertRaisesRegex(ValueError, 'Missing'): heatmap(self.output_dir, self.table, metadata=md)