IMP
2.0.0
The Integrative Modeling Platform
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
cg_pdb.py
1
## \example atom/cg_pdb.py
2
## This example shows how to properly write out a pdb of the structure results when using coarse grained rigid bodies.
3
4
import
IMP.atom
5
6
m=
IMP.Model
()
7
full=
IMP.atom.read_pdb
(
IMP.atom.get_example_path
(
"example_protein.pdb"
), m)
8
chain=
IMP.atom.get_by_type
(full, IMP.atom.CHAIN_TYPE)[0]
9
print
chain
10
# for some reason the python wrapper won't make the implicit conversion to Chain
11
simplified=
IMP.atom.create_simplified_along_backbone
(
IMP.atom.Chain
(chain), 3)
12
IMP.atom.destroy
(full)
13
rb=
IMP.atom.create_rigid_body
(simplified)
14
original_transform= rb.get_reference_frame().get_transformation_to()
15
16
17
# fake optimization, just move the rigid body
18
tr=
IMP.algebra.get_random_rotation_3d
()
19
rb.set_reference_frame(
IMP.algebra.ReferenceFrame3D
(
IMP.algebra.Transformation3D
(tr,
IMP.algebra.Vector3D
(0,0,0))))
20
21
# extract the difference
22
diff= rb.get_reference_frame().get_transformation_to()/original_transform
23
reload=
IMP.atom.read_pdb
(
IMP.atom.get_example_path
(
"example_protein.pdb"
), m)
24
IMP.atom.transform
(reload, diff)
25
name=IMP.create_temporary_file(
"out"
,
".pdb"
)
26
IMP.atom.write_pdb
(reload, name)