Quick start — biom-format.org (original) (raw)

BIOM has an example table and two methods for reading in Table objects that are immediately available at the package level.

Functions

Examples

Load an example table:

from biom import example_table print(example_table)

Constructed from biom file

#OTU ID S1 S2 S3 O1 0.0 1.0 2.0 O2 3.0 4.0 5.0

Parse a table from an open file object:

from biom import parse_table with open('path/to/table.biom') as f: ... table = parse_table(f)

Parse a table from a path. BIOM will attempt to determine if the file is either in TSV, HDF5, JSON, gzip’d JSON or gzip’d TSV and parse accordingly:

from biom import load_table table = load_table('path/to/table.biom')