skbio.alignment.PairAlignPath.to_indices#

PairAlignPath.to_indices(gap=-1)[source]#

Generate an array of indices of characters in the original sequences.

Parameters:
gapint, np.nan, np.inf, “del”, or “mask”, optional

Method to encode gaps in the alignment. If numeric, replace gaps with this value. If “del”, delete columns that have any gap. If “mask”, return an np.ma.MaskedArray, with gaps masked. Default is -1.

Returns:
ndarray of int of shape (n_seqs, n_positions)

Array of indices of characters in the original sequences.

Examples

>>> from skbio.alignment import AlignPath
>>> path = AlignPath(lengths=[1, 2, 2, 1],
...                  states=[0, 5, 2, 6],
...                  starts=[0, 0, 0])
>>> path.to_indices()
array([[ 0, -1, -1,  1,  2,  3],
       [ 0,  1,  2, -1, -1, -1],
       [ 0, -1, -1,  1,  2, -1]])