# HG changeset patch # User Jan Kanis # Date 1403087137 -7200 # Node ID fa8a93bdefd7928c3333a9574791c520b38a09d8 # Parent 19c48f2ec775f63e3e5b39cff57e1b525330e991 fix bug in calculations of alignment end diff -r 19c48f2ec775 -r fa8a93bdefd7 blast2html.py --- 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: diff -r 19c48f2ec775 -r fa8a93bdefd7 test-data/blast xml example1.html --- a/test-data/blast xml example1.html Tue Jun 17 18:07:02 2014 +0200 +++ b/test-data/blast xml example1.html Wed Jun 18 12:25:37 2014 +0200 @@ -6667,7 +6667,7 @@
Query        2  GTCCGTCG  9
                 ||||||||
-Subject    177  GTCCGTCG  170
+Subject 177 GTCCGTCG 184

@@ -6715,7 +6715,7 @@

Query        2  GTCCGTC  8
                 |||||||
-Subject   2048  GTCCGTC  2042
+Subject 2048 GTCCGTC 2054

@@ -6853,7 +6853,7 @@

Query        8  CGTGAAGA  15
                 ||||||||
-Subject   1634  CGTGAAGA  1627
+Subject 1634 CGTGAAGA 1641

@@ -6994,7 +6994,7 @@

Query        8  CGTGAAGA  15
                 ||||||||
-Subject   1634  CGTGAAGA  1627
+Subject 1634 CGTGAAGA 1641

@@ -7111,7 +7111,7 @@

Query        7  TCGTGAAGA  15
                 |||||||||
-Subject    298  TCGTGAAGA  290
+Subject 298 TCGTGAAGA 306

@@ -7672,7 +7672,7 @@

Query        7  TCGTGAAGA  15
                 |||||||||
-Subject    305  TCGTGAAGA  297
+Subject 305 TCGTGAAGA 313

@@ -7813,7 +7813,7 @@

Query       10  TGAAGAG  16
                 |||||||
-Subject   1569  TGAAGAG  1563
+Subject 1569 TGAAGAG 1575
@@ -7924,7 +7924,7 @@
Query       10  TGAAGAG  16
                 |||||||
-Subject   1569  TGAAGAG  1563
+Subject 1569 TGAAGAG 1575 @@ -8392,7 +8392,7 @@
Query        8  CGTGAAGA  15
                 ||||||||
-Subject   1634  CGTGAAGA  1627
+Subject 1634 CGTGAAGA 1641

@@ -8551,7 +8551,7 @@

Query        8  CGTGAAGA  15
                 ||||||||
-Subject   1634  CGTGAAGA  1627
+Subject 1634 CGTGAAGA 1641

@@ -8716,7 +8716,7 @@

Query       10  TGAAGAG  16
                 |||||||
-Subject   1569  TGAAGAG  1563
+Subject 1569 TGAAGAG 1575
@@ -8809,7 +8809,7 @@
Query       10  TGAAGAG  16
                 |||||||
-Subject   1569  TGAAGAG  1563
+Subject 1569 TGAAGAG 1575 @@ -8878,7 +8878,7 @@
Query        8  CGTGAAGA  15
                 ||||||||
-Subject   1634  CGTGAAGA  1627
+Subject 1634 CGTGAAGA 1641

@@ -9043,7 +9043,7 @@

Query       10  TGAAGAG  16
                 |||||||
-Subject   1569  TGAAGAG  1563
+Subject 1569 TGAAGAG 1575
@@ -9088,7 +9088,7 @@
Query        4  CCGTCGTGA  12
                 |||||||||
-Subject     19  CCGTCGTGA  11
+Subject 19 CCGTCGTGA 27 @@ -9178,7 +9178,7 @@
Query        4  CCGTCGTGA  12
                 |||||||||
-Subject     19  CCGTCGTGA  11
+Subject 19 CCGTCGTGA 27 @@ -9268,7 +9268,7 @@
Query        7  TCGTGAAGA  15
                 |||||||||
-Subject    305  TCGTGAAGA  297
+Subject 305 TCGTGAAGA 313

@@ -9385,7 +9385,7 @@

