-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix.py
More file actions
executable file
·61 lines (47 loc) · 1.43 KB
/
fix.py
File metadata and controls
executable file
·61 lines (47 loc) · 1.43 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/python
# **************************************************
# ..................................................
# Fix selected side chains.
# ..................................................
# **************************************************
# DESCRIPTION:
# The script loads the 'opt.mop' file and sets the
# optimization flags to '+0', i.e. constrains the
# atom.
# PARAMETERS:
# Choose the side chains in the list below:
residues_to_fix = [
'24',
'25'
#'38'
# '50',
#'133',
#'156',
# '277',
# '280'
]
# CALLING SEQUENCE:
# python fix.py 1-3-opt-*.mop
import sys
from os.path import splitext
opt_dat = open(sys.argv[1], 'r')
opt_val = opt_dat.readlines()
opt_dat.close()
mop_string = ''
tmp_dat = open(sys.argv[1], 'w')
print "Fixing side chains in:", splitext(sys.argv[1])[0]
for line in opt_val:
# Only consider lines with more than 4 elements,
# ends up being lines with atom data.
if len(line.split()) != 0:
# Discard the last character of the '3' element,
# its a closing brace ')'.
if line.split()[3][:-1] in residues_to_fix:
# Replace the optimization flags.
mop_string += line[:34] + '0' + line[35:50] + '0' + line[51:66] + '0' + line[67:]
else:
mop_string += line
else:
mop_string += line
tmp_dat.write(mop_string)
tmp_dat.close()