skbio.table.Table.get_value_by_ids#

Table.get_value_by_ids(obs_id, samp_id)[source]#

Return value in the matrix corresponding to (obs_id, samp_id)

Parameters:
obs_idstr

The ID of the observation

samp_idstr

The ID of the sample

Returns:
float

The data value corresponding to the specified matrix position

See also

Table.data

Examples

>>> import numpy as np
>>> from biom.table import Table

Create a 2x3 BIOM table:

>>> data = np.asarray([[0, 0, 1], [1, 3, 42]])
>>> table = Table(data, ['O1', 'O2'], ['S1', 'S2', 'Z3'])

Retrieve the number of counts for observation O1 in sample Z3.

>>> print(table.get_value_by_ids('O2', 'Z3'))
42.0