Skip to content

Commit

Permalink
Fix out-of-range fragments
Browse files Browse the repository at this point in the history
Fragments should start numbering at 1, not 0.
This is now checked by python-ihm.
  • Loading branch information
benmwebb committed Sep 6, 2024
1 parent a35a011 commit a69b366
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/test_mmcif.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)

Expand All @@ -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,
Expand All @@ -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)
Expand Down

0 comments on commit a69b366

Please sign in to comment.