The script shows a couple experiments with trying to visualize an ensembe 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
20 def read(m, beyond_file):
23 for i
in range(0, beyond_file):
26 "ensemble/aligned-" + str(i) +
".pdb")
41 def add_markers(h, c, w):
42 """Add markers to a the passed conformation. The marker locations are chosen
43 pretty thoughtlessly and don't really illustrate the technique well."""
44 def add_marker(s, name):
61 return nm[nm.find(
'-') + 1:nm.rfind(
'.')]
64 def add_axis(h, c, w, chain_colors):
65 """Add a coordinate axis to show the relative orientation of the protein"""
69 g.set_name(get_nice_name(h) +
"_orient")
77 def add_skeleton(h, c, r, w, chain_colors):
78 """Show the connectivity skeleton of the conformation to give an idea of
79 how things are layed out"""
84 d = ps.evaluate((hc0, hc1),
None)
88 mp = .5 * (d0.get_coordinates() + d1.get_coordinates())
90 Cylinder(Segment(d0.get_coordinates(), mp), r))
95 g.set_name(get_nice_name(h) +
"_skel")
98 Cylinder(Segment(d1.get_coordinates(), mp), r))
103 g.set_name(get_nice_name(h) +
"_skel")
116 ps.set_log_level(IMP.base.SILENT)
119 print(
"creating rigid bodies")
123 base_chains[c.get_id()] = c
125 for i, h
in enumerate(hs):
136 hc, base_chains[c.get_id()])
142 for i, c
in enumerate(chains):
147 chain_colors[id] = color
157 residue_index=237).get_selected_particles()[0]).get_z())
158 print(
"adding markers", end=
' ')
159 for i, h
in enumerate(hso):
165 print(
"adding axis", end=
' ')
167 for i, h
in enumerate(hs[1:]):
168 add_axis(h,
None, w, chain_colors)
173 print(
"adding skeleton", end=
' ')
174 for i, h
in enumerate(hs[1:]):
175 add_skeleton(h,
None, 1, w, chain_colors)