changeset 24:c8347745bbad

use Iteration_message tag; also work with unexpected Hit_id values
author Jan Kanis <jan.code@jankanis.nl>
date Thu, 15 May 2014 12:12:21 +0200
parents 6995a6f34f3f
children b77934f57522
files blast2html.html.jinja blast2html.py
diffstat 2 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/blast2html.html.jinja	Thu May 15 11:05:39 2014 +0200
+++ b/blast2html.html.jinja	Thu May 15 12:12:21 2014 +0200
@@ -414,7 +414,9 @@
         <section>
           <h2>No Hits</h2>
           <div class=grey>
-            This query did not match anywhere
+            <table class=headerdata>
+              <tr><td class=param>Message:</td><td>{{result.Iteration_message}}</td></tr>
+            </table>
           </div>
         </section>
         {% else %}
--- a/blast2html.py	Thu May 15 11:05:39 2014 +0200
+++ b/blast2html.py	Thu May 15 12:12:21 2014 +0200
@@ -63,11 +63,20 @@
 
 @filter
 def hitid(hit):
-    return hit.Hit_id.text.split('|', 2)[1]
+    hitid = hit.Hit_id.text
+    s = hitid.split('|', 2)
+    if len(s) >= 2:
+        return s[1]
+    return hitid
 
 @filter
 def seqid(hit):
-    return hit.Hit_id.text.split('|', 2)[2]
+    hitid = hit.Hit_id.text
+    s = hitid.split('|', 2)
+    if len(s) >= 3:
+        return s[2]
+    return hitid
+
 
 @filter
 def alignment_pre(hsp):