@@ -254,8 +254,6 @@ def compute_irmsd_fast(
254254 # read the izone file
255255 if izone is None :
256256 resData = self .compute_izone (cutoff , save_file = False )
257- # elif not os.path.isfile(izone):
258- # resData = self.compute_izone(cutoff,save_file=True,filename=izone)
259257 else :
260258 resData = self .read_zone (izone )
261259
@@ -501,37 +499,40 @@ def compute_lrmsd_pdb2sql(self, exportpath=None, method='svd'):
501499 backbone = ['CA' , 'C' , 'N' , 'O' ]
502500
503501 # create the sql
504- sql_decoy = pdb2sql (
505- self .decoy , sqlfile = 'decoy.db' , fix_chainID = True )
506- sql_ref = pdb2sql (
507- self .ref , sqlfile = 'ref.db' , fix_chainID = True )
502+ sql_decoy = pdb2sql (self .decoy , sqlfile = 'decoy.db' )
503+ sql_ref = pdb2sql (self .ref , sqlfile = 'ref.db' )
504+
505+ # get the chains
506+ chains_decoy = sql_decoy .get_chains ()
507+ chains_ref = sql_ref .get_chains ()
508+
509+ if chains_decoy != chains_ref :
510+ raise ValueError (
511+ 'Chains are different in decoy and reference structure' )
512+
513+ chain1 = chains_decoy [0 ]
514+ chain2 = chains_decoy [1 ]
508515
509516 # extract the pos of chains A
510517 xyz_decoy_A = np .array (
511- sql_decoy .get (
512- 'x,y,z' ,
513- chainID = 'A' ,
514- name = backbone ))
518+ sql_decoy .get ('x,y,z' , chainID = chain1 , name = backbone ))
515519 xyz_ref_A = np .array (sql_ref .get (
516- 'x,y,z' , chainID = 'A' , name = backbone ))
520+ 'x,y,z' , chainID = chain1 , name = backbone ))
517521
518522 # extract the pos of chains B
519523 xyz_decoy_B = np .array (
520- sql_decoy .get (
521- 'x,y,z' ,
522- chainID = 'B' ,
523- name = backbone ))
524+ sql_decoy .get ('x,y,z' , chainID = chain2 , name = backbone ))
524525 xyz_ref_B = np .array (sql_ref .get (
525- 'x,y,z' , chainID = 'B' , name = backbone ))
526+ 'x,y,z' , chainID = chain2 , name = backbone ))
526527
527528 # check the lengthes
528529 if len (xyz_decoy_A ) != len (xyz_ref_A ):
529530 xyz_decoy_A , xyz_ref_A = self .get_identical_atoms (
530- sql_decoy , sql_ref , 'A' )
531+ sql_decoy , sql_ref , chain1 )
531532
532533 if len (xyz_decoy_B ) != len (xyz_ref_B ):
533534 xyz_decoy_B , xyz_ref_B = self .get_identical_atoms (
534- sql_decoy , sql_ref , 'B' )
535+ sql_decoy , sql_ref , chain2 )
535536
536537 # detect which chain is the longest
537538 nA , nB = len (xyz_decoy_A ), len (xyz_decoy_B )
@@ -688,14 +689,26 @@ def compute_irmsd_pdb2sql(
688689 """
689690
690691 # create thes sql
691- sql_decoy = interface (self .decoy , fix_chainID = True )
692- sql_ref = interface (self .ref , fix_chainID = True )
692+ sql_decoy = interface (self .decoy )
693+ sql_ref = interface (self .ref )
694+
695+ # get the chains
696+ chains_decoy = sql_decoy .get_chains ()
697+ chains_ref = sql_ref .get_chains ()
698+
699+ if chains_decoy != chains_ref :
700+ raise ValueError (
701+ 'Chains are different in decoy and reference structure' )
693702
694703 # get the contact atoms
695704 if izone is None :
705+
696706 contact_ref = sql_ref .get_contact_atoms (
697707 cutoff = cutoff ,
698- extend_to_residue = True )
708+ extend_to_residue = True ,
709+ chain1 = chains_ref [0 ],
710+ chain2 = chains_decoy [1 ])
711+
699712 index_contact_ref = []
700713 for v in contact_ref .values ():
701714 index_contact_ref += v
0 commit comments