biotapy.io.write_biom#
- biotapy.io.write_biom(adata, path, *, fmt='hdf5')#
Write
Xwith taxonomy and sample metadata as a BIOM table.- Parameters:
- Raises:
ValueError –
fmtis neither"hdf5"nor"json".- Return type:
Notes
R equivalent:
biomformat::write_biomGuide: Reading and writing dataBIOM has no slot for a tree, layers or embeddings: a TreeData’s tree and everything outside
X, rank columns andobsare not written. Sample metadata is written as text; missing values are written as empty strings and read back as NaN. Missing ranks are written as bare prefixes (g__) so every rank keeps its place.Examples
>>> import tempfile >>> from pathlib import Path >>> import biotapy as bt >>> path = Path(tempfile.mkdtemp()) / "toy.biom" >>> bt.io.write_biom(bt.datasets.toy(), path) >>> bt.io.read_biom(path).shape (6, 8)