skbio.alignment.PairAlignPath.to_cigar#

PairAlignPath.to_cigar(seqs=None)[source]#

Generate a CIGAR string representing the pairwise alignment path.

Parameters:
seqslist of skbio.Sequence or string

A pair of sequences to generate CIGAR string. If provided, will distinguish match (=) and mismatch (X). Otherwise, will uniformly note them as (mis)match (M). The first sequence in the list is the query sequence, the second is the reference sequence.

Returns:
str

CIGAR string representing the pairwise alignment path.

Examples

>>> from skbio.alignment import PairAlignPath
>>> path = PairAlignPath(lengths=[2, 5, 3, 1],
...                      states=[0, 3, 2, 1],
...                      starts=[0, 0])
>>> path.to_cigar()
'2M5P3D1I'