diff 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
line wrap: on
line diff
--- a/blast2html.py	Thu May 15 11:05:39 2014 +0200
+++ b/blast2html.py	Thu May 15 12:12:21 2014 +0200
@@ -63,11 +63,20 @@
 
 @filter
 def hitid(hit):
-    return hit.Hit_id.text.split('|', 2)[1]
+    hitid = hit.Hit_id.text
+    s = hitid.split('|', 2)
+    if len(s) >= 2:
+        return s[1]
+    return hitid
 
 @filter
 def seqid(hit):
-    return hit.Hit_id.text.split('|', 2)[2]
+    hitid = hit.Hit_id.text
+    s = hitid.split('|', 2)
+    if len(s) >= 3:
+        return s[2]
+    return hitid
+
 
 @filter
 def alignment_pre(hsp):