skbio.alignment.AlignPath.to_bits#

AlignPath.to_bits()[source]#

Unpack states into an array of bits.

Returns:
ndarray of (0, 1) of shape (n_seqs, n_positions)

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

Examples

>>> from skbio import DNA, TabularMSA
>>> from skbio.alignment import AlignPath
>>> seqs = [
...    DNA('CGTCGTGC'),
...    DNA('CA--GT-C'),
...    DNA('CGTCGT-T')
... ]
>>> msa = TabularMSA(seqs)
>>> path = AlignPath.from_tabular(msa)
>>> path.to_bits()
array([[0, 0, 0, 0, 0],
       [0, 1, 0, 1, 0],
       [0, 0, 0, 1, 0]], dtype=uint8)