Mercurial > repos > jankanis > blast2html
comparison 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 |
comparison
equal
deleted
inserted
replaced
109:ea3bc0b9a3d9 | 110:e17aae23cc1c |
---|---|
222 # sort hits by longest hotspot first | 222 # sort hits by longest hotspot first |
223 return sorted(result.Iteration_hits.findall('Hit'), | 223 return sorted(result.Iteration_hits.findall('Hit'), |
224 key=lambda h: max(blastxml_len(hsp) for hsp in h.Hit_hsps.Hsp), | 224 key=lambda h: max(blastxml_len(hsp) for hsp in h.Hit_hsps.Hsp), |
225 reverse=True) | 225 reverse=True) |
226 | 226 |
227 @filter('params') | |
228 def result_params(iteration): | |
229 return (('Query number', iteration['Iteration_iter-num']), | |
230 ('Query ID', iteration['Iteration_query-ID']), | |
231 ('Definition line', iteration['Iteration_query-def']), | |
232 ('Length', blastxml_len(iteration))) | |
227 | 233 |
228 | 234 |
229 class BlastVisualize: | 235 class BlastVisualize: |
230 | 236 |
231 colors = ('black', 'blue', 'green', 'magenta', 'red') | 237 colors = ('black', 'blue', 'green', 'magenta', 'red') |
256 environment.filters[filtername] = getattr(builtins, funcname) | 262 environment.filters[filtername] = getattr(builtins, funcname) |
257 | 263 |
258 def render(self, output): | 264 def render(self, output): |
259 template = self.environment.get_template(self.templatename) | 265 template = self.environment.get_template(self.templatename) |
260 | 266 |
261 params = (('Query ID', self.blast["BlastOutput_query-ID"]), | 267 params = (('Program', self.blast.BlastOutput_version), |
262 ('Query definition', self.blast["BlastOutput_query-def"]), | |
263 ('Query length', self.blast["BlastOutput_query-len"]), | |
264 ('Program', self.blast.BlastOutput_version), | |
265 ('Database', self.blast.BlastOutput_db), | 268 ('Database', self.blast.BlastOutput_db), |
266 ) | 269 ) |
267 | 270 |
268 result = template.stream(blast=self.blast, | 271 result = template.stream(blast=self.blast, |
269 iterations=self.blast.BlastOutput_iterations.Iteration, | 272 iterations=self.blast.BlastOutput_iterations.Iteration, |