jeffdaily / parasail-python

Python bindings for the parasail C library.
Other
87 stars 17 forks source link

Cigar returns unmatches as leading deletions #61

Open cgjosephlee opened 3 years ago

cgjosephlee commented 3 years ago

I'm trying to align some palindrome sequences, and there is a weird behavior of cigar string.

import parasail

def test():
    a = 'AAAAGACTTGGCTCGACAACGC'
    b = 'GCGTTGTCGAGCCAAGTCTTTT'  # reverse complement of a
    c = a + b[0:10]
    m = parasail.matrix_create("ACGT", 3, -4)
    r = parasail.sw_trace_striped_8(b, c, 4, 4, m)
    print(r.cigar.beg_ref, r.end_ref)
    print(r.cigar.beg_query, r.end_query)
    print(r.cigar.decode)

# output
# 0 31
# 0 9
# b'22D10='

Cigar string starts with a 22D. The begin and end positions are wrong as well, should be (22,32) in ref and (0,10) in query since there is 10= in cigar.