diff blast2html.py @ 68:fa8a93bdefd7

fix bug in calculations of alignment end
author Jan Kanis <jan.code@jankanis.nl>
date Wed, 18 Jun 2014 12:25:37 +0200
parents 19c48f2ec775
children 0c4ac210068b
line wrap: on
line diff
--- a/blast2html.py	Tue Jun 17 18:07:02 2014 +0200
+++ b/blast2html.py	Wed Jun 18 12:25:37 2014 +0200
@@ -83,6 +83,8 @@
 
 @filter
 def alignment_pre(hsp):
+    """Create the preformatted alignment blocks"""
+    
     step = 60
 
     def split(txt):
@@ -99,9 +101,9 @@
     offset = 0
     for qs, mid, hs, offset in zip(split(qseq), split(midline), split(hseq), range(0, len(qseq), step)):
         yield (
-            "Query  {:>7}  {}  {}\n".format(qfrom+offset, qs, qfrom+len(qs)-1) +
+            "Query  {:>7}  {}  {}\n".format(qfrom+offset, qs, qfrom+offset+len(qs)-1) +
             "       {:7}  {}\n".format('', mid) +
-            "Subject{:>7}  {}  {}".format(hfrom+offset, hs, hfrom+len(hs)-1)
+            "Subject{:>7}  {}  {}".format(hfrom+offset, hs, hfrom+offset+len(hs)-1)
         )
         
     if qfrom+len(qseq)-1 != qto: