-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainDocking.py
More file actions
315 lines (251 loc) · 8.15 KB
/
Copy pathMainDocking.py
File metadata and controls
315 lines (251 loc) · 8.15 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
from StructureTools import scorelist, writePDB, extract100Bests, writeInterfacePDB
from parsing import parserPDB, preparePDB, parseDirectory
from Usage import usage
from RMSD import computeRMSD
import sys
from path import path
from Interface import computeInterface, compareInterface, computeInterfaceScore, interfaceHydrophobicity
if __name__ == '__main__':
#################################
# ARGUMENTS AND PARAMETERS #
# RETRIEVAL #
#################################
'''
Receptor pdb file and ligand solutions directory retrieval
'''
try:
infile = sys.argv[sys.argv.index("-pdb1")+1]
indir = sys.argv[sys.argv.index("-pdb2")+1]
except:
usage()
print "ERROR: please enter the names of the pdb files to analyze\n"
sys.exit()
'''
Native receptor, native ligand and native complex pdb files retrieval
'''
try:
nativeComplex = sys.argv[sys.argv.index("-pdb3")+1]
nativeLigand = sys.argv[sys.argv.index("-pdb4")+1]
nativeReceptor = sys.argv[sys.argv.index("-pdb5")+1]
except :
usage()
print "ERROR: please enter the names of the pdb files to compare\n"
sys.exit()
'''
Configuration of the computeInterface function
'''
try :
thresholdParam = float(sys.argv[sys.argv.index("-threshold")+1])
except :
thresholdParam = 2
try :
interfaceModeParam = (sys.argv[sys.argv.index("-mode")+1])
except :
interfaceModeParam = "atom"
'''
Configuration of the computeRMSD function
'''
try :
atomParam = sys.argv[sys.argv.index("-atom")+1]
l_atomParam = []
if atomParam == ALL :
l_atomParam = ["atom"]
else :
for x in atomParam.split("_"):
l_atomParam.append(x);
except :
l_atomParam = ["CA", "N", "C", "O"]
#########################
# INITIALISATION #
# AND PARSING #
#########################
'''
Native receptor, natve ligand and natif complex pdb files parsing
'''
try :
dico_lig_natif = parserPDB(nativeLigand)
except :
print "ERROR : File parsing of "+nativeLigand+" failed"
sys.exit()
try :
dico_rec_natif = parserPDB(nativeReceptor)
except :
print "ERROR : File parsing of "+nativeReceptor+" failed"
sys.exit()
try :
dico_compl_natif = parserPDB(nativeComplex)
except :
print "ERROR : File parsing of "+nativeComplex+" failed"
sys.exit()
'''
Preparation of the receptor pdb file
'''
try:
dico_Rec = preparePDB(infile)
except:
print "ERROR : Parsing of "+infile+" failed"
sys.exit()
#########################
# FIRST METHOD #
#########################
#DETERMINATION OF THE RIGHT COMPLEX SOLUTION
print "Start of the first method"
'''
Ligand directory parsing
Score determination
'''
try:
listFiles, listScores = parseDirectory(indir, dico_Rec)
except:
print "ERROR : Parsing of "+indir+" failed : make sure to enter the full path of the directory"
sys.exit()
'''
Best score determination
'''
try:
filenum = int(scorelist(listFiles, listScores, "Scoring1.txt"))
except:
print "ERROR : Could not find the file corresponding to the best score"
sys.exit()
filename="1BRS_A_1BRS_B_allatom_"+str(filenum)+"_DP.pdb"
pathfile=[indir,'/',filename]
dico_Lig = parserPDB(''.join(pathfile)) #Dictionnary of the ligand solution
'''
Writing the file containing the score ranking according to the first method
'''
try:
writePDB(dico_Rec, dico_Lig, prediction = "complexe_predit_score1.pdb")
except:
print "ERROR : Could not create list of scoring"
sys.exit()
'''
First method predicted complex pdb file parsing
'''
try :
dico_compl_predit = parserPDB("complexe_predit_score1.pdb")
except :
print "ERROR : File parsing of complexe_predit_score1.pdb failed"
#SOLUTION EVALUATION
'''
Calculation of the native and predicted complex interfaces
'''
try :
computeInterface(dico_compl_natif, thresholdParam, interfaceModeParam)
computeInterface(dico_compl_predit, thresholdParam, interfaceModeParam)
except :
print "ERROR : Interface calculation failed."
sys.exit()
'''
Interface comparison
'''
try :
nbresInter = compareInterface(dico_compl_natif, dico_compl_predit)
except :
print "ERROR : Interface comparison failed."
sys.exit()
print "Number of native contacts: "+str(nbresInter)
'''
RMSD calculation
dico_Lig and dico_lig_natif are dictionaries corresponding to the best ligand solution and native ligand (-pdb4) pdb files
dico_compl_predit and dico_compl_natif are dictionaries corresponding to the predicted complexe and native complex (-pdb3) pdb files
bfactor indicate if the calculation is made only on the interface
'''
try :
print "First solution :"
print "\t->ligand RMSD : "+str(computeRMSD(dico_Lig, dico_lig_natif, l_atomParam, bfactor = False))
print "\t->complex RMSD : "+str(computeRMSD(dico_compl_predit, dico_compl_natif, l_atomParam, bfactor = False))
print "\t->interface RMSD : "+str(computeRMSD(dico_compl_predit, dico_compl_natif, l_atomParam, bfactor = True))
except :
print "ERROR : RMSD calculation failed."
sys.exit()
'''
Editing of the complexe_predit_score1.pdb to add the bfactor
For easy manipulation with Pymol
'''
try:
writeInterfacePDB(dico_compl_predit,"complexe_predit_score1.pdb")
except:
print "ERROR : Could not edit complexe_predit_score1.pdb"
#########################
# SECOND METHODE #
#########################
#SOLUTION DETERMINATION
print "Start of the second method"
'''
Extraction of the 100 best results by thefirst method
'''
try:
listBestHits, listBestScores, listBestFiles = extract100Bests(indir)
except:
print "ERROR : Could not extract the 100 best hits"
sys.exit()
'''
Calculation of the second score considering hydrophobicity of the interface residues
'''
try:
listNewScore=interfaceHydrophobicity(listBestHits, listBestScores, dico_Rec, thresholdParam, interfaceModeParam)
except:
print "ERROR : Could not compute the new score taking the hydrophobicity in paramaters"
sys.exit()
filenum = int(scorelist(listBestFiles, listNewScore, "Scoring2.txt"))
filename="1BRS_A_1BRS_B_allatom_"+str(filenum)+"_DP.pdb"
pathfile=[indir,'/',filename]
dico_Lig = parserPDB(''.join(pathfile)) #Dictionnary of the ligand solution
'''
Writing the file containing the score ranking according to the second method
'''
try:
writePDB(dico_Rec, dico_Lig, prediction = "complexe_predit_score2.pdb")
except:
print "ERROR : Could not create list of scoring"
sys.exit()
'''
Second method predicted complex pdb file parsing
'''
try :
dico_compl_predit = parserPDB("complexe_predit_score2.pdb")
except :
print "ERROR : File parsing of complexe_predit_score1.pdb failed"
sys.exit()
#EVALUATION DE LA SOLUTION
'''
Calculation of the native and predicted complex interfaces
'''
try :
computeInterface(dico_compl_natif, thresholdParam, interfaceModeParam)
computeInterface(dico_compl_predit, thresholdParam, interfaceModeParam)
except :
print "ERROR : Interface calculation failed."
sys.exit()
'''
Interface comparison
'''
try :
nbresInter = compareInterface(dico_compl_natif, dico_compl_predit)
except :
print "ERROR : Interface comparison failed."
sys.exit()
print "Number of native contacts: "+str(nbresInter)
'''
RMSD calculation
dico_Lig and dico_lig_natif are dictionaries corresponding to the best ligand solution and native ligand (-pdb4) pdb files
dico_compl_predit and dico_compl_natif are dictionaries corresponding to the second method predicted complexe and native complex (-pdb3) pdb files
bfactor indicate if the calculation is made only on the interface
'''
try :
print "Second solution :"
print "\t->ligand RMSD : "+str(computeRMSD(dico_Lig, dico_lig_natif, l_atomParam, bfactor = False))
print "\t->complex RMSD : "+str(computeRMSD(dico_compl_predit, dico_compl_natif, l_atomParam, bfactor = False))
print "\t->interface RMSD : "+str(computeRMSD(dico_compl_predit, dico_compl_natif, l_atomParam, bfactor = True))
except :
print "ERROR : RMSD calculation failed."
sys.exit()
'''
Editing of the complexe_predit_score1.pdb to add the Bfactor
For easy manipulation with Pymol
'''
try:
writeInterfacePDB(dico_compl_predit,"complexe_predit_score2.pdb")
except:
print "ERROR : Could not edit complexe_predit_score2.pdb"
sys.exit()