skbio.table.Table.concat#

Table.concat(others, axis='sample')[source]#

Concatenate tables if axis is disjoint

Parameters:
othersiterable of biom.Table, or a single biom.Table instance

Tables to concatenate

axis{‘sample’, ‘observation’}, optional

The axis to concatenate on. i.e., if axis is ‘sample’, then tables will be joined such that the set of sample IDs in the resulting table will be the union of sample IDs across all tables in others.

Raises:
DisjointIDError

If IDs over the axis are not disjoint.

Notes

The type of the table is inherited from self.

Examples

Concatenate three tables in which the sample IDs are disjoint. Note the observation IDs in this example are not disjoint (although they can be):

>>> from biom import Table
>>> import numpy as np
>>> a = Table(np.array([[0, 1, 2], [3, 4, 5]]), ['O1', 'O2'],
...                     ['S1', 'S2', 'S3'],
...                     [{'taxonomy': 'foo'}, {'taxonomy': 'bar'}])
>>> b = Table(np.array([[6, 7, 8], [9, 10, 11]]), ['O3', 'O4'],
...                     ['S4', 'S5', 'S6'],
...                     [{'taxonomy': 'baz'}, {'taxonomy': 'foobar'}])
>>> c = Table(np.array([[12, 13, 14], [15, 16, 17]]), ['O1', 'O5'],
...                     ['S7', 'S8', 'S9'],
...                     [{'taxonomy': 'foo'}, {'taxonomy': 'biz'}])
>>> d = a.concat([b, c])
>>> print(d)  
# Constructed from biom file
#OTU ID S1      S2      S3      S4      S5      S6      S7      S8      S9
O1      0.0     1.0     2.0     0.0     0.0     0.0     12.0    13.0    14.0
O2      3.0     4.0     5.0     0.0     0.0     0.0     0.0     0.0     0.0
O3      0.0     0.0     0.0     6.0     7.0     8.0     0.0     0.0     0.0
O4      0.0     0.0     0.0     9.0     10.0    11.0    0.0     0.0     0.0
O5      0.0     0.0     0.0     0.0     0.0     0.0     15.0    16.0    17.0