Skip to content
Snippets Groups Projects
Commit 51e7e0ff authored by Gerardo Tauriello's avatar Gerardo Tauriello
Browse files

SCHWED-954: Fixed ring-punch fixing when neighboring residues are punched.

parent ce6dc900
Branches
Tags
No related merge requests found
...@@ -427,7 +427,9 @@ def MergeGapsByDistance(mhandle, distance): ...@@ -427,7 +427,9 @@ def MergeGapsByDistance(mhandle, distance):
# get the distance between the gaps # get the distance between the gaps
dist = next_gap.before.GetNumber().GetNum() \ dist = next_gap.before.GetNumber().GetNum() \
- current_gap.after.GetNumber().GetNum() - current_gap.after.GetNumber().GetNum()
if dist < 0: # NOTE: -1 can currently only happen when fixing ring punches
# in _pipeline.BuildSidechains
if dist < -1:
ost.LogInfo("Non-sequential gaps found. Ignoring.") ost.LogInfo("Non-sequential gaps found. Ignoring.")
continue continue
if dist <= distance: if dist <= distance:
......
...@@ -58,6 +58,8 @@ def BuildSidechains(mhandle, merge_distance=4, scorer=None, fragment_db=None, ...@@ -58,6 +58,8 @@ def BuildSidechains(mhandle, merge_distance=4, scorer=None, fragment_db=None,
# backup old gaps # backup old gaps
old_gaps = [g.Copy() for g in mhandle.gaps] old_gaps = [g.Copy() for g in mhandle.gaps]
# new gaps for mhandle # new gaps for mhandle
# NOTE: we currently do not delete the punched residues here
# BUT they could be deleted when merging gaps below...
mhandle.gaps = StructuralGapList() mhandle.gaps = StructuralGapList()
for res in ring_punches: for res in ring_punches:
mygap = StructuralGap(res.prev, res.next, res.one_letter_code) mygap = StructuralGap(res.prev, res.next, res.one_letter_code)
......
...@@ -33,6 +33,7 @@ set(MODELLING_TEST_DATA ...@@ -33,6 +33,7 @@ set(MODELLING_TEST_DATA
data/gly.pdb data/gly.pdb
data/hetero-punched.pdb data/hetero-punched.pdb
data/ins.fasta data/ins.fasta
data/neighbor-punched.pdb
data/sep.fasta data/sep.fasta
data/sep.pdb data/sep.pdb
data/seq.fasta data/seq.fasta
......
This diff is collapsed.
...@@ -249,6 +249,17 @@ class PipelineTests(unittest.TestCase): ...@@ -249,6 +249,17 @@ class PipelineTests(unittest.TestCase):
torsion_sampler=self.torsion_sampler) torsion_sampler=self.torsion_sampler)
rings = modelling.GetRings(mhandle.model) rings = modelling.GetRings(mhandle.model)
self.assertFalse(modelling.HasRingPunches(rings, mhandle.model)) self.assertFalse(modelling.HasRingPunches(rings, mhandle.model))
# ring punches in neighboring entries
mhandle = self.getMockModel(io.LoadPDB('data/neighbor-punched.pdb'))
rings = modelling.GetRings(mhandle.model)
ring_punches = modelling.GetRingPunches(rings, mhandle.model)
self.assertEqual(len(ring_punches), 2)
self.assertTrue(ring_punches[0].next == ring_punches[1])
modelling.BuildSidechains(mhandle, fragment_db=self.frag_db,
structure_db=self.structure_db,
torsion_sampler=self.torsion_sampler)
rings = modelling.GetRings(mhandle.model)
self.assertFalse(modelling.HasRingPunches(rings, mhandle.model))
def testMinimizeModelEnergy(self): def testMinimizeModelEnergy(self):
'''Check energy minimization.''' '''Check energy minimization.'''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment