-
Notifications
You must be signed in to change notification settings - Fork 1
/
pym2tcl.py
executable file
·36 lines (31 loc) · 1.08 KB
/
pym2tcl.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python
import re
import os
# Select input file.
#InputFileName = raw_input('choose pym file to open: ')
#Nst = raw_input('enter number of structures: ')
#Nstrs = int(Nst)
Nstrs = 10000
for i in range(Nstrs):
InputFileName = "conf_eif3." + str(i) + ".pym"
if not os.path.exists(InputFileName):
continue
InputFile = open(InputFileName, 'r') # Open file to read
# string of lines from pdb file
InputFileLines = InputFile.read().splitlines()
# InputFile.close()
Fname = 'conf_eif3.' + str(i) + '.tcl'
f1 = open(Fname, 'w')
f1.write('draw color blue' + '\n')
for line in InputFileLines:
if line.find('SPHERE') >= 0:
seq = line[:]
Newseq = seq.replace(",", " ")
l = re.findall("(\S+)", Newseq)
seqX = str(float(l[1]))
seqY = str(float(l[2]))
seqZ = str(float(l[3]))
seqRad = str(float(l[4]))
f1.write(
'draw sphere { ' + seqX + ' ' + seqY + ' ' + seqZ + ' ' +
'} radius ' + seqRad + ' resolution 300' + '\n')