@@ -112,6 +112,7 @@ def load_contacts(
112
112
cutoff : float = 5.0 ,
113
113
numbering_dic : Optional [dict [str , dict [int , int ]]] = None ,
114
114
model2ref_chain_dict : Optional [dict [str , str ]] = None ,
115
+ keep_hetatm : bool = False ,
115
116
) -> set [tuple ]:
116
117
"""Load residue-based contacts.
117
118
@@ -121,6 +122,8 @@ def load_contacts(
121
122
PDB file of the model to have its atoms identified
122
123
cutoff : float, optional
123
124
Cutoff distance for the interface identification.
125
+ keep_hetatm : bool
126
+ Should HETATM coordinates be considered ? (default False)
124
127
125
128
Returns
126
129
-------
@@ -136,6 +139,7 @@ def load_contacts(
136
139
atoms ,
137
140
numbering_dic = numbering_dic ,
138
141
model2ref_chain_dict = model2ref_chain_dict ,
142
+ keep_hetatm = keep_hetatm ,
139
143
)
140
144
# create coordinate arrays
141
145
coord_arrays : dict [str , NDFloat ] = {}
@@ -217,6 +221,7 @@ def __init__(
217
221
self .atoms = self ._load_atoms (model , reference , full = self .allatoms )
218
222
self .r_chain = params ["receptor_chain" ]
219
223
self .l_chains = params ["ligand_chains" ]
224
+ self .keep_hetatm = params ["keep_hetatm" ]
220
225
self .model2ref_numbering = None
221
226
self .model2ref_chain_dict = None
222
227
self .output_ss_fname = Path (f"capri_ss_{ identificator } .tsv" )
@@ -235,14 +240,21 @@ def calc_irmsd(self, cutoff: float = 5.0) -> None:
235
240
The cutoff distance for the intermolecular contacts.
236
241
"""
237
242
# Identify reference interface
238
- ref_interface_resdic = self .identify_interface (self .reference , cutoff )
243
+ ref_interface_resdic = self .identify_interface (
244
+ self .reference ,
245
+ cutoff ,
246
+ keep_hetatm = self .keep_hetatm ,
247
+ )
239
248
240
249
if len (ref_interface_resdic ) == 0 :
241
250
log .warning ("No reference interface found" )
242
251
else :
243
252
# Load interface coordinates
244
253
ref_coord_dic , _ = load_coords (
245
- self .reference , self .atoms , ref_interface_resdic
254
+ self .reference ,
255
+ self .atoms ,
256
+ ref_interface_resdic ,
257
+ keep_hetatm = self .keep_hetatm ,
246
258
)
247
259
try :
248
260
mod_coord_dic , _ = load_coords (
@@ -251,6 +263,7 @@ def calc_irmsd(self, cutoff: float = 5.0) -> None:
251
263
ref_interface_resdic ,
252
264
numbering_dic = self .model2ref_numbering ,
253
265
model2ref_chain_dict = self .model2ref_chain_dict ,
266
+ keep_hetatm = self .keep_hetatm ,
254
267
)
255
268
except ALIGNError as alignerror :
256
269
log .warning (alignerror )
@@ -285,13 +298,18 @@ def calc_irmsd(self, cutoff: float = 5.0) -> None:
285
298
286
299
def calc_lrmsd (self ) -> None :
287
300
"""Calculate the L-RMSD."""
288
- ref_coord_dic , _ = load_coords (self .reference , self .atoms )
301
+ ref_coord_dic , _ = load_coords (
302
+ self .reference ,
303
+ self .atoms ,
304
+ keep_hetatm = self .keep_hetatm ,
305
+ )
289
306
try :
290
307
mod_coord_dic , _ = load_coords (
291
308
self .model ,
292
309
self .atoms ,
293
310
numbering_dic = self .model2ref_numbering ,
294
311
model2ref_chain_dict = self .model2ref_chain_dict ,
312
+ keep_hetatm = self .keep_hetatm ,
295
313
)
296
314
except ALIGNError as alignerror :
297
315
log .warning (alignerror )
@@ -390,11 +408,18 @@ def calc_ilrmsd(self, cutoff: float = 10.0) -> None:
390
408
The cutoff distance for the intermolecular contacts.
391
409
"""
392
410
# Identify interface
393
- ref_interface_resdic = self .identify_interface (self .reference , cutoff )
411
+ ref_interface_resdic = self .identify_interface (
412
+ self .reference ,
413
+ cutoff ,
414
+ keep_hetatm = self .keep_hetatm ,
415
+ )
394
416
# Load interface coordinates
395
417
396
418
ref_int_coord_dic , _ = load_coords (
397
- self .reference , self .atoms , ref_interface_resdic
419
+ self .reference ,
420
+ self .atoms ,
421
+ ref_interface_resdic ,
422
+ keep_hetatm = self .keep_hetatm ,
398
423
)
399
424
try :
400
425
mod_int_coord_dic , _ = load_coords (
@@ -403,6 +428,7 @@ def calc_ilrmsd(self, cutoff: float = 10.0) -> None:
403
428
ref_interface_resdic ,
404
429
numbering_dic = self .model2ref_numbering ,
405
430
model2ref_chain_dict = self .model2ref_chain_dict ,
431
+ keep_hetatm = self .keep_hetatm ,
406
432
)
407
433
except ALIGNError as alignerror :
408
434
log .warning (alignerror )
@@ -491,14 +517,19 @@ def calc_fnat(self, cutoff: float = 5.0) -> None:
491
517
cutoff : float
492
518
The cutoff distance for the intermolecular contacts.
493
519
"""
494
- ref_contacts = load_contacts (self .reference , cutoff )
520
+ ref_contacts = load_contacts (
521
+ self .reference ,
522
+ cutoff ,
523
+ keep_hetatm = self .keep_hetatm ,
524
+ )
495
525
if len (ref_contacts ) != 0 :
496
526
try :
497
527
model_contacts = load_contacts (
498
528
self .model ,
499
529
cutoff ,
500
530
numbering_dic = self .model2ref_numbering , # type: ignore
501
531
model2ref_chain_dict = self .model2ref_chain_dict , # type: ignore
532
+ keep_hetatm = self .keep_hetatm ,
502
533
)
503
534
except ALIGNError as alignerror :
504
535
log .warning (alignerror )
@@ -511,14 +542,19 @@ def calc_fnat(self, cutoff: float = 5.0) -> None:
511
542
def calc_global_rmsd (self ) -> None :
512
543
"""Calculate the full structure RMSD."""
513
544
# Load reference atomic coordinates
514
- ref_coord_dic , _ = load_coords (self .reference , self .atoms )
545
+ ref_coord_dic , _ = load_coords (
546
+ self .reference ,
547
+ self .atoms ,
548
+ keep_hetatm = self .keep_hetatm ,
549
+ )
515
550
# Load model atomic coordinates
516
551
try :
517
552
model_coord_dic , _ = load_coords (
518
553
self .model ,
519
554
self .atoms ,
520
555
numbering_dic = self .model2ref_numbering ,
521
556
model2ref_chain_dict = self .model2ref_chain_dict ,
557
+ keep_hetatm = self .keep_hetatm ,
522
558
)
523
559
except ALIGNError as alignerror :
524
560
log .warning (alignerror )
@@ -688,6 +724,7 @@ def _load_atoms(
688
724
def identify_interface (
689
725
pdb_f : PDBPath ,
690
726
cutoff : float = 5.0 ,
727
+ keep_hetatm : bool = False ,
691
728
) -> dict [str , list [int ]]:
692
729
"""Identify the interface.
693
730
@@ -697,6 +734,8 @@ def identify_interface(
697
734
PDB file of the model to have its atoms identified
698
735
cutoff : float, optional
699
736
Cutoff distance for the interface identification.
737
+ keep_hetatm : bool
738
+ Should HETATM coordinates be considered ? (default False)
700
739
701
740
Returns
702
741
-------
@@ -707,7 +746,7 @@ def identify_interface(
707
746
pdb_f = pdb_f .rel_path
708
747
709
748
interface_resdic : dict [str , list [int ]] = {}
710
- contacts = load_contacts (pdb_f , cutoff )
749
+ contacts = load_contacts (pdb_f , cutoff , keep_hetatm = keep_hetatm )
711
750
712
751
for contact in contacts :
713
752
first_chain , first_resid , sec_chain , sec_resid = contact
0 commit comments