diff ORFFinder.py @ 8:e5616d5101c0 draft default tip

Bug fix - Null strand give index out of bound error
author nedias
date Wed, 19 Oct 2016 14:24:31 -0400
parents d42adca5ecc2
children
line wrap: on
line diff
--- a/ORFFinder.py	Wed Oct 12 18:13:02 2016 -0400
+++ b/ORFFinder.py	Wed Oct 19 14:24:31 2016 -0400
@@ -109,8 +109,14 @@
 
     # The longest pair of each strand is store in the last position of the pair list,
     # so just pull it out directly
-    pos_longest = pairs[-1][1] - pairs[-1][0]
-    rev_longest = rev_pairs[-1][1] - rev_pairs[-1][0]
+    if len(pairs) > 1:
+        pos_longest = pairs[-1][1] - pairs[-1][0]
+    else:
+        pos_longest = 0
+    if len(rev_pairs) > 1:
+        rev_longest = rev_pairs[-1][1] - rev_pairs[-1][0]
+    else:
+        rev_longest = 0
     return max(pos_longest, rev_longest)