Fork me on GitHub

biom-format.org

biom.table.Table.get_value_by_ids

«  biom.table.Table.get_table_density   ::   Contents   ::   biom.table.Table.group_metadata  »

biom.table.Table.get_value_by_ids

Table.get_value_by_ids(obs_id, samp_id)

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

Parameters:

obs_id : str

The ID of the observation

samp_id : str

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

«  biom.table.Table.get_table_density   ::   Contents   ::   biom.table.Table.group_metadata  »