Skip to main content
`Ctrl`+`K`

# skbio.alignment.AlignPath.from_bits

classmethod AlignPath.from_bits(bits, starts=None)

  Create an alignment path from a bit array (0 - character, 1 - gap).

  Parameters:
    bits array_like of (0, 1) of shape (n_seqs, n_positions)

      Array of zeros (character) and ones (gap) which represent the alignment.

    starts array_like of int of shape (n_sequences,), optional

      Start position (0-based) of each sequence in the alignment. If omitted, will set as zeros.

  Returns:
    AlignPath

      The alignment path created from the given bit array.

  Examples

      >>> import numpy as np
      >>> from skbio.alignment import AlignPath
      >>> bit_arr = np.array([[0, 0, 0, 0, 0, 0, 0, 0],
      ...                     [0, 0, 1, 1, 0, 0, 1, 0],
      ...                     [0, 0, 0, 0, 0, 0, 1, 0]])
      >>> path = AlignPath.from_bits(bit_arr)
      >>> path
      AlignPath
      Shape(sequence=3, position=8)
      lengths: [2 2 2 1 1]
      states: [0 2 0 6 0]