Skip to content

Commit

Permalink
Also combine overlapping ranges into segments
Browse files Browse the repository at this point in the history
With atomic models, subsequent atoms in the
same residue will overlap the range of the last
representation segment, not just end up contiguous
with it. Combine these into one segment.
  • Loading branch information
benmwebb committed Sep 15, 2023
1 parent 6bbfeae commit bf3f62d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion modules/mmcif/pyext/src/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def start_new_segment():
elif (type(particle) == type(self.particles[0]) # noqa: E721
and is_res == self.is_res
and is_atom == self.is_atom
and resrange[0] == self.residue_range[1] + 1
and resrange[0] <= self.residue_range[1] + 1
and starting_model == self.starting_model
and self._same_rigid_body(rigid_body)):
# Continue an existing segment
Expand Down
10 changes: 5 additions & 5 deletions modules/mmcif/test/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,11 +354,11 @@ def test_coordinate_handler_add_chain(self):
# One residue with atomic representation
residue = IMP.atom.Residue.setup_particle(IMP.Particle(m),
IMP.atom.ALA, 4)
atom = IMP.atom.Atom.setup_particle(IMP.Particle(m),
IMP.atom.AT_CA)
IMP.core.XYZR.setup_particle(
atom, IMP.algebra.Sphere3D(IMP.algebra.Vector3D(1, 2, 3), 4))
residue.add_child(atom)
for att in (IMP.atom.AT_CA, IMP.atom.AT_O):
atom = IMP.atom.Atom.setup_particle(IMP.Particle(m), att)
IMP.core.XYZR.setup_particle(
atom, IMP.algebra.Sphere3D(IMP.algebra.Vector3D(1, 2, 3), 4))
residue.add_child(atom)
top.add_child(residue)
# Two beads each spanning two residues
frag = IMP.atom.Fragment.setup_particle(IMP.Particle(m), [5, 6])
Expand Down

0 comments on commit bf3f62d

Please sign in to comment.