parasail-python icon indicating copy to clipboard operation
parasail-python copied to clipboard

Cigar returns unmatches as leading deletions

Open cgjosephlee opened this issue 4 years ago • 0 comments

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.

cgjosephlee avatar May 21 '21 03:05 cgjosephlee