IMP logo
IMP Reference Guide  2.19.0
The Integrative Modeling Platform
protein_residue_binding.py
1 ## \example pmi/protein_residue_binding.py
2 """
3 This script shows how to simulate residue-protein
4 binding contacts inferred from mutagenesis studies.
5 This example shows protein A binding to protein B
6 through a set of residues predicted to be required
7 for binding in mutagensis studies.
8 """
9 
10 from __future__ import print_function
11 import IMP
12 import IMP.atom
13 import IMP.rmf
14 import IMP.pmi
15 import IMP.pmi.topology
16 import IMP.pmi.dof
17 import IMP.pmi.macros
18 import IMP.pmi.restraints
21 import tempfile
22 import os
23 import sys
24 
25 IMP.setup_from_argv(sys.argv, "Simulate residue-protein binding contacts")
27  print("This example is too slow to test in debug mode - run without")
28  print("internal tests enabled, or without the --run-quick-test flag")
29  sys.exit(0)
30 
31 topology = '''
32 |molecule_name|color|fasta_fn|fasta_id|pdb_fn|chain|residue_range|pdb_offset|bead_size|em_residues_per_gaussian|rigid_body|super_rigid_body|chain_of_super_rigid_bodies|
33 |Rpb4 |red |1WCM.fasta |1WCM:D |1WCM_fitted.pdb |D|1,END |0 |5|0 |1 | | ||
34 |Rpb7 |gold |1WCM.fasta |1WCM:G |1WCM_fitted.pdb |G|1,END |0 |5|0 |2 | | ||
35 '''
36 
37 # Normally the topology table is kept in a text file but here we just write
38 # it to a temporary one
39 tf = tempfile.NamedTemporaryFile(delete=False, mode='w')
40 tf.write(topology)
41 tf.close()
42 
43 print(IMP.pmi.get_example_path('data/'))
44 
45 # The TopologyReader reads the text file, and the BuildSystem macro
46 # constructs it
47 mdl = IMP.Model()
49  tf.name, pdb_dir=IMP.pmi.get_example_path('data/'),
50  fasta_dir=IMP.pmi.get_example_path('data/'),
51  gmm_dir=IMP.pmi.get_example_path('data/'))
53 # note you can call this multiple times to create a multi-state system
54 bs.add_state(reader)
55 hier, dof = bs.execute_macro()
56 
57 # ################ STEREOCHEMISTRY RESTRAINTS ################
58 
59 output_objects = [] # keep a list of functions that need to be reported
60 
61 # Connectivity keeps things connected along the backbone (ignores if inside
62 # same rigid body)
63 crs = []
64 moldict = bs.get_molecules()[0]
65 mols = []
66 for molname in moldict:
67  for mol in moldict[molname]:
69  cr.add_to_model()
70  output_objects.append(cr)
71  crs.append(cr)
72  mols.append(mol)
73 
74 # Excluded volume - automatically more efficient due to rigid bodies
76  included_objects=mols)
77 evr.add_to_model()
78 output_objects.append(evr)
79 
80 # External barrier- Avoid proteins to drift away
81 eb = IMP.pmi.restraints.basic.ExternalBarrier(hierarchies=hier, radius=500)
82 eb.add_to_model()
83 
84 # ################# PROTEIN-RESIDUE PROXIMITY ################
85 
87  hier, selection=('Rpb7', 38, 44, 'Rpb4'), label='B38_44')
88 
89 br.add_to_model()
90 br.set_weight(5.0)
91 output_objects.append(br)
92 br.get_output()
93 
94 # ##################### SAMPLING #######################
95 
96 # Fix rigid-body
97 
98 part_p1 = IMP.atom.Selection(hier,
99  molecule="Rpb4").get_selected_particles()
100 
101 xyzs, rbs = dof.disable_movers(part_p1,
102  mover_types=[IMP.core.RigidBodyMover])
103 
104 
105 # mix it up so it looks cool
107 
108 # Quickly move all flexible beads into place
109 dof.optimize_flexible_beads(100)
110 
112  mdl,
113  root_hier=hier,
114  monte_carlo_sample_objects=dof.get_movers(),
115  global_output_directory='output/',
116  output_objects=output_objects,
117  monte_carlo_steps=10,
118  number_of_best_scoring_models=0,
119  number_of_frames=500)
120 rex.execute_macro()
121 
122 os.remove(tf.name)
Restraints for keeping correct stereochemistry.
bool get_is_quick_test()
Definition: flags.h:183
def shuffle_configuration
Shuffle particles.
Definition: tools.py:1258
A macro to help setup and run replica exchange.
Definition: macros.py:68
Set of Python classes to create a multi-state, multi-resolution IMP hierarchy.
Strings setup_from_argv(const Strings &argv, std::string description, std::string positional_description, int num_positional)
Some miscellaneous simple restraints.
Modify the transformation of a rigid body.
std::string get_example_path(std::string file_name)
Return the full path to one of this module's example files.
A macro to build a IMP::pmi::topology::System based on a TopologyReader object.
Definition: macros.py:583
Protocols for sampling structures and analyzing them.
Definition: macros.py:1
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:86
Restrain residue/residues to bind to unknown location in a target.
Classes to handle different kinds of restraints.
Keeps all structures inside a sphere.
Create a restraint between consecutive TempResidue objects or an entire PMI Molecule object...
Create movers and set up constraints for PMI objects.
A class to create an excluded volume restraint for a set of particles at a given resolution.
Automatically setup Sytem and Degrees of Freedom with a formatted text file.
Python classes to represent, score, sample and analyze models.
Functionality for loading, creating, manipulating and scoring atomic structures.
Select hierarchy particles identified by the biological name.
Definition: Selection.h:70
Support for the RMF file format for storing hierarchical molecular data and markup.