diff blast2html.py @ 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 0c2a03f9740b
line wrap: on
line diff
--- 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),
         )