-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathRNApdb2xyz.py
executable file
·47 lines (38 loc) · 1.36 KB
/
RNApdb2xyz.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
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/python
from sys import argv
from os import system
tinker_name_convert = { ' A':' A',
' C':' C',
' G':' G',
' U':' U',
' rA':' A',
' rC':' C',
' rG':' G',
' rU':' U',
'ADE':' A',
'CYT':' C',
'GUA':' G',
'URA':' U' }
for file in argv[1:]:
lines = open( file ).readlines()
new_file = file.replace( '.pdb', '_temp.pdb')
fid = open( new_file, 'w' )
for line in lines:
if line[:4] == 'ATOM':
resname = line[17:20]
if resname in tinker_name_convert:
tinker_name = tinker_name_convert[ resname ]
else:
print "Unknown RNA Residue Name? ", resname
tinker_name = resname
fid.write( line[:17] +tinker_name +line[20:])
fid.close()
command = '~rhiju/src/tinker/bin/pdbxyz '+new_file+' ~rhiju/src/tinker/params/amber99.prm'
print command
system( command )
command = 'mv '+new_file.replace('.pdb','.xyz')+' '+file.replace('.pdb','.xyz')
print command
system( command )
command = 'rm '+new_file.replace('.pdb','*')
print command
system( command )