9 from __future__
import print_function
15 sys.argv,
"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):
43 def add_markers(h, c, w):
44 """Add markers to a the passed conformation. The marker locations are chosen
45 pretty thoughtlessly and don't really illustrate the technique well."""
46 def add_marker(s, name):
63 return nm[nm.find(
'-') + 1:nm.rfind(
'.')]
66 def add_axis(h, c, w, chain_colors):
67 """Add a coordinate axis to show the relative orientation of the protein"""
68 for hc
in IMP.atom.get_by_type(h, IMP.atom.CHAIN_TYPE):
71 g.set_name(get_nice_name(h) +
"_orient")
79 def add_skeleton(h, c, r, w, chain_colors):
80 """Show the connectivity skeleton of the conformation to give an idea of
81 how things are laid out"""
82 for hc0
in IMP.atom.get_by_type(h, IMP.atom.CHAIN_TYPE):
83 for hc1
in IMP.atom.get_by_type(h, IMP.atom.CHAIN_TYPE):
86 d = ps.evaluate_index(h.get_model(),
87 (hc0.get_particle_index(),
88 hc1.get_particle_index()),
None)
92 mp = .5 * (d0.get_coordinates() + d1.get_coordinates())
94 Cylinder(Segment(d0.get_coordinates(), mp), r))
99 g.set_name(get_nice_name(h) +
"_skel")
102 Cylinder(Segment(d1.get_coordinates(), mp), r))
107 g.set_name(get_nice_name(h) +
"_skel")
121 ps.set_log_level(IMP.SILENT)
124 print(
"creating rigid bodies")
126 for hc
in IMP.atom.get_by_type(hs[0], IMP.atom.CHAIN_TYPE):
128 base_chains[c.get_id()] = c
130 for i, h
in enumerate(hs):
131 for hc
in IMP.atom.get_by_type(h, IMP.atom.CHAIN_TYPE):
141 hc, base_chains[c.get_id()])
144 chains = IMP.atom.get_by_type(hs[0], IMP.atom.CHAIN_TYPE)
147 for i, c
in enumerate(chains):
151 chain_colors[id] = color
161 h, chain=
'I', residue_index=237).get_selected_particles()[0]).get_z())
162 print(
"adding markers", end=
' ')
163 for i, h
in enumerate(hso):
169 print(
"adding axis", end=
' ')
171 for i, h
in enumerate(hs[1:]):
172 add_axis(h,
None, w, chain_colors)
177 print(
"adding skeleton", end=
' ')
178 for i, h
in enumerate(hs[1:]):
179 add_skeleton(h,
None, 1, w, chain_colors)
Apply a score to a fixed number of close pairs from the two sets.
Return the hierarchy leaves under a particle.
Strings setup_from_argv(const Strings &argv, std::string description, std::string positional_description, int num_positional)
Upper bound harmonic function (non-zero when feature > mean)
IMP::core::RigidBody create_compatible_rigid_body(Hierarchy h, Hierarchy reference)
Rigidify a molecule or collection of molecules.
Represent a cylinder in 3D.
A score on the distance between the surfaces of two spheres.
Color get_interpolated_rgb(const Color &a, const Color &b, double f)
Return a color interpolated between a and b in RGB space.
void read_pdb(TextInput input, int model, Hierarchy h)
Class for storing model, its restraints, constraints, and particles.
Display a reference frame.
static Hierarchy setup_particle(Model *m, ParticleIndex pi, ParticleIndexesAdaptor children=ParticleIndexesAdaptor())
Create a Hierarchy of level t by adding the needed attributes.
std::string get_example_path(std::string file_name)
Return the full path to one of this module's example files.
Color get_display_color(unsigned int i)
A decorator for a particle with x,y,z coordinates.
static const IMP::core::HierarchyTraits & get_traits()
Get the molecular hierarchy HierarchyTraits.
void set_log_level(LogLevel l)
Set the current global log level.
Simple implementation of segments in 3D.
Hierarchy create_simplified_along_backbone(Chain input, const IntRanges &residue_segments, bool keep_detailed=false)
IMP::core::RigidBody create_rigid_body(Hierarchy h)
Class to handle individual particles of a Model object.
Write a CGO file with the geometry.
Store info for a chain of a protein.
Select all CA ATOM records.
Output IMP model data in various file formats.
Functionality for loading, creating, manipulating and scoring atomic structures.
Select hierarchy particles identified by the biological name.
void set_check_level(CheckLevel tf)
Control runtime checks in the code.
Display an IMP::core::XYZR particle as a ball.