diff --git a/modules/mol/alg/pymod/ligand_scoring.py b/modules/mol/alg/pymod/ligand_scoring.py index 2149af916973cb70c7b72f89b16c96b1d513b8e6..d52fbc60c5f4c86465deacdd1cec71731368df06 100644 --- a/modules/mol/alg/pymod/ligand_scoring.py +++ b/modules/mol/alg/pymod/ligand_scoring.py @@ -258,6 +258,11 @@ class LigandScorer: new_chain = new_editor.InsertChain(handle.chain.name) # Add the residue with its original residue number new_res = new_editor.AppendResidue(new_chain, handle, deep=True) + for old_atom in handle.atoms: + for old_bond in old_atom.bonds: + new_first = new_res.FindAtom(old_bond.first.name) + new_second = new_res.FindAtom(old_bond.second.name) + new_editor.Connect(new_first, new_second) return new_res def _process_ligand_residue(res): diff --git a/modules/mol/alg/tests/test_ligand_scoring.py b/modules/mol/alg/tests/test_ligand_scoring.py index 78f4b1275039d697e729d3a6be95cbbd7196f688..4bff9e812cbbf3d3c191aa335923446ea1db4395 100644 --- a/modules/mol/alg/tests/test_ligand_scoring.py +++ b/modules/mol/alg/tests/test_ligand_scoring.py @@ -232,7 +232,8 @@ class TestLigandScoring(unittest.TestCase): """ trg, trg_seqres = io.LoadMMCIF(os.path.join('testfiles', "1r8q.cif.gz"), seqres=True) mdl, mdl_seqres = io.LoadMMCIF(os.path.join('testfiles', "P84080_model_02.cif.gz"), seqres=True) - sc = LigandScorer(mdl, trg, None, None) + mdl_lig = io.LoadEntity(os.path.join('testfiles', "P84080_model_02_ligand_0.sdf")) + sc = LigandScorer(mdl, trg, [mdl_lig], None) # Note: expect warning about Binding site of H.ZN1 not mapped to the model sc._compute_scores() @@ -246,7 +247,7 @@ class TestLigandScoring(unittest.TestCase): [np.inf], [np.inf], [0.29399303], - [np.inf]])) + [np.inf]]), decimal=5) # Check lDDT-PLI self.assertEqual(sc.lddt_pli_matrix.shape, (7, 1))