Query        8  CGTGAAGA  15
                 ||||||||
-Subject   1587  CGTGAAGA  1580
+Subject 1587 CGTGAAGA 1594

@@ -9550,7 +9550,7 @@

Query       10  TGAAGAG  16
                 |||||||
-Subject   1533  TGAAGAG  1527
+Subject 1533 TGAAGAG 1539
@@ -9814,7 +9814,7 @@
Query        7  TCGTGAAGA  15
                 |||||||||
-Subject    305  TCGTGAAGA  297
+Subject 305 TCGTGAAGA 313

@@ -9907,7 +9907,7 @@

Query        7  TCGTGAAGA  15
                 |||||||||
-Subject    305  TCGTGAAGA  297
+Subject 305 TCGTGAAGA 313

@@ -10000,7 +10000,7 @@

Query        7  TCGTGAAGA  15
                 |||||||||
-Subject    305  TCGTGAAGA  297
+Subject 305 TCGTGAAGA 313

@@ -10093,7 +10093,7 @@

Query        7  TCGTGAAGA  15
                 |||||||||
-Subject    305  TCGTGAAGA  297
+Subject 305 TCGTGAAGA 313

@@ -10186,7 +10186,7 @@

Query        7  TCGTGAAGA  15
                 |||||||||
-Subject    305  TCGTGAAGA  297
+Subject 305 TCGTGAAGA 313

@@ -10279,7 +10279,7 @@

Query        7  TCGTGAAGA  15
                 |||||||||
-Subject    305  TCGTGAAGA  297
+Subject 305 TCGTGAAGA 313

@@ -10348,7 +10348,7 @@

Query        7  TCGTGAAGA  15
                 |||||||||
-Subject    305  TCGTGAAGA  297
+Subject 305 TCGTGAAGA 313

@@ -10441,7 +10441,7 @@

Query        7  TCGTGAAGA  15
                 |||||||||
-Subject    305  TCGTGAAGA  297
+Subject 305 TCGTGAAGA 313

@@ -10534,7 +10534,7 @@

Query        7  TCGTGAAGA  15
                 |||||||||
-Subject    305  TCGTGAAGA  297
+Subject 305 TCGTGAAGA 313

@@ -10627,7 +10627,7 @@

Query        7  TCGTGAAGA  15
                 |||||||||
-Subject    305  TCGTGAAGA  297
+Subject 305 TCGTGAAGA 313

@@ -10768,7 +10768,7 @@

Query        7  TCGTGAAGA  15
                 |||||||||
-Subject    305  TCGTGAAGA  297
+Subject 305 TCGTGAAGA 313

@@ -11263,7 +11263,7 @@

Query        7  TCGTGAAGA  15
                 |||||||||
-Subject    305  TCGTGAAGA  297
+Subject 305 TCGTGAAGA 313

@@ -11380,7 +11380,7 @@

Query        7  TCGTGAAGA  15
                 |||||||||
-Subject    305  TCGTGAAGA  297
+Subject 305 TCGTGAAGA 313

@@ -11473,7 +11473,7 @@

Query        7  TCGTGAAGA  15
                 |||||||||
-Subject    305  TCGTGAAGA  297
+Subject 305 TCGTGAAGA 313

@@ -12961,7 +12961,7 @@

Query        5  CGTCGTGA  12
                 ||||||||
-Subject     52  CGTCGTGA  45
+Subject 52 CGTCGTGA 59
diff -r 19c48f2ec775 -r fa8a93bdefd7 test-data/blast xml example3.html --- a/test-data/blast xml example3.html Tue Jun 17 18:07:02 2014 +0200 +++ b/test-data/blast xml example3.html Wed Jun 18 12:25:37 2014 +0200 @@ -3321,9 +3321,12 @@ -
Query        1  GAGGAAATGCGTATTCAATTCAACGACATGAACAGCGCCTTGACCACAGCTATCCCATTGTTCGCAGTCCAGAA  74
-                ||||| ||||| || || ||||||||||||||||||||| ||||||| || |||||| | ||||| ||||||||
-Subject   1516  GAGGAGATGCGCATCCAGTTCAACGACATGAACAGCGCCCTGACCACCGCCATCCCACTCTTCGCCGTCCAGAA  1589
+
Query        1  GAGGAAATGCGTATTCAATTCAACGACATGAACAGCGCCTTGACCACAGCTATCCCATTG  60
+                ||||| ||||| || || ||||||||||||||||||||| ||||||| || |||||| | 
+Subject   1516  GAGGAGATGCGCATCCAGTTCAACGACATGAACAGCGCCCTGACCACCGCCATCCCACTC  1575
+
Query       61  TTCGCAGTCCAGAA  74
+                ||||| ||||||||
+Subject   1576  TTCGCCGTCCAGAA  1589
@@ -3509,9 +3512,12 @@ -
Query        1  GAGGAAATGCGTATTCAATTCAACGACATGAACAGCGCCTTGACCACAGCTATCCCATTGTTCGCAGTCCAGAA  74
-                ||||| ||||| || || ||||||||||||||||||||| ||||||| || |||||| | ||||| ||||||||
-Subject   2319  GAGGAGATGCGCATCCAGTTCAACGACATGAACAGCGCCCTGACCACCGCCATCCCACTCTTCGCCGTCCAGAA  2392
+
Query        1  GAGGAAATGCGTATTCAATTCAACGACATGAACAGCGCCTTGACCACAGCTATCCCATTG  60
+                ||||| ||||| || || ||||||||||||||||||||| ||||||| || |||||| | 
+Subject   2319  GAGGAGATGCGCATCCAGTTCAACGACATGAACAGCGCCCTGACCACCGCCATCCCACTC  2378
+
Query       61  TTCGCAGTCCAGAA  74
+                ||||| ||||||||
+Subject   2379  TTCGCCGTCCAGAA  2392
diff -r 19c48f2ec775 -r fa8a93bdefd7 test-data/blast xml example4.html --- a/test-data/blast xml example4.html Tue Jun 17 18:07:02 2014 +0200 +++ b/test-data/blast xml example4.html Wed Jun 18 12:25:37 2014 +0200 @@ -1540,9 +1540,12 @@ -
Query        1  GAGGAAATGCGTATTCAATTCAACGACATGAACAGCGCCTTGACCACAGCTATCCCATTGTTCGCAGTCCAGAA  74
-                ||||| ||||| || || ||||||||||||||||||||| ||||||| || |||||| | ||||| ||||||||
-Subject   2319  GAGGAGATGCGCATCCAGTTCAACGACATGAACAGCGCCCTGACCACCGCCATCCCACTCTTCGCCGTCCAGAA  2392
+
Query        1  GAGGAAATGCGTATTCAATTCAACGACATGAACAGCGCCTTGACCACAGCTATCCCATTG  60
+                ||||| ||||| || || ||||||||||||||||||||| ||||||| || |||||| | 
+Subject   2319  GAGGAGATGCGCATCCAGTTCAACGACATGAACAGCGCCCTGACCACCGCCATCCCACTC  2378
+
Query       61  TTCGCAGTCCAGAA  74
+                ||||| ||||||||
+Subject   2379  TTCGCCGTCCAGAA  2392
@@ -1585,9 +1588,12 @@ -
Query        1  GAGGAAATGCGTATTCAATTCAACGACATGAACAGCGCCTTGACCACAGCTATCCCATTGTTCGCAGTCCAGAA  74
-                ||||| ||||| || || ||||||||||||||||||||| ||||||| || |||||| | ||||| ||||||||
-Subject   1516  GAGGAGATGCGCATCCAGTTCAACGACATGAACAGCGCCCTGACCACCGCCATCCCACTCTTCGCCGTCCAGAA  1589
+
Query        1  GAGGAAATGCGTATTCAATTCAACGACATGAACAGCGCCTTGACCACAGCTATCCCATTG  60
+                ||||| ||||| || || ||||||||||||||||||||| ||||||| || |||||| | 
+Subject   1516  GAGGAGATGCGCATCCAGTTCAACGACATGAACAGCGCCCTGACCACCGCCATCCCACTC  1575
+
Query       61  TTCGCAGTCCAGAA  74
+                ||||| ||||||||
+Subject   1576  TTCGCCGTCCAGAA  1589