changeset 110:e17aae23cc1c

report query parameters for each query
author Jan Kanis <jan.code@jankanis.nl>
date Wed, 09 Jul 2014 15:04:37 +0200
parents ea3bc0b9a3d9
children 7aa28753d7b3
files blast2html.html.jinja blast2html.py
diffstat 2 files changed, 20 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/blast2html.html.jinja	Tue Jul 08 17:51:22 2014 +0200
+++ b/blast2html.html.jinja	Wed Jul 09 15:04:37 2014 +0200
@@ -396,6 +396,18 @@
 
       {% else %}
 
+      <section class=header>
+
+        <h1>Nucleotide Blast results</h1>
+
+        <table class=headerdata>
+          {% for param, value in params %}
+          <tr><td class=param>{{param}}:</td><td>{{value}}</td></tr>
+          {% endfor %}
+        </table>
+
+      </section>
+
       {% if blast.BlastOutput_iterations.findall('Iteration') | length > 1 %}
       <section class=index>
         <h1>Queries</h1>
@@ -420,7 +432,7 @@
         <section class=header>
 
           <table class=headerdata>
-            {% for param, value in params %}
+            {% for param, value in result|params %}
             <tr><td class=param>{{param}}:</td><td>{{value}}</td></tr>
             {% endfor %}
           </table>
--- a/blast2html.py	Tue Jul 08 17:51:22 2014 +0200
+++ b/blast2html.py	Wed Jul 09 15:04:37 2014 +0200
@@ -224,6 +224,12 @@
                   key=lambda h: max(blastxml_len(hsp) for hsp in h.Hit_hsps.Hsp),
                   reverse=True)
 
+@filter('params')
+def result_params(iteration):
+    return (('Query number', iteration['Iteration_iter-num']),
+            ('Query ID', iteration['Iteration_query-ID']),
+            ('Definition line', iteration['Iteration_query-def']),
+            ('Length', blastxml_len(iteration)))
 
 
 class BlastVisualize:
@@ -258,10 +264,7 @@
     def render(self, output):
         template = self.environment.get_template(self.templatename)
 
-        params = (('Query ID', self.blast["BlastOutput_query-ID"]),
-                  ('Query definition', self.blast["BlastOutput_query-def"]),
-                  ('Query length', self.blast["BlastOutput_query-len"]),
-                  ('Program', self.blast.BlastOutput_version),
+        params = (('Program', self.blast.BlastOutput_version),
                   ('Database', self.blast.BlastOutput_db),
         )