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.
   14     sys.argv, 
"Experiments with trying to visualize an ensemble of structures")
 
   23 def read(m, beyond_file):
 
   26     for i 
in range(0, beyond_file):
 
   29             "ensemble/aligned-" + str(i) + 
".pdb")
 
   33         for c 
in IMP.atom.get_by_type(h, IMP.atom.CHAIN_TYPE):
 
   42 def add_markers(h, c, w):
 
   43     """Add markers to a the passed conformation. The marker locations are chosen 
   44     pretty thoughtlessly and don't really illustrate the technique well.""" 
   45     def add_marker(s, name):
 
   62     return nm[nm.find(
'-') + 1:nm.rfind(
'.')]
 
   65 def add_axis(h, c, w, chain_colors):
 
   66     """Add a coordinate axis to show the relative orientation of the protein""" 
   67     for hc 
in IMP.atom.get_by_type(h, IMP.atom.CHAIN_TYPE):
 
   70         g.set_name(get_nice_name(h) + 
"_orient")
 
   78 def add_skeleton(h, c, r, w, chain_colors):
 
   79     """Show the connectivity skeleton of the conformation to give an idea of 
   80     how things are laid out""" 
   81     for hc0 
in IMP.atom.get_by_type(h, IMP.atom.CHAIN_TYPE):
 
   82         for hc1 
in IMP.atom.get_by_type(h, IMP.atom.CHAIN_TYPE):
 
   85             d = ps.evaluate_index(h.get_model(),
 
   86                                   (hc0.get_particle_index(),
 
   87                                    hc1.get_particle_index()), 
None)
 
   91                 mp = .5 * (d0.get_coordinates() + d1.get_coordinates())
 
   93                     Cylinder(Segment(d0.get_coordinates(), mp), r))
 
   98                 g.set_name(get_nice_name(h) + 
"_skel")
 
  101                     Cylinder(Segment(d1.get_coordinates(), mp), r))
 
  106                 g.set_name(get_nice_name(h) + 
"_skel")
 
  120 ps.set_log_level(IMP.SILENT)
 
  123 print(
"creating rigid bodies")
 
  125 for hc 
in IMP.atom.get_by_type(hs[0], IMP.atom.CHAIN_TYPE):
 
  127     base_chains[c.get_id()] = c
 
  129 for i, h 
in enumerate(hs):
 
  130     for hc 
in IMP.atom.get_by_type(h, IMP.atom.CHAIN_TYPE):
 
  140                 hc, base_chains[c.get_id()])
 
  143 chains = IMP.atom.get_by_type(hs[0], IMP.atom.CHAIN_TYPE)
 
  146 for i, c 
in enumerate(chains):
 
  150     chain_colors[id] = color
 
  160     h, chain=
'I', residue_index=237).get_selected_particles()[0]).get_z())
 
  161 print(
"adding markers", end=
' ')
 
  162 for i, h 
in enumerate(hso):
 
  168 print(
"adding axis", end=
' ')
 
  170 for i, h 
in enumerate(hs[1:]):
 
  171     add_axis(h, 
None, w, chain_colors)
 
  176 print(
"adding skeleton", end=
' ')
 
  177 for i, h 
in enumerate(hs[1:]):
 
  178     add_skeleton(h, 
None, 1, w, chain_colors)