IMP  2.3.1
The Integrative Modeling Platform
cg_pdb.py
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)
Simple 3D transformation class.
void write_pdb(const Selection &mhd, base::TextOutput out, unsigned int model=1)
Rotation3D get_random_rotation_3d(const Rotation3D &center, double distance)
Pick a rotation at random near the provided one.
std::string get_example_path(std::string file_name)
Return the path to installed example data for this module.
A reference frame in 3D.
void transform(Hierarchy h, const algebra::Transformation3D &tr)
Transform a hierarchy. This is aware of rigid bodies.
Hierarchies get_by_type(Hierarchy mhd, GetByType t)
void destroy(Hierarchy d)
Delete the Hierarchy.
Hierarchy create_simplified_along_backbone(Chain input, const IntRanges &residue_segments, bool keep_detailed=false)
VectorD< 3 > Vector3D
Definition: VectorD.h:395
IMP::core::RigidBody create_rigid_body(Hierarchy h)
Store info for a chain of a protein.
Definition: Chain.h:21
Functionality for loading, creating, manipulating and scoring atomic structures.
void read_pdb(base::TextInput input, int model, Hierarchy h)
Class for storing model, its restraints, constraints, and particles.
Definition: kernel/Model.h:73