Mercurial > repos > jankanis > blast2html
comparison blast2html.py @ 123:720efb818f1b
really fix python 2.6 array type code issue
| author | Jan Kanis <jan.code@jankanis.nl> | 
|---|---|
| date | Thu, 31 Jul 2014 18:40:28 +0200 | 
| parents | 5f104d05aa23 | 
| children | 0fa962dd83b4 | 
   comparison
  equal
  deleted
  inserted
  replaced
| 122:5f104d05aa23 | 123:720efb818f1b | 
|---|---|
| 327 | 327 | 
| 328 for hit in hits(result): | 328 for hit in hits(result): | 
| 329 hsps = hit.Hit_hsps.Hsp | 329 hsps = hit.Hit_hsps.Hsp | 
| 330 | 330 | 
| 331 # In python 2.6 array doesn't accept unicode type codes, but in 3.4 it requires them | 331 # In python 2.6 array doesn't accept unicode type codes, but in 3.4 it requires them | 
| 332 cover = array(str('B'), [0]) * query_length | 332 typecode_B = builtin_str('B') | 
| 333 cover = array(typecode_B, [0]) * query_length | |
| 333 for hsp in hsps: | 334 for hsp in hsps: | 
| 334 cover[hsp['Hsp_query-from']-1 : int(hsp['Hsp_query-to'])] = array(str('B'), [1]) * blastxml_len(hsp) | 335 cover[hsp['Hsp_query-from']-1 : int(hsp['Hsp_query-to'])] = array(typecode_B, [1]) * blastxml_len(hsp) | 
| 335 cover_count = cover.count(1) | 336 cover_count = cover.count(1) | 
| 336 | 337 | 
| 337 best_hsp = max(hsps, key=lambda h: h['Hsp_bit-score']) | 338 best_hsp = max(hsps, key=lambda h: h['Hsp_bit-score']) | 
| 338 | 339 | 
| 339 yield dict(hit = hit, | 340 yield dict(hit = hit, | 
