IMP  2.4.0
The Integrative Modeling Platform
doc/examples/domino/merge_tree.py
1 ## \example domino/merge_tree.py
2 # The example shows how to generate and inspect a merge tree for use in Domino.
3 
4 import IMP
5 import IMP.domino
6 import IMP.core
7 import IMP.container
8 import IMP.algebra
9 
10 IMP.base.set_log_level(IMP.base.TERSE)
11 m = IMP.kernel.Model()
12 # don't print messages about evaluation
13 m.set_log_level(IMP.base.SILENT)
14 
15 bb = IMP.algebra.BoundingBox3D((0, 0, 0), (10, 10, 10))
16 allc = []
17 for i in range(0, 7):
18  p = IMP.kernel.Particle(m)
21  allc.append(d.get_coordinates())
23 ss = IMP.domino.XYZStates(allc)
24 for p in m.get_particles():
25  pst.set_particle_states(p, ss)
26 # generate a set of restraints based on the close pairs in this randomly
27 # chosen configuration
29 cp.set_distance(1)
30 cps = cp.get_close_pairs(m.get_particles())
31 
32 if len(cps) > 0:
33  # one cannot create a container from an empty list
35 else:
39 
40 # compute the interaction graph based on all the restraints
42  pst)
43 # generate a junction tree from the interaction graph
45 print(dir(jt))
46 print(type(jt))
47 # create a merge tree from the junction tree, this can be passed to
48 # IMP.domin.DominoSampler
50 s = pst.get_subset()
51 print(s, type(s))
InteractionGraph get_interaction_graph(ScoringFunctionAdaptor rs, const kernel::ParticlesTemp &pst)
Various classes to hold sets of particles.
void set_log_level(LogLevel l)
Set the current global log level.
SubsetGraph get_junction_tree(const InteractionGraph &ig)
Vector3D get_random_vector_in(const Cylinder3D &c)
Generate a random vector in a cylinder with uniform density.
Store a kernel::ParticleIndexPairs.
static XYZR setup_particle(kernel::Model *m, ParticleIndex pi)
Definition: XYZR.h:48
Class to handle individual model particles.
Find all nearby pairs by testing all pairs.
Basic functionality that is expected to be used by a wide variety of IMP users.
General purpose algebraic and geometric methods that are expected to be used by a wide variety of IMP...
MergeTree get_merge_tree(const SubsetGraph &junction_tree)
Applies a PairScore to each Pair in a list.
Divide-and-conquer inferential optimization in discrete space.
Class for storing model, its restraints, constraints, and particles.
Definition: kernel/Model.h:73