biom.table.Table.to_anndata

Table.to_anndata(dense=False, dtype='float32', transpose=True)

Convert Table to AnnData format

Parameters:
densebool, optional

If True, set adata.X as np.ndarray instead of sparse matrix.

dtype: str, optional

dtype used for storage in anndata object.

tranpose: bool, optional

If True, transpose the anndata so that observations are columns

Returns:
anndata.AnnData

AnnData with matrix data and associated observation and sample metadata.

Notes

Nested metadata are not included.

Examples

>>> from biom import example_table
>>> adata = example_table.to_anndata()
>>> adata
AnnData object with n_obs × n_vars = 3 × 2
    obs: 'environment'
    var: 'taxonomy_0', 'taxonomy_1'