The script shows a couple experiments with trying to visualize an ensemble of structures. The ensemble is fairly tight on the assembly scale, but there is significant variation between the location and orientation of the individual proteins (which were modeled as rigid bodies). To save space, the models have had their sidechain atoms removed.
9 from __future__
import print_function
15 "Experiments with trying to visualize an ensemble of structures")
24 def read(m, beyond_file):
27 for i
in range(0, beyond_file):
30 "ensemble/aligned-" + str(i) +
".pdb")
34 for c
in IMP.atom.get_by_type(h, IMP.atom.CHAIN_TYPE):
45 def add_markers(h, c, w):
46 """Add markers to a the passed conformation. The marker locations are chosen
47 pretty thoughtlessly and don't really illustrate the technique well."""
48 def add_marker(s, name):
65 return nm[nm.find(
'-') + 1:nm.rfind(
'.')]
68 def add_axis(h, c, w, chain_colors):
69 """Add a coordinate axis to show the relative orientation of the protein"""
70 for hc
in IMP.atom.get_by_type(h, IMP.atom.CHAIN_TYPE):
73 g.set_name(get_nice_name(h) +
"_orient")
81 def add_skeleton(h, c, r, w, chain_colors):
82 """Show the connectivity skeleton of the conformation to give an idea of
83 how things are laid out"""
84 for hc0
in IMP.atom.get_by_type(h, IMP.atom.CHAIN_TYPE):
85 for hc1
in IMP.atom.get_by_type(h, IMP.atom.CHAIN_TYPE):
88 d = ps.evaluate_index(h.get_model(),
89 (hc0.get_particle_index(),
90 hc1.get_particle_index()),
None)
94 mp = .5 * (d0.get_coordinates() + d1.get_coordinates())
96 Cylinder(Segment(d0.get_coordinates(), mp), r))
101 g.set_name(get_nice_name(h) +
"_skel")
104 Cylinder(Segment(d1.get_coordinates(), mp), r))
109 g.set_name(get_nice_name(h) +
"_skel")
122 ps.set_log_level(IMP.SILENT)
125 print(
"creating rigid bodies")
127 for hc
in IMP.atom.get_by_type(hs[0], IMP.atom.CHAIN_TYPE):
129 base_chains[c.get_id()] = c
131 for i, h
in enumerate(hs):
132 for hc
in IMP.atom.get_by_type(h, IMP.atom.CHAIN_TYPE):
142 hc, base_chains[c.get_id()])
145 chains = IMP.atom.get_by_type(hs[0], IMP.atom.CHAIN_TYPE)
148 for i, c
in enumerate(chains):
153 chain_colors[id] = color
163 residue_index=237).get_selected_particles()[0]).get_z())
164 print(
"adding markers", end=
' ')
165 for i, h
in enumerate(hso):
171 print(
"adding axis", end=
' ')
173 for i, h
in enumerate(hs[1:]):
174 add_axis(h,
None, w, chain_colors)
179 print(
"adding skeleton", end=
' ')
180 for i, h
in enumerate(hs[1:]):
181 add_skeleton(h,
None, 1, w, chain_colors)