Skip to content
Snippets Groups Projects
Verified Commit 887f8fda authored by Xavier Robin's avatar Xavier Robin
Browse files

test: fix check_resname test

This test was relying on a "bad" alignment between two essentially
unrelated chains. This is no longer happening after the replacement of
GlobalAlign by SemiGlobal in commit ddfa2ab5, and the chains no longer
align meaningfully. As a result no residue names were mismatching, as
the representation of the binding site in the model no longer existed.

We removed this assumption and only replace a single residue in the
entity. This avoids depending on an alignment in this test.
parent dbeeb8dd
Branches
Tags
No related merge requests found
......@@ -313,20 +313,28 @@ class TestLigandScoring(unittest.TestCase):
self.assertTrue(np.isnan(sc.lddt_pli_matrix[6, 0]))
def test_check_resnames(self):
"""Test check_resname argument works
"""Test that the check_resname argument works.
When set to True, it should raise an error if any residue in the
representation of the binding site in the model has a different
name than in the reference. Here we manually modify a residue
name to achieve that effect.
"""
# 4C0A has mismatching sequence and fails with check_resnames=True
mdl_1r8q = _LoadMMCIF("1r8q.cif.gz")
trg_4c0a = _LoadMMCIF("4c0a.cif.gz")
mdl = mdl_1r8q.Select("cname=D or cname=F")
trg = trg_4c0a.Select("cname=C or cname=I")
# Here we modify the name of a residue in 4C0A (THR => TPO in C.15)
# This residue is in the binding site and should trigger the error
mdl = ost.mol.CreateEntityFromView(trg, include_exlusive_atoms=False)
ed = mdl.EditICS()
ed.RenameResidue(mdl.FindResidue("C", 15), "TPO")
ed.UpdateXCS()
with self.assertRaises(RuntimeError):
sc = LigandScorer(mdl, trg, [mdl.FindResidue("F", 1)], [trg.FindResidue("I", 1)], check_resnames=True)
sc = LigandScorer(mdl, trg, [mdl.FindResidue("I", 1)], [trg.FindResidue("I", 1)], check_resnames=True)
sc._compute_scores()
sc = LigandScorer(mdl, trg, [mdl.FindResidue("F", 1)], [trg.FindResidue("I", 1)], check_resnames=False)
sc = LigandScorer(mdl, trg, [mdl.FindResidue("I", 1)], [trg.FindResidue("I", 1)], check_resnames=False)
sc._compute_scores()
def test__scores(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment