diff additional/glimmer2gff.py @ 6:a07c49839f31

Uploaded
author bgruening
date Sun, 09 Jun 2013 07:57:22 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/additional/glimmer2gff.py	Sun Jun 09 07:57:22 2013 -0400
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+
+"""
+Input: Glimmer3 prediction
+Output: GFF3 file
+Return a GFF3 file with the genes predicted by Glimmer3
+Bjoern Gruening
+
+Note: Its not a full-fledged GFF3 file, its a really simple one.
+
+"""
+
+import sys, re
+
+def __main__():
+    input_file = open(sys.argv[1], 'r')
+
+    print '##gff-version 3\n'
+    for line in input_file:
+        line = line.strip()
+        if line[0] == '>':
+            header = line[1:]
+        else:
+            (id, start, end, frame, score) = re.split('\s+', line)
+            if int(end) > int(start):
+                strand = '+'
+            else:
+                strand = '-'
+                (start, end) = (end, start)
+
+            rest = 'frame=%s;score=%s' % (frame, score)
+            print '\t'.join([header, 'glimmer_prediction', 'predicted_gene', start, end, '.', strand, '.', rest])
+
+
+if __name__ == "__main__" :
+    __main__()