[Biopython-dev] debug_level=2 problem in Martel.Generate

Brad Chapman chapmanb at arches.uga.edu
Wed Nov 7 12:23:18 EST 2001


Hello all;
While updating GenBank for RefSeq, I got knee-deep into debugging with
Martel and noticed that when I set debug_level=2, I was getting an
unexpected amount of output. Instead of the normal 20ish characters of
text in the file being parsed, I was getting the entire file parsed up
to that point. 

Digging into this, I realized that this seems to be due to a change
between versions 1.5 and 1.6 of Martel/Generate.py. Andrew's notes state
that:

Fixed debug error where text[x-8:x+8] failed when x < 8, since x-8 is
negative, which pulls from the end.

The fix was min(0, x-8), instead of just x-8. Unfortunately, this prints
from the beginning as x advances through the file, and gives all the
output I was seeing (and, I don't think fixes the problem, since min(0,
-2) gives the negative problem you were seeing). 

If I'm getting this right, the fix should be max(0, x-8), which seems to
give the correct output. I've attached a patch for this. If anyone
(Andrew :-), can verify that I'm thinking about this right, I'll be
happy to check it in. Thanks!

Brad

-------------- next part --------------
--- Generate.py.orig	Sat Oct 20 19:47:47 2001
+++ Generate.py	Wed Nov  7 01:40:31 2001
@@ -492,7 +492,7 @@
             s = s[:17] + " ... " + s[-17:]
         self.msg = s
     def __call__(self, text, x, end):
-        print "Match %s (x=%d): %s" % (repr(text[min(0, x-8):x+8]), x,
+        print "Match %s (x=%d): %s" % (repr(text[max(0, x-8):x+8]), x,
                                             repr(self.msg))
         return x
 


More information about the Biopython-dev mailing list