@@ -476,8 +476,13 @@ def compute_residue_pairs_ref(
476476 """
477477
478478 sql_ref = interface (self .ref )
479+ chains = list (sql_ref .get_chains ())
480+ if len (chains ) != 2 :
481+ raise ValueError (
482+ 'exactly two chains are needed for fnat calculation but we found %d' % len (chains ), chains )
479483 residue_pairs_ref = sql_ref .get_contact_residues (
480- cutoff = cutoff , return_contact_pairs = True , excludeH = True )
484+ cutoff = cutoff , return_contact_pairs = True , excludeH = True ,
485+ chain1 = chains [0 ], chain2 = chains [1 ])
481486 sql_ref ._close ()
482487
483488 if save_file :
@@ -936,12 +941,18 @@ def compute_fnat_pdb2sql(self, cutoff=5.0):
936941 # create the sql
937942 sql_decoy = interface (self .decoy , fix_chainID = True )
938943 sql_ref = interface (self .ref , fix_chainID = True )
944+ chains = list (sql_ref .get_chains ())
945+ if len (chains ) != 2 :
946+ raise ValueError (
947+ 'exactly two chains are needed for irmsd calculation but we found %d' % len (chains ), chains )
939948
940949 # get the contact atoms
941950 residue_pairs_decoy = sql_decoy .get_contact_residues (
942- cutoff = cutoff , return_contact_pairs = True , excludeH = True )
951+ cutoff = cutoff , return_contact_pairs = True , excludeH = True ,
952+ chain1 = chains [0 ], chain2 = chains [1 ])
943953 residue_pairs_ref = sql_ref .get_contact_residues (
944- cutoff = cutoff , return_contact_pairs = True , excludeH = True )
954+ cutoff = cutoff , return_contact_pairs = True , excludeH = True ,
955+ chain1 = chains [0 ], chain2 = chains [1 ])
945956
946957 # form the pair data
947958 data_pair_decoy = []
@@ -1212,7 +1223,7 @@ def scale_rms(rms, d):
12121223 ##########################################################################
12131224
12141225 @staticmethod
1215- def compute_clashes (pdb ):
1226+ def compute_clashes (pdb , chain1 = 'A' , chain2 = 'B' ):
12161227 """Compute number of atomic clashes.
12171228
12181229 Note:
@@ -1223,14 +1234,17 @@ def compute_clashes(pdb):
12231234
12241235 Args:
12251236 pdb(file): pdb file or data
1237+ chain1 (str): first chain ID. Defaults to 'A'.
1238+ chain2 (str): second chain ID. Defaults to 'B'.
12261239
12271240 Returns:
12281241 int: number of atomic clashes.
12291242 """
12301243 db = interface (pdb )
12311244 atom_contact_pairs = db .get_contact_atoms (
12321245 cutoff = 3.0 , excludeH = True ,
1233- return_contact_pairs = True )
1246+ return_contact_pairs = True ,
1247+ chain1 = chain1 , chain2 = chain2 )
12341248 db ._close ()
12351249 nclash = 0
12361250 for v in atom_contact_pairs .values ():
0 commit comments