From a69b366eb3f6eb6dc2586cf5cd3d622a2335d356 Mon Sep 17 00:00:00 2001 From: Ben Webb Date: Fri, 6 Sep 2024 11:00:58 -0700 Subject: [PATCH] Fix out-of-range fragments Fragments should start numbering at 1, not 0. This is now checked by python-ihm. --- test/test_mmcif.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/test_mmcif.py b/test/test_mmcif.py index 38e5d2b3..5695909b 100644 --- a/test/test_mmcif.py +++ b/test/test_mmcif.py @@ -1916,10 +1916,10 @@ def get_seq_dif(self): def test_beads_fragment(self): """Test _BeadsFragment class""" system = ihm.System() - e = ihm.Entity('A' * 40) + e = ihm.Entity('A' * 50) asym = ihm.AsymUnit(e) m = None - bf1 = IMP.pmi1.mmcif._BeadsFragment(m, 'comp1', start=0, + bf1 = IMP.pmi1.mmcif._BeadsFragment(m, 'comp1', start=1, end=10, count=2, hier=None, asym_unit=asym) bf2 = IMP.pmi1.mmcif._BeadsFragment(m, 'comp1', start=11, @@ -1931,11 +1931,11 @@ def test_beads_fragment(self): self.assertFalse(bf1.combine(None)) self.assertFalse(bf1.combine(bf3)) self.assertTrue(bf1.combine(bf2)) - self.assertEqual(bf1.asym_unit.seq_id_range[0], 0) + self.assertEqual(bf1.asym_unit.seq_id_range[0], 1) self.assertEqual(bf1.asym_unit.seq_id_range[1], 30) self.assertEqual(bf1.count, 5) self.assertTrue(bf1.combine(bf3)) - self.assertEqual(bf1.asym_unit.seq_id_range[0], 0) + self.assertEqual(bf1.asym_unit.seq_id_range[0], 1) self.assertEqual(bf1.asym_unit.seq_id_range[1], 50) self.assertEqual(bf1.count, 9) @@ -1949,14 +1949,14 @@ def test_model_repr_dump_add_frag(self): state2 = 'state2' rep1 = ihm.representation.Representation() d = IMP.pmi1.mmcif._AllModelRepresentations(EmptyObject()) - b = IMP.pmi1.mmcif._BeadsFragment(m, 'comp1', start=0, + b = IMP.pmi1.mmcif._BeadsFragment(m, 'comp1', start=1, end=10, count=2, hier=None, asym_unit=asym) d.add_fragment(state1, rep1, b) self.assertEqual(len(d.fragments[id(rep1)]['comp1']), 1) self.assertEqual(len(d.fragments[id(rep1)]['comp1'][state1]), 1) frag = d.fragments[id(rep1)]['comp1'][state1][0] - self.assertEqual(frag.asym_unit.seq_id_range[0], 0) + self.assertEqual(frag.asym_unit.seq_id_range[0], 1) self.assertEqual(frag.asym_unit.seq_id_range[1], 10) b = IMP.pmi1.mmcif._BeadsFragment(m, 'comp1', start=11, @@ -1966,7 +1966,7 @@ def test_model_repr_dump_add_frag(self): self.assertEqual(len(d.fragments[id(rep1)]['comp1']), 1) self.assertEqual(len(d.fragments[id(rep1)]['comp1'][state1]), 1) frag = d.fragments[id(rep1)]['comp1'][state1][0] - self.assertEqual(frag.asym_unit.seq_id_range[0], 0) + self.assertEqual(frag.asym_unit.seq_id_range[0], 1) self.assertEqual(frag.asym_unit.seq_id_range[1], 30) d.add_fragment(state2, rep1, b)