IMP  2.1.1
The Integrative Modeling Platform
atom/cg_pdb.py

This example shows how to properly write out a pdb of the structure results when using coarse grained rigid bodies.

1 ## \example atom/cg_pdb.py
2 # This example shows how to properly write out a pdb of the structure
3 # results when using coarse grained rigid bodies.
4 
5 import IMP.atom
6 
8 full = IMP.atom.read_pdb(IMP.atom.get_example_path("example_protein.pdb"), m)
9 chain = IMP.atom.get_by_type(full, IMP.atom.CHAIN_TYPE)[0]
10 print chain
11 # for some reason the python wrapper won't make the implicit conversion to
12 # Chain
14  IMP.atom.Chain(chain), 3)
15 IMP.atom.destroy(full)
16 rb = IMP.atom.create_rigid_body(simplified)
17 original_transform = rb.get_reference_frame().get_transformation_to()
18 
19 
20 # fake optimization, just move the rigid body
22 rb.set_reference_frame(IMP.algebra.ReferenceFrame3D(
24 
25 # extract the difference
26 diff = rb.get_reference_frame().get_transformation_to() / original_transform
27 reload = IMP.atom.read_pdb(IMP.atom.get_example_path("example_protein.pdb"), m)
28 IMP.atom.transform(reload, diff)
29 name = IMP.create_temporary_file("out", ".pdb")
30 IMP.atom.write_pdb(reload, name)