IMP logo
IMP Reference Guide  develop.63b38c487d,2024/12/21
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 import IMP.atom
6 import sys
7 
8 IMP.setup_from_argv(sys.argv, "multiresolution")
9 
10 # Create an IMP model and add a heavy atom-only protein from a PDB file
11 m = IMP.Model()
12 
13 root = IMP.atom.Hierarchy.setup_particle(m, m.add_particle("root"))
15  m, m.add_particle("rigid body"),
17 
18 prot = IMP.atom.read_pdb(IMP.atom.get_example_path("example_protein.pdb"), m,
20 root.add_child(prot)
21 print("adding rigid body for atoms")
22 rigid_body.add_member(IMP.atom.create_rigid_body(prot))
23 
25 
26 print("creating residue level rep")
28 print("adding rigid body for residues")
29 rigid_body.add_member(IMP.atom.create_rigid_body(residues))
30 resolutions.add_representation(residues)
31 
32 print("creating triplet residue level rep")
34 resolutions.add_representation(triplets)
35 print("adding rigid body for triplets")
36 rigid_body.add_member(IMP.atom.create_rigid_body(triplets))
37 
39 resolutions.add_representation(whole)
40 
41 print("resolutions are", resolutions)
42 
43 # note these resolutions need to be fixed
44 print("atoms")
45 print(IMP.atom.Selection(
46  root, residue_index=15, resolution=1).get_selected_particles())
47 print("residues")
48 print(IMP.atom.Selection(
49  root, residue_index=15, resolution=.3).get_selected_particles())
50 print("several residues")
51 print(IMP.atom.Selection(
52  root, residue_index=15, resolution=.2).get_selected_particles())
53 print("very coarse")
54 print(IMP.atom.Selection(
55  root, residue_index=15, resolution=.01).get_selected_particles())
56 print("all")
57 print(IMP.atom.Selection(
58  root, residue_index=15,
59  resolution=IMP.atom.ALL_RESOLUTIONS).get_selected_particles())