@@ -196,16 +196,21 @@ def get_mc_scores(propensities, identifier, ignore_intra:bool):
196
196
BB_propensities = []
197
197
AB_propensities = []
198
198
BA_propensities = []
199
-
200
- if ignore_intra is True :
201
- propensities = [p for p in propensities if p .is_intermolecular ]
199
+ AA_intra_propensities = []
200
+ BB_intra_propensities = []
202
201
203
202
for p in propensities :
203
+ if ignore_intra and not p .is_intermolecular :
204
+ continue
204
205
t = "%s_d" % p .donor_label .split (" " )[0 ], "%s_a" % p .acceptor_label .split (" " )[0 ]
205
206
if '_A_' in t [0 ] and '_A_' in t [1 ]:
206
207
AA_propensities .append (p .propensity )
208
+ if not p .is_intermolecular :
209
+ AA_intra_propensities .append (p .propensity )
207
210
elif '_B_' in t [0 ] and '_B_' in t [1 ]:
208
211
BB_propensities .append (p .propensity )
212
+ if not p .is_intermolecular :
213
+ BB_intra_propensities .append (p .propensity )
209
214
elif '_A_' in t [0 ] and '_B_' in t [1 ]:
210
215
AB_propensities .append (p .propensity )
211
216
elif '_B_' in t [0 ] and '_A_' in t [1 ]:
@@ -215,10 +220,13 @@ def get_mc_scores(propensities, identifier, ignore_intra:bool):
215
220
max_AB = max (AB_propensities ) if len (AB_propensities ) > 0 else 0.0
216
221
max_BA = max (BA_propensities ) if len (BA_propensities ) > 0 else 0.0
217
222
max_list = [max_AA , max_BB , max_AB , max_BA ]
218
- max_keys = ['A:A' , 'B:B' , 'A:B' , 'B:A' ]
219
223
max_mc = max (max_list [2 ], max_list [3 ])
220
224
max_sc = max (max_list [0 ], max_list [1 ])
221
225
226
+ max_keys = ['A:A*' , 'B:B*' , 'A:B' , 'B:A' ] if max_sc in AA_intra_propensities or max_sc in BB_intra_propensities \
227
+ else ['A:A' , 'B:B' , 'A:B' , 'B:A' ]
228
+
229
+
222
230
return [round ((max_mc - max_sc ), 2 ),
223
231
max_keys [max_list .index (max (max_list ))],
224
232
round (max_mc , 2 ),
@@ -431,7 +439,7 @@ def main(structure, work_directory, failure_directory, library, csdrefcode, igno
431
439
default = ccdc_coformers_dir )
432
440
parser .add_argument ('-f' , '--failure_directory' , type = str ,
433
441
help = 'The location where the failures file should be generated' )
434
- parser .add_argument ('-i' , '--ignore_intra' , action = 'store_true' , default = ' False' ,
442
+ parser .add_argument ('-i' , '--ignore_intra' , action = 'store_true' , default = False ,
435
443
help = 'Ignore intramolecular hydrogen bonds when ranking pairs' )
436
444
parser .add_argument ('--force_run_disordered' , action = "store_true" ,
437
445
help = 'Forces running the script on disordered entries. (NOT RECOMMENDED)' , default = False )
0 commit comments