skbio.alignment.PairAlignPath.from_indices#

classmethod PairAlignPath.from_indices(indices, gap=-1)[source]#

Create an alignment path from character indices in the original sequences.

Parameters:
indicesarray_like of int of shape (n_seqs, n_positions)

Each element in the array is the index in the corresponding sequence.

gapint or “mask”, optional

The value which represents a gap in the alignment. Defaults to -1, but can be other values. If “mask”, indices must be an np.ma.MaskedArray. Cannot use “del”.

Returns:
AlignPath

The alignment path created from the given indices.

Notes

If a sequence in the alignment consists of entirely gap characters, its start position will be equal to the gap character.

Examples

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