skbio.alignment.AlignPath.from_bits#
- classmethod AlignPath.from_bits(bits, starts=None)[source]#
Create an alignment path from a bit array (0 - character, 1 - gap).
- Parameters:
- bitsarray_like of (0, 1) of shape (n_sequences, n_positions)
Array of zeros (character) and ones (gap) which represent the alignment.
- startsarray_like of int of shape (n_sequences,), optional
Start position 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, sequences: 3, positions: 8, segments: 5>