comparison glimmer_glimmer_to_gff.py @ 0:4da5f6bdcf12 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/glimmer commit 37388949e348d221170659bbee547bf4ac67ef1a
author bgruening
date Tue, 28 Nov 2017 10:10:13 -0500
parents
children 2529762847c3
comparison
equal deleted inserted replaced
-1:000000000000 0:4da5f6bdcf12
1 #!/usr/bin/env python
2
3 """
4 Input: Glimmer3 prediction
5 Output: GFF3 file
6 Return a GFF3 file with the genes predicted by Glimmer3
7 Bjoern Gruening
8
9 Note: Its not a full-fledged GFF3 file, its a really simple one.
10
11 """
12
13 import re
14 import sys
15
16
17 def __main__():
18 input_file = open(sys.argv[1], 'r')
19
20 print('##gff-version 3\n')
21 for line in input_file:
22 line = line.strip()
23 if line[0] == '>':
24 header = line[1:]
25 else:
26 (id, start, end, frame, score) = re.split('\s+', line)
27 if int(end) > int(start):
28 strand = '+'
29 else:
30 strand = '-'
31 (start, end) = (end, start)
32
33 rest = 'frame=%s;score=%s' % (frame, score)
34 print('\t'.join([header, 'glimmer_prediction', 'predicted_gene', start, end, '.', strand, '.', rest]))
35
36
37 if __name__ == "__main__":
38 __main__()