# biom-format.org

## biom.table.Table.align_to

Table.align_to(other, axis='detect')

  Align self to other over a requested axis

  Parameters:
    other biom.Table

      The table to align too

    axis str, optional, {sample, observation, both, detect}

      If ‘sample’ or ‘observation’, align to that axis. If ‘both’, align both axes. If ‘detect’, align what can be aligned.

  Raises:
    DisjointIDError

      If the requested axis can’t be aligned.

    UnknownAxisError

      If an unrecognized axis is specified.

  Examples

  Align one table to another, for instance a table of 16S data to a table of metagenomic data. In this example, we’re aligning the samples of the two tables.

      >>> from biom import Table
      >>> import numpy as np
      >>> amplicon = Table(np.array([[0, 1, 2], [3, 4, 5]]),
      ...                  ['Ecoli', 'Staphylococcus'],
      ...                  ['S1', 'S2', 'S3'])
      >>> metag = Table(np.array([[6, 7, 8], [9, 10, 11]]),
      ...               ['geneA', 'geneB'],
      ...               ['S3', 'S2', 'S1'])
      >>> amplicon = amplicon.align_to(metag)
      >>> print(amplicon)
      # Constructed from biom file
      #OTU ID S3      S2      S1
      Ecoli   2.0     1.0     0.0
      Staphylococcus  5.0     4.0     3.0