salilab / imp

The Integrative Modeling Platform
https://integrativemodeling.org
GNU General Public License v3.0
73 stars 30 forks source link

PMI shuffle with bounding box setup not working with Gaussian-decorated beads #1048

Closed Stochastic13 closed 3 years ago

Stochastic13 commented 3 years ago

Platform: Windows, Linux Version: 2.14 and the latest IMP-develop branch

Description: The bounding_box option in the pmi.tools.shuffle_configuration does not work when gaussians are setup on the flexible beads (em_residues_per_gaussian is non-zero in a topology file). This is due to not decorating the flexible beads as a RigidBody before feeding it to the IMP.core.transform which requires input particles which are setup as RigidBody to be decorated as such.

Reproduce the issue: Use a minimal topology file below -> build the system (BuildSystem macro in pmi) -> call pmi.tools.shuffle_configuration on the root_hierarchy with bounding_box set to some arbitrary value to get the below error. Topology file:

|topology_dictionary|
|molecule_name | color | fasta_fn | fasta_id | pdb_fn | chain | residue_range | pdb_offset | bead_size | em_residues_per_gaussian | rigid_body | super_rigid_body | chain_of_super_rigid_bodies |
|abc.0 |gray  |abc.fasta|abc|BEADS   |A|1,END   |0|10|10|0|1||

Output:

Traceback (most recent call last):
  File "test_bug.py", line 27, in <module>
    IMP.pmi.tools.shuffle_configuration(root_hierarchy, bounding_box=((15, 130, 15), (255, 220, 255)))
  File "C:\Program Files\IMP-2.13.0\python\IMP\pmi\tools.py", line 1446, in shuffle_configuration
    IMP.core.transform(d, -d.get_coordinates())
  File "C:\Program Files\IMP-2.13.0\python\IMP\core\__init__.py", line 7714, in transform
    return _IMP_core.transform(*args)
_IMP_kernel.UsageException: Usage check failure: Particle is also a RigidBody, so this function would do the wrong thing; decorate your Particle as a
 RigidBody instead and call transform(RigidBody a, const algebra::Transformation3D &tr)

Attached are the files required to reproduce the bug (abc.fasta, topology.txt, test_bug.py) files.zip

Opening a PR attempting to fix this by adding the required extra line in pmi/pyext/src/tools.py.

Thanks

benmwebb commented 3 years ago

Fixed by salilab/pmi#253.