comparison blast2html.py @ 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 4e6ac737ba17
comparison
equal deleted inserted replaced
23:6995a6f34f3f 24:c8347745bbad
61 title = title)) 61 title = title))
62 return titles 62 return titles
63 63
64 @filter 64 @filter
65 def hitid(hit): 65 def hitid(hit):
66 return hit.Hit_id.text.split('|', 2)[1] 66 hitid = hit.Hit_id.text
67 s = hitid.split('|', 2)
68 if len(s) >= 2:
69 return s[1]
70 return hitid
67 71
68 @filter 72 @filter
69 def seqid(hit): 73 def seqid(hit):
70 return hit.Hit_id.text.split('|', 2)[2] 74 hitid = hit.Hit_id.text
75 s = hitid.split('|', 2)
76 if len(s) >= 3:
77 return s[2]
78 return hitid
79
71 80
72 @filter 81 @filter
73 def alignment_pre(hsp): 82 def alignment_pre(hsp):
74 return ( 83 return (
75 "Query {:>7s} {} {}\n".format(hsp['Hsp_query-from'].text, hsp.Hsp_qseq, hsp['Hsp_query-to']) + 84 "Query {:>7s} {} {}\n".format(hsp['Hsp_query-from'].text, hsp.Hsp_qseq, hsp['Hsp_query-to']) +