93
|
1 #!/usr/bin/env python
|
|
2 # -*- coding: utf-8 -*-
|
|
3
|
|
4 import sys
|
|
5
|
|
6 dot_file = sys.argv[1]
|
|
7 result_file = sys.argv[2]
|
|
8
|
|
9 h = file(result_file, 'w')
|
|
10 f = open(dot_file)
|
|
11
|
|
12
|
|
13
|
|
14 for aline in f.readlines():
|
|
15 line = aline.strip()
|
|
16 if line.find('>')!=-1:
|
|
17 id_line = line
|
|
18 idt = id_line.split('>')
|
|
19 ids = idt[1].strip()
|
|
20 else:
|
|
21 if line.find('(')!=-1:
|
|
22 structure_line = line
|
|
23 st = structure_line.split(' ')
|
|
24 structure = st[0].strip()
|
|
25 enert = st[1].strip()
|
|
26 if len(enert)>1:
|
|
27 enertt = enert.split('(')
|
|
28 enertt = enertt[1].strip()
|
|
29 else:
|
|
30 enertt = st[2].strip()
|
|
31 enerttt = enertt.split(')')
|
|
32 ener = enerttt[0].strip()
|
|
33 h.write('>ENERGY = '+ener+' '+ids+'\n')
|
|
34 h.write(seq+'\n')
|
|
35 h.write(structure+'\n')
|
|
36 else:
|
|
37 seq = line
|
|
38
|
|
39
|
|
40
|
|
41
|
|
42
|
|
43 f.close()
|
|
44 h.close()
|
|
45
|