[Biopython-dev] Follow up to bug incoming/75

daishi at egcrc.net daishi at egcrc.net
Tue Jul 16 18:23:46 EDT 2002


Jeffrey Chang wrote:
> Hi Daishi,
> 
> Thanks for the bug report and patch.  I will look into this soon.
> 
> Jeff

Please ignore the previous patch; it contains a bug.
I believe I now understand the purpose of L332-333;
I have reincorporated the functionality in a slightly
different way which works with my other modifications.
The new patch follows:

*** /usr/local/src/biopython/Bio/Align/fastpairwise.py	Tue Jul  9 15:08:53 2002
--- fastpairwise.py	Tue Jul 16 15:15:50 2002
***************
*** 302,308 ****
           else:
               # Since the length of the alignment is unknown, set an
               # offset from the end of the alignment.
!             begin, end = 0, -len(seqA)
               if not end:
                   end = None
           x = seqA, seqB, score, begin, end, row, col, []
--- 302,308 ----
           else:
               # Since the length of the alignment is unknown, set an
               # offset from the end of the alignment.
!             begin, end = None, -len(seqA)
               if not end:
                   end = None
           x = seqA, seqB, score, begin, end, row, col, []
***************
*** 326,341 ****
                   elif col < 0:
                       begin = row + 1
               for cseqA, cseqB, cbegin, taillen in path_cache[(row, col)]:
!                 nbegin = begin
                   nseqA = cseqA[:-taillen] + seqA
                   nseqB = cseqB[:-taillen] + seqB
!                 if nbegin < cbegin:
!                     nbegin = cbegin
                   x = nseqA, nseqB, score, nbegin, end, -1, -1, path
                   in_process.append(x)
           elif row < 0 and col < 0:
               # This one is done.  Put it into the tracebacks list and
               # continue.
               tracebacks.append((seqA, seqB, score, begin, end))
               path.pop()   # Don't cache the last step.
               # Update the cache.
--- 326,346 ----
                   elif col < 0:
                       begin = row + 1
               for cseqA, cseqB, cbegin, taillen in path_cache[(row, col)]:
!                 if begin:
!                     nbegin = begin
!                 else:
!                     nbegin = cbegin
                   nseqA = cseqA[:-taillen] + seqA
                   nseqB = cseqB[:-taillen] + seqB
! #                if nbegin < cbegin:
! #                    nbegin = cbegin
                   x = nseqA, nseqB, score, nbegin, end, -1, -1, path
                   in_process.append(x)
           elif row < 0 and col < 0:
               # This one is done.  Put it into the tracebacks list and
               # continue.
+             if not begin:
+                 begin = 0
               tracebacks.append((seqA, seqB, score, begin, end))
               path.pop()   # Don't cache the last step.
               # Update the cache.
***************
*** 347,360 ****
           elif row < 0:
               nseqA = gap_char + seqA
               nseqB = sequenceB[col:col+1] + seqB
!             if not global_alignment:
                   begin = col + 1
               x = nseqA, nseqB, score, begin, end, row, col-1, path
               in_process.append(x)
           elif col < 0:
               nseqA = sequenceA[row:row+1] + seqA
               nseqB = gap_char + seqB
!             if not global_alignment:
                   begin = row + 1
               x = nseqA, nseqB, score, begin, end, row-1, col, path
               in_process.append(x)
--- 352,365 ----
           elif row < 0:
               nseqA = gap_char + seqA
               nseqB = sequenceB[col:col+1] + seqB
!             if not (global_alignment or begin):
                   begin = col + 1
               x = nseqA, nseqB, score, begin, end, row, col-1, path
               in_process.append(x)
           elif col < 0:
               nseqA = sequenceA[row:row+1] + seqA
               nseqB = gap_char + seqB
!             if not (global_alignment or begin):
                   begin = row + 1
               x = nseqA, nseqB, score, begin, end, row-1, col, path
               in_process.append(x)




More information about the Biopython-dev mailing list