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

Right Gaps, but not Left Gaps, Counting Toward nw_stat().length Attribute

Open kmayerb opened this issue 5 years ago • 0 comments

This issue concerns unexpected output when running parasail.nw_stat() and calling the alignment .length attribute. Consider the following alignment:

-- GG - - - - AAGGAAAA

One might expect the alignment length here to equal 8, but parasail returns 6 (two matched positions plus four gaps to the right). The two gaps to the left of matched positions appear not to count toward the alignment length.

import parasail
s1 = 'GG'
s2 = 'AAGGAAAA'
align_trace = parasail.nw_trace(s1, s2, open = 3, extend= 3, matrix = parasail.blosum62)
print(align_trace.traceback.query)
print(align_trace.traceback.comp)
print(align_trace.traceback.ref)
align_stat = parasail.nw_stats(s1, s2, open = 3, extend= 3, matrix = parasail.blosum62)
print("Alignment Length:", align_stat.length)

OUTPUT:

--GG----
  ||    
AAGGAAAA
('Alignment Length:', 6)

In a number of examples it appears that gaps on the left side of matched positions do not count towards the overall alignment length but gaps on the right side of matched positions do. Is this intended behavior or a potential bug?

Thanks, k

Example Generated Using: Running Python version Anaconda 2.7.11 on OSX Python 2.7.11 |Continuum Analytics, Inc.| (default, Jun 15 2016, 16:09:16) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)] Using parasail parasail-python 1.1.16 py27hd9629dc_0 bioconda

kmayerb avatar Jul 03 '19 17:07 kmayerb