IMP logo
IMP Reference Guide  2.16.0
The Integrative Modeling Platform
atom/multiresolution.py

This example shows how to use the multiresolution support available in IMP.atom via the IMP.atom.Resolution decorator and IMP.atom.Selection

1 ## \example atom/multiresolution.py
2 # This example shows how to use the multiresolution support available in
3 # IMP.atom via the IMP.atom.Resolution decorator and IMP.atom.Selection
4 
5 from __future__ import print_function
6 import IMP.atom
7 import sys
8 
9 IMP.setup_from_argv(sys.argv, "multiresolution")
10 
11 # Create an IMP model and add a heavy atom-only protein from a PDB file
12 m = IMP.Model()
13 
14 root = IMP.atom.Hierarchy.setup_particle(m, m.add_particle("root"))
16  m, m.add_particle("rigid body"),
18 
19 prot = IMP.atom.read_pdb(IMP.atom.get_example_path("example_protein.pdb"), m,
21 root.add_child(prot)
22 print("adding rigid body for atoms")
23 rigid_body.add_member(IMP.atom.create_rigid_body(prot))
24 
26 
27 print("creating residue level rep")
29 print("adding rigid body for residues")
30 rigid_body.add_member(IMP.atom.create_rigid_body(residues))
31 resolutions.add_representation(residues)
32 
33 print("creating triplet residue level rep")
35 resolutions.add_representation(triplets)
36 print("adding rigid body for triplets")
37 rigid_body.add_member(IMP.atom.create_rigid_body(triplets))
38 
40 resolutions.add_representation(whole)
41 
42 print("resolutions are", resolutions)
43 
44 # note these resolutions need to be fixed
45 print("atoms")
46 print(IMP.atom.Selection(
47  root, residue_index=15, resolution=1).get_selected_particles())
48 print("residues")
49 print(IMP.atom.Selection(
50  root, residue_index=15, resolution=.3).get_selected_particles())
51 print("several residues")
52 print(IMP.atom.Selection(
53  root, residue_index=15, resolution=.2).get_selected_particles())
54 print("very coarse")
55 print(IMP.atom.Selection(
56  root, residue_index=15, resolution=.01).get_selected_particles())
57 print("all")
58 print(IMP.atom.Selection(
59  root, residue_index=15,
60  resolution=IMP.atom.ALL_RESOLUTIONS).get_selected_particles())