Fork me on GitHub


«  biom.table.Table.to_dataframe   ::   Contents   ::   biom.table.Table.to_json  »


Table.to_hdf5(h5grp, generated_by, compress=True, format_fs=None)

Store CSC and CSR in place

The resulting structure of this group is below. A few basic definitions, N is the number of observations and M is the number of samples. Data are stored in both compressed sparse row [R12] (CSR, for observation oriented operations) and compressed sparse column [R13] (CSC, for sample oriented operations).


h5grp : h5py.Group or h5py.File

The HDF5 entity in which to write the BIOM formatted data.

generated_by : str

A description of what generated the table

compress : bool, optional

Defaults to True means fields will be compressed with gzip, False means no compression

format_fs : dict, optional

Specify custom formatting functions for metadata fields. This dict is expected to be {‘metadata_field’: function}, where the function signature is (h5py.Group, str, dict, bool) corresponding to the specific HDF5 group the metadata dataset will be associated with, the category being operated on, the metadata for the entire axis being operated on, and whether to enable compression on the dataset. Anything returned by this function is ignored.

See also



This method does not return anything and operates in place on h5grp.


[R12](1, 2)
[R13](1, 2)


>>> from biom.util import biom_open  
>>> from biom.table import Table
>>> from numpy import array
>>> t = Table(array([[1, 2], [3, 4]]), ['a', 'b'], ['x', 'y'])
>>> with biom_open('foo.biom', 'w') as f:  
...     t.to_hdf5(f, "example")

«  biom.table.Table.to_dataframe   ::   Contents   ::   biom.table.Table.to_json  »