biom.table.Table.to_hdf5¶
- 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).
Parameters: 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
Notes
This method does not return anything and operates in place on h5grp.
References
[R12] (1, 2) http://docs.scipy.org/doc/scipy-0.13.0/reference/generated/scipy.sparse.csr_matrix.html [R13] (1, 2) http://docs.scipy.org/doc/scipy-0.13.0/reference/generated/scipy.sparse.csc_matrix.html [R14] http://biom-format.org/documentation/format_versions/biom-2.1.html Examples
>>> 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")