Repository 'blast2html'
hg clone https://toolshed.g2.bx.psu.edu/repos/jankanis/blast2html

Changeset 81:40ce2043006a (2014-06-19)
Previous changeset 72:6ecbfebb9dd9 (2014-06-18) Next changeset 82:3338571b44cd (2014-06-23)
Commit message:
merge py2.6 branch
modified:
blast2html.html.jinja
blast2html.py
test-data/blast xml example1.html
test-data/blast xml example3.html
test-data/blast xml example4.html
test-data/refresh_test_results.sh
b
diff -r 6ecbfebb9dd9 -r 40ce2043006a blast2html.html.jinja
--- a/blast2html.html.jinja Wed Jun 18 14:33:12 2014 +0200
+++ b/blast2html.html.jinja Thu Jun 19 17:00:29 2014 +0200
[
@@ -1,3 +1,4 @@
+{# -*- coding: utf-8 -*- #}
 <!DOCTYPE html>
 <html>
   <head>
@@ -466,7 +467,7 @@
                   <div class=graphicrow>
                     <div>
                       {% for s in result|queryscale %}
-                      <div class=graphicitem style="width: {{s.width}}%">
+                      <div class=graphicitem style="width: {{s.width|numfmt}}%">
                         {% if s.width > 3.0 %}
                         <div>{{s.label}}</div>
                         {% else %}
@@ -489,7 +490,7 @@
                   <div class="matchrow graphicrow">
                     {% for hit in line.colors %}
                     <div class="matchitem graphicitem"
-                         style="background-color: {{hit[1]}}; width: {{hit[0]}}%"></div>
+                         style="background-color: {{hit[1]}}; width: {{hit[0]|numfmt}}%"></div>
                     {% endfor %}
                   </div>
                 </a>
@@ -596,9 +597,9 @@
                       <td>{{hsp['Hsp_bit-score']|fmt('.1f')}} bits({{hsp.Hsp_score}})</td>
                       <td>{{hsp.Hsp_evalue|fmt('.1f')}}</td>
                       <td>{{ hsp.Hsp_identity }}/{{ hsp|len }}({{
-                        (hsp.Hsp_identity/hsp|len) |fmt('.0%') }})</td>
+                        ((hsp.Hsp_identity|float)/hsp|len) | fmt('.0%') }})</td>
                       <td>{{ hsp.Hsp_gaps }}/{{ hsp|len
-                        }}({{ (hsp.Hsp_gaps / hsp|len) | fmt('.0%') }})</td>
+                        }}({{ ((hsp.Hsp_gaps|float) / hsp|len) | fmt('.0%') }})</td>
                       <td>{{ hsp['Hsp_query-frame']|asframe }}/{{ hsp['Hsp_hit-frame']|asframe }}</td>
                     </tr>
                   </table>
b
diff -r 6ecbfebb9dd9 -r 40ce2043006a blast2html.py
--- a/blast2html.py Wed Jun 18 14:33:12 2014 +0200
+++ b/blast2html.py Thu Jun 19 17:00:29 2014 +0200
[
b'@@ -1,14 +1,18 @@\n #!/usr/bin/env python3\n # -*- coding: utf-8 -*-\n \n+# Actually this program works with both python 2 and 3, tested against python 2.6\n+\n # Copyright The Hyve B.V. 2014\n # License: GPL version 3 or (at your option) any higher version\n \n-from __future__ import unicode_literals\n+from __future__ import unicode_literals, division\n \n import sys\n import math\n import warnings\n+import six, codecs\n+from six.moves import builtins\n from os import path\n from itertools import repeat\n import argparse\n@@ -17,10 +21,10 @@\n \n \n \n-_filters = {}\n+_filters = dict(float=\'float\')\n def filter(func_or_name):\n     "Decorator to register a function as filter in the current jinja environment"\n-    if isinstance(func_or_name, str):\n+    if isinstance(func_or_name, six.string_types):\n         def inner(func):\n             _filters[func_or_name] = func.__name__\n             return func\n@@ -46,6 +50,21 @@\n     return format(float(val), fmt)\n \n @filter\n+def numfmt(val):\n+    """Format numbers in decimal notation, but without excessive trailing 0\'s.\n+    Default python float formatting will use scientific notation for some values,\n+    or append trailing zeros with the \'f\' format type, and the number of digits differs\n+    between python 2 and 3."""\n+    fpart, ipart = math.modf(val)\n+    if fpart == 0:\n+        return str(int(val))\n+    # round to 10 to get identical representations in python 2 and 3\n+    s = format(round(val, 10), \'.10f\').rstrip(\'0\')\n+    if s[-1] == \'.\':\n+        s += \'0\'\n+    return s\n+\n+@filter\n def firsttitle(hit):\n     return hit.Hit_def.text.split(\'>\')[0]\n \n@@ -100,10 +119,10 @@\n     hseq = hsp.Hsp_hseq.text\n \n     if not qframe in (1, -1):\n-        warnings.warn("Error in BlastXML input: Hsp node {} has a Hsp_query-frame of {}. (should be 1 or -1)".format(nodeid(hsp), qframe))\n+        warnings.warn("Error in BlastXML input: Hsp node {0} has a Hsp_query-frame of {1}. (should be 1 or -1)".format(nodeid(hsp), qframe))\n         qframe = -1 if qframe < 0 else 1\n     if not hframe in (1, -1):\n-        warnings.warn("Error in BlastXML input: Hsp node {} has a Hsp_hit-frame of {}. (should be 1 or -1)".format(nodeid(hsp), hframe))\n+        warnings.warn("Error in BlastXML input: Hsp node {0} has a Hsp_hit-frame of {1}. (should be 1 or -1)".format(nodeid(hsp), hframe))\n         hframe = -1 if hframe < 0 else 1\n     \n     def split(txt):\n@@ -111,16 +130,16 @@\n \n     for qs, mid, hs, offset in zip(split(qseq), split(midline), split(hseq), range(0, len(qseq), linewidth)):\n         yield (\n-            "Query  {:>7}  {}  {}\\n".format(qfrom+offset*qframe, qs, qfrom+(offset+len(qs)-1)*qframe) +\n-            "       {:7}  {}\\n".format(\'\', mid) +\n-            "Subject{:>7}  {}  {}".format(hfrom+offset*hframe, hs, hfrom+(offset+len(hs)-1)*hframe)\n+            "Query  {0:>7}  {1}  {2}\\n".format(qfrom+offset*qframe, qs, qfrom+(offset+len(qs)-1)*qframe) +\n+            "       {0:7}  {1}\\n".format(\'\', mid) +\n+            "Subject{0:>7}  {1}  {2}".format(hfrom+offset*hframe, hs, hfrom+(offset+len(hs)-1)*hframe)\n         )\n         \n     if qfrom+(len(qseq)-1)*qframe != qto:\n-        warnings.warn("Error in BlastXML input: Hsp node {} qseq length mismatch: from {} to {} length {}".format(\n+        warnings.warn("Error in BlastXML input: Hsp node {0} qseq length mismatch: from {1} to {2} length {3}".format(\n             nodeid(hsp), qfrom, qto, len(qseq)))\n     if hfrom+(len(hseq)-1)*hframe != hto:\n-        warnings.warn("Error in BlastXML input: Hsp node {} hseq length mismatch: from {} to {} length {}".format(\n+        warnings.warn("Error in BlastXML input: Hsp node {0} hseq length mismatch: from {1} to {2} length {3}".format(\n             nodeid(hsp), hfrom, hto, len(hseq)))\n \n     \n@@ -159,29 +178,30 @@\n     raise Exception("frame should be either +1 or -1")\n \n def genelink(hit, type=\'genbank\', hsp=None):\n-    if not isinstance(hit, str):\n+    if not isinstance(hit, six.string_types):\n         hit = hitid(hit)\n-    link = "http://www.n'..b'E\'),\n+    # (\'<\', \'\\\\u003C\'),\n+    # (\'&\', \'\\\\u0026\'),\n+    # (\'=\', \'\\\\u003D\'),\n+    # (\'-\', \'\\\\u002D\'),\n+    # (\';\', \'\\\\u003B\'),\n+    (u\'\\u2028\', \'\\\\u2028\'),\n+    (u\'\\u2029\', \'\\\\u2029\')\n )\n \n # Escape every ASCII character with a value less than 32. This is\n@@ -198,7 +218,7 @@\n     javascript snippets.\n     """\n \n-    value = str(value)\n+    value = six.text_type(value)\n \n     for bad, good in _js_escapes:\n         value = value.replace(bad, good)\n@@ -237,7 +257,10 @@\n             try:\n                 environment.filters[filtername] = getattr(self, funcname)\n             except AttributeError:\n-                environment.filters[filtername] = globals()[funcname]\n+                try:\n+                    environment.filters[filtername] = globals()[funcname]\n+                except KeyError:\n+                    environment.filters[filtername] = getattr(builtins, funcname)\n \n     def render(self, output):\n         template = self.environment.get_template(self.templatename)\n@@ -249,13 +272,14 @@\n                   (\'Database\', self.blast.BlastOutput_db),\n         )\n \n-        output.write(template.render(blast=self.blast,\n-                                     iterations=self.blast.BlastOutput_iterations.Iteration,\n-                                     colors=self.colors,\n-                                     # match_colors=self.match_colors(),\n-                                     # hit_info=self.hit_info(),\n-                                     genelink=genelink,\n-                                     params=params))\n+        result = template.render(blast=self.blast,\n+                                 iterations=self.blast.BlastOutput_iterations.Iteration,\n+                                 colors=self.colors,\n+                                 genelink=genelink,\n+                                 params=params)\n+        if six.PY2:\n+            result = result.encode(\'utf-8\')\n+        output.write(result)\n \n     @filter\n     def match_colors(self, result):\n@@ -320,21 +344,22 @@\n                 return (float(hsp[path]) for hsp in hsps)\n \n             yield dict(hit = hit,\n-                      title = firsttitle(hit),\n-                       maxscore = "{:.1f}".format(max(hsp_val(\'Hsp_bit-score\'))),\n-                       totalscore = "{:.1f}".format(sum(hsp_val(\'Hsp_bit-score\'))),\n-                       cover = "{:.0%}".format(cover_count / query_length),\n-                       e_value = "{:.4g}".format(min(hsp_val(\'Hsp_evalue\'))),\n+                       title = firsttitle(hit),\n+                       maxscore = "{0:.1f}".format(max(hsp_val(\'Hsp_bit-score\'))),\n+                       totalscore = "{0:.1f}".format(sum(hsp_val(\'Hsp_bit-score\'))),\n+                       cover = "{0:.0%}".format(cover_count / query_length),\n+                       e_value = "{0:.4g}".format(min(hsp_val(\'Hsp_evalue\'))),\n                        # FIXME: is this the correct formula vv?\n-                       ident = "{:.0%}".format(float(min(hsp.Hsp_identity / blastxml_len(hsp) for hsp in hsps))),\n+                       # float(...) because non-flooring division doesn\'t work with lxml elements in python 2.6\n+                       ident = "{0:.0%}".format(float(min(float(hsp.Hsp_identity) / blastxml_len(hsp) for hsp in hsps))),\n                        accession = hit.Hit_accession)\n \n \n def main():\n     default_template = path.join(path.dirname(__file__), \'blast2html.html.jinja\')\n-    \n+\n     parser = argparse.ArgumentParser(description="Convert a BLAST XML result into a nicely readable html page",\n-                                     usage="{} [-i] INPUT [-o OUTPUT]".format(sys.argv[0]))\n+                                     usage="{0} [-i] INPUT [-o OUTPUT]".format(sys.argv[0]))\n     input_group = parser.add_mutually_exclusive_group(required=True)\n     input_group.add_argument(\'positional_arg\', metavar=\'INPUT\', nargs=\'?\', type=argparse.FileType(mode=\'r\'),\n                              help=\'The input Blast XML file, same as -i/--input\')\n'
b
diff -r 6ecbfebb9dd9 -r 40ce2043006a test-data/blast xml example1.html
--- a/test-data/blast xml example1.html Wed Jun 18 14:33:12 2014 +0200
+++ b/test-data/blast xml example1.html Thu Jun 19 17:00:29 2014 +0200
b
b'@@ -468,7 +468,7 @@\n                    title="Chain A, E. Coli 70s-fmetval-trnaval Post-translocation Complex (post4, 50s Subunit)">\n                   <div class="matchrow graphicrow">\n                     <div class="matchitem graphicitem"\n-                         style="background-color: black; width: 100.0%"></div>\n+                         style="background-color: black; width: 100%"></div>\n                   </div>\n                 </a>\n \n@@ -479,7 +479,7 @@\n                    title="Chain A, E. Coli 70s-fmetval-trnaval-trnafmet Complex In Intermediate Post- Translocation State (post3b, 50s Subunit)">\n                   <div class="matchrow graphicrow">\n                     <div class="matchitem graphicitem"\n-                         style="background-color: black; width: 100.0%"></div>\n+                         style="background-color: black; width: 100%"></div>\n                   </div>\n                 </a>\n \n@@ -490,7 +490,7 @@\n                    title="Chain A, E. Coli 70s-fmetval-trnaval-trnafmet Complex In Intermediate Post- Translocation State (post3a, 50s Subunit)">\n                   <div class="matchrow graphicrow">\n                     <div class="matchitem graphicitem"\n-                         style="background-color: black; width: 100.0%"></div>\n+                         style="background-color: black; width: 100%"></div>\n                   </div>\n                 </a>\n \n@@ -501,7 +501,7 @@\n                    title="Chain A, E. Coli 70s-fmetval-trnaval-trnafmet Complex In Intermediate Post- Translocation State (post2b, 50s Subunit)">\n                   <div class="matchrow graphicrow">\n                     <div class="matchitem graphicitem"\n-                         style="background-color: black; width: 100.0%"></div>\n+                         style="background-color: black; width: 100%"></div>\n                   </div>\n                 </a>\n \n@@ -512,7 +512,7 @@\n                    title="Chain A, E. Coli 70s-fmetval-trnaval-trnafmet Complex In Intermediate Post- Translocation State (post2a, 50s Subunit)">\n                   <div class="matchrow graphicrow">\n                     <div class="matchitem graphicitem"\n-                         style="background-color: black; width: 100.0%"></div>\n+                         style="background-color: black; width: 100%"></div>\n                   </div>\n                 </a>\n \n@@ -523,7 +523,7 @@\n                    title="Chain A, E. Coli 70s-fmetval-trnaval-trnafmet Complex In Classic Post- Translocation State (post1, 50s Subunit)">\n                   <div class="matchrow graphicrow">\n                     <div class="matchitem graphicitem"\n-                         style="background-color: black; width: 100.0%"></div>\n+                         style="background-color: black; width: 100%"></div>\n                   </div>\n                 </a>\n \n@@ -534,7 +534,7 @@\n                    title="Chain A, E. Coli 70s-fmetval-trnaval-trnafmet Complex In Hybrid Pre- Translocation State (pre5b, 50s Subunit)">\n                   <div class="matchrow graphicrow">\n                     <div class="matchitem graphicitem"\n-                         style="background-color: black; width: 100.0%"></div>\n+                         style="background-color: black; width: 100%"></div>\n                   </div>\n                 </a>\n \n@@ -545,7 +545,7 @@\n                    title="Chain A, E. Coli 70s-fmetval-trnaval-trnafmet Complex In Hybrid Pre- Translocation State (pre5a, 50s Subunit)">\n                   <div class="matchrow graphicrow">\n                     <div class="matchitem graphicitem"\n-                         style="background-color: black; width: 100.0%"></div>\n+                         style="background-color: black; width: 100%"></div>\n                   </div>\n                 </a>\n \n@@ -556,7 +556,7 @@\n                    title="Chain A, E. Coli 70s-fmetval-trnaval-trnafmet Complex In Hybrid Pre- Translocation State (pre4, 50s Subunit)">\n                   <div '..b'   style="background-color: transparent; width: 25.0%"></div>\n-                    <div class="matchitem graphicitem"\n-                         style="background-color: black; width: 50.0%"></div>\n-                    <div class="matchitem graphicitem"\n-                         style="background-color: transparent; width: 25.0%"></div>\n+                         style="background-color: transparent; width: 25%"></div>\n+                    <div class="matchitem graphicitem"\n+                         style="background-color: black; width: 50%"></div>\n+                    <div class="matchitem graphicitem"\n+                         style="background-color: transparent; width: 25%"></div>\n                   </div>\n                 </a>\n \n@@ -1766,7 +1766,7 @@\n                     <div class="matchitem graphicitem"\n                          style="background-color: black; width: 56.25%"></div>\n                     <div class="matchitem graphicitem"\n-                         style="background-color: transparent; width: 25.0%"></div>\n+                         style="background-color: transparent; width: 25%"></div>\n                   </div>\n                 </a>\n \n@@ -1777,7 +1777,7 @@\n                    title="Chain A, Structure Of The Thermus Thermophilus 70s Ribosome Complexed With Mrna, Trna And Paromomycin (Part 2 Of 4). This File Contains The 50s Subunit From Molecule I. ">\n                   <div class="matchrow graphicrow">\n                     <div class="matchitem graphicitem"\n-                         style="background-color: transparent; width: 25.0%"></div>\n+                         style="background-color: transparent; width: 25%"></div>\n                     <div class="matchitem graphicitem"\n                          style="background-color: black; width: 68.75%"></div>\n                     <div class="matchitem graphicitem"\n@@ -1792,11 +1792,11 @@\n                    title="Chain C, Crystal Structure Of I-Crei Complexed With Its Target Methylated At Position Plus 2 (In The B Strand) In The Presence Of Magnesium">\n                   <div class="matchrow graphicrow">\n                     <div class="matchitem graphicitem"\n-                         style="background-color: transparent; width: 25.0%"></div>\n-                    <div class="matchitem graphicitem"\n-                         style="background-color: black; width: 50.0%"></div>\n-                    <div class="matchitem graphicitem"\n-                         style="background-color: transparent; width: 25.0%"></div>\n+                         style="background-color: transparent; width: 25%"></div>\n+                    <div class="matchitem graphicitem"\n+                         style="background-color: black; width: 50%"></div>\n+                    <div class="matchitem graphicitem"\n+                         style="background-color: transparent; width: 25%"></div>\n                   </div>\n                 </a>\n \n@@ -1807,11 +1807,11 @@\n                    title="Chain C, Crystal Structure Of I-Crei Complexed With Its Target Methylated At Position Plus 2 (In The B Strand) In The Presence Of Calcium">\n                   <div class="matchrow graphicrow">\n                     <div class="matchitem graphicitem"\n-                         style="background-color: transparent; width: 25.0%"></div>\n-                    <div class="matchitem graphicitem"\n-                         style="background-color: black; width: 50.0%"></div>\n-                    <div class="matchitem graphicitem"\n-                         style="background-color: transparent; width: 25.0%"></div>\n+                         style="background-color: transparent; width: 25%"></div>\n+                    <div class="matchitem graphicitem"\n+                         style="background-color: black; width: 50%"></div>\n+                    <div class="matchitem graphicitem"\n+                         style="background-color: transparent; width: 25%"></div>\n                   </div>\n                 </a>\n \n'
b
diff -r 6ecbfebb9dd9 -r 40ce2043006a test-data/blast xml example3.html
--- a/test-data/blast xml example3.html Wed Jun 18 14:33:12 2014 +0200
+++ b/test-data/blast xml example3.html Thu Jun 19 17:00:29 2014 +0200
b
b'@@ -713,34 +713,34 @@\n                   <div>query:</div>\n                   <div class=graphicrow>\n                     <div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                      <div class=graphicitem style="width: 10%">\n                         <div>2</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                      <div class=graphicitem style="width: 10%">\n                         <div>4</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                      <div class=graphicitem style="width: 10%">\n                         <div>6</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                      <div class=graphicitem style="width: 10%">\n                         <div>8</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                      <div class=graphicitem style="width: 10%">\n                         <div>10</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                      <div class=graphicitem style="width: 10%">\n                         <div>12</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                      <div class=graphicitem style="width: 10%">\n                         <div>14</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                      <div class=graphicitem style="width: 10%">\n                         <div>16</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                      <div class=graphicitem style="width: 10%">\n                         <div>18</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                      <div class=graphicitem style="width: 10%">\n                         <div>20</div>\n                       </div>\n                     </div>\n@@ -755,7 +755,7 @@\n                    title="DJ437711|GenBank|insert_MIR604|Corn_Event_MIR604,_Left_Border_region|-5751164067366620000">\n                   <div class="matchrow graphicrow">\n                     <div class="matchitem graphicitem"\n-                         style="background-color: black; width: 100.0%"></div>\n+                         style="background-color: black; width: 100%"></div>\n                   </div>\n                 </a>\n \n@@ -952,34 +952,34 @@\n                   <div>query:</div>\n                   <div class=graphicrow>\n                     <div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                      <div class=graphicitem style="width: 10%">\n                         <div>2</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                      <div class=graphicitem style="width: 10%">\n                         <div>4</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                      <div class=graphicitem style="width: 10%">\n                         <div>6</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                      <div class=graphicitem style="width: 10%">\n                         <div>8</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                      <div class=graphicitem style="width: 10%">\n                         <div>10</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                      <div class=graphicitem style="width: 10%">\n                         <div>12</div>\n                       </div>\n-                  '..b'tem style="width: 10.8108108108%">\n                         <div>64</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.81081081081081%">\n+                      <div class=graphicitem style="width: 10.8108108108%">\n                         <div>72</div>\n                       </div>\n-                      <div class=graphicitem style="width: 2.7027027027027026%">\n+                      <div class=graphicitem style="width: 2.7027027027%">\n                         <div>&nbsp;</div>\n                         <div class=lastlabel>74</div>\n                       </div>\n@@ -3231,7 +3231,7 @@\n                    title="AY326434|GenBank|insert_MON810|Synthetic_construct_truncated_CRYIA(b)_(cryIA(b))_gene,_partial_CDS|-2635190737607180000">\n                   <div class="matchrow graphicrow">\n                     <div class="matchitem graphicitem"\n-                         style="background-color: green; width: 100.0%"></div>\n+                         style="background-color: green; width: 100%"></div>\n                   </div>\n                 </a>\n \n@@ -3379,34 +3379,34 @@\n                   <div>query:</div>\n                   <div class=graphicrow>\n                     <div>\n-                      <div class=graphicitem style="width: 10.81081081081081%">\n+                      <div class=graphicitem style="width: 10.8108108108%">\n                         <div>8</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.81081081081081%">\n+                      <div class=graphicitem style="width: 10.8108108108%">\n                         <div>16</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.81081081081081%">\n+                      <div class=graphicitem style="width: 10.8108108108%">\n                         <div>24</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.81081081081081%">\n+                      <div class=graphicitem style="width: 10.8108108108%">\n                         <div>32</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.81081081081081%">\n+                      <div class=graphicitem style="width: 10.8108108108%">\n                         <div>40</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.81081081081081%">\n+                      <div class=graphicitem style="width: 10.8108108108%">\n                         <div>48</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.81081081081081%">\n+                      <div class=graphicitem style="width: 10.8108108108%">\n                         <div>56</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.81081081081081%">\n+                      <div class=graphicitem style="width: 10.8108108108%">\n                         <div>64</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.81081081081081%">\n+                      <div class=graphicitem style="width: 10.8108108108%">\n                         <div>72</div>\n                       </div>\n-                      <div class=graphicitem style="width: 2.7027027027027026%">\n+                      <div class=graphicitem style="width: 2.7027027027%">\n                         <div>&nbsp;</div>\n                         <div class=lastlabel>74</div>\n                       </div>\n@@ -3422,7 +3422,7 @@\n                    title="EUG|RIKILT|plasmid_pV-ZMBK07|plasmid_pV-ZMBK07|-2635190737607180000">\n                   <div class="matchrow graphicrow">\n                     <div class="matchitem graphicitem"\n-                         style="background-color: green; width: 100.0%"></div>\n+                         style="background-color: green; width: 100%"></div>\n                   </div>\n                 </a>\n \n'
b
diff -r 6ecbfebb9dd9 -r 40ce2043006a test-data/blast xml example4.html
--- a/test-data/blast xml example4.html Wed Jun 18 14:33:12 2014 +0200
+++ b/test-data/blast xml example4.html Thu Jun 19 17:00:29 2014 +0200
b
b'@@ -465,34 +465,34 @@\n                   <div>query:</div>\n                   <div class=graphicrow>\n                     <div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                      <div class=graphicitem style="width: 10%">\n                         <div>2</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                      <div class=graphicitem style="width: 10%">\n                         <div>4</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                      <div class=graphicitem style="width: 10%">\n                         <div>6</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                      <div class=graphicitem style="width: 10%">\n                         <div>8</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                      <div class=graphicitem style="width: 10%">\n                         <div>10</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                      <div class=graphicitem style="width: 10%">\n                         <div>12</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                      <div class=graphicitem style="width: 10%">\n                         <div>14</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                      <div class=graphicitem style="width: 10%">\n                         <div>16</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                      <div class=graphicitem style="width: 10%">\n                         <div>18</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                      <div class=graphicitem style="width: 10%">\n                         <div>20</div>\n                       </div>\n                     </div>\n@@ -507,7 +507,7 @@\n                    title="AB209952.1|GenBank|insert_GTS-40-3-2|Glycine_max_transgenic_cp4epsps_gene_for_5-enol-pyruvylshikimate-3-phospate_synthase_class_2_precursor,_complete_cds|-9105899556052450000">\n                   <div class="matchrow graphicrow">\n                     <div class="matchitem graphicitem"\n-                         style="background-color: black; width: 100.0%"></div>\n+                         style="background-color: black; width: 100%"></div>\n                   </div>\n                 </a>\n \n@@ -518,7 +518,7 @@\n                    title="DJ437711|GenBank|insert_MIR604|Corn_Event_MIR604,_Left_Border_region|-5751164067366620000">\n                   <div class="matchrow graphicrow">\n                     <div class="matchitem graphicitem"\n-                         style="background-color: black; width: 100.0%"></div>\n+                         style="background-color: black; width: 100%"></div>\n                   </div>\n                 </a>\n \n@@ -747,34 +747,34 @@\n                   <div>query:</div>\n                   <div class=graphicrow>\n                     <div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                      <div class=graphicitem style="width: 10%">\n                         <div>2</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                      <div class=graphicitem style="width: 10%">\n                         <div>4</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                      <div class=graphicitem style="width: 10%">\n                         <div>6</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.0%">\n+                 '..b'struct_truncated_CRYIA(b)_(cryIA(b))_gene,_partial_CDS|-2635190737607180000">\n                   <div class="matchrow graphicrow">\n                     <div class="matchitem graphicitem"\n-                         style="background-color: black; width: 88.0%"></div>\n+                         style="background-color: black; width: 88%"></div>\n                     <div class="matchitem graphicitem"\n-                         style="background-color: transparent; width: 12.0%"></div>\n+                         style="background-color: transparent; width: 12%"></div>\n                   </div>\n                 </a>\n \n@@ -1383,34 +1383,34 @@\n                   <div>query:</div>\n                   <div class=graphicrow>\n                     <div>\n-                      <div class=graphicitem style="width: 10.81081081081081%">\n+                      <div class=graphicitem style="width: 10.8108108108%">\n                         <div>8</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.81081081081081%">\n+                      <div class=graphicitem style="width: 10.8108108108%">\n                         <div>16</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.81081081081081%">\n+                      <div class=graphicitem style="width: 10.8108108108%">\n                         <div>24</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.81081081081081%">\n+                      <div class=graphicitem style="width: 10.8108108108%">\n                         <div>32</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.81081081081081%">\n+                      <div class=graphicitem style="width: 10.8108108108%">\n                         <div>40</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.81081081081081%">\n+                      <div class=graphicitem style="width: 10.8108108108%">\n                         <div>48</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.81081081081081%">\n+                      <div class=graphicitem style="width: 10.8108108108%">\n                         <div>56</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.81081081081081%">\n+                      <div class=graphicitem style="width: 10.8108108108%">\n                         <div>64</div>\n                       </div>\n-                      <div class=graphicitem style="width: 10.81081081081081%">\n+                      <div class=graphicitem style="width: 10.8108108108%">\n                         <div>72</div>\n                       </div>\n-                      <div class=graphicitem style="width: 2.7027027027027026%">\n+                      <div class=graphicitem style="width: 2.7027027027%">\n                         <div>&nbsp;</div>\n                         <div class=lastlabel>74</div>\n                       </div>\n@@ -1426,7 +1426,7 @@\n                    title="EUG|RIKILT|plasmid_pV-ZMBK07|plasmid_pV-ZMBK07|-2635190737607180000">\n                   <div class="matchrow graphicrow">\n                     <div class="matchitem graphicitem"\n-                         style="background-color: green; width: 100.0%"></div>\n+                         style="background-color: green; width: 100%"></div>\n                   </div>\n                 </a>\n \n@@ -1437,7 +1437,7 @@\n                    title="AY326434|GenBank|insert_MON810|Synthetic_construct_truncated_CRYIA(b)_(cryIA(b))_gene,_partial_CDS|-2635190737607180000">\n                   <div class="matchrow graphicrow">\n                     <div class="matchitem graphicitem"\n-                         style="background-color: green; width: 100.0%"></div>\n+                         style="background-color: green; width: 100%"></div>\n                   </div>\n                 </a>\n \n'
b
diff -r 6ecbfebb9dd9 -r 40ce2043006a test-data/refresh_test_results.sh
--- a/test-data/refresh_test_results.sh Wed Jun 18 14:33:12 2014 +0200
+++ b/test-data/refresh_test_results.sh Thu Jun 19 17:00:29 2014 +0200
b
@@ -2,7 +2,9 @@
 
 # run this from the directory it exists in to update the test outputs
 
+set -eu
+
 for i in 1 2 3 4
 do
- ../blast2html.py -i "blast xml example$i.xml" -o "blast xml example$i.html"
+ "$@" ../blast2html.py -i "blast xml example$i.xml" -o "blast xml example$i.html"
 done