Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SnugDock.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available
6 // (c) under license. The Rosetta software is developed by the contributing
7 // (c) members of the Rosetta Commons. For more information, see
8 // (c) http://www.rosettacommons.org. Questions about this can be addressed to
9 // (c) University of Washington UW TechTransfer,email:license@u.washington.edu.
10 
11 /// @file protocols/antibody2/SnugDock.cc
12 /// @brief Dock and antigen to an antibody while optimizing the rigid body orientation of the VH and VL chains and performing CDR loop minimization.
13 /// @detailed
14 ///
15 ///
16 /// @author Jianqing Xu ( xubest@gmail.com )
17 /// @author Brian D. Weitzner ( brian.weitzner@gmail.com )
18 
19 // Unit headers
21 
22 // Package headers
26 
27 // Project headers
37 
39 #include <core/pose/Pose.hh>
41 #include <core/types.hh>
42 
43 // basic
44 #include <basic/options/option.hh>
45 #include <basic/options/keys/run.OptionKeys.gen.hh>
46 #include <basic/options/keys/antibody.OptionKeys.gen.hh>
47 #include <basic/Tracer.hh>
48 
49 
50 static basic::Tracer TR("protocols.antibody2.SnugDock");
51 using namespace core;
52 
53 namespace protocols {
54 namespace antibody2 {
55 
56 ///////////////////////////////////////////////////////////////////////////////////////////////////////
57 ////////////////////////////////////////////// BOILER PLATE CODE //////////////////////////////////////
58 ///////////////////////////////////////////////////////////////////////////////////////////////////////
59 
60 ///@brief default constructor
61 SnugDock::SnugDock() : docking::DockingHighRes()
62 {
63  init();
64 }
65 
66 ///@brief copy constructor
67 SnugDock::SnugDock( SnugDock const & rhs ) : docking::DockingHighRes(rhs)
68 {
70 }
71 
72 ///@brief assignment operator
74  //abort self-assignment
75  if ( this == &rhs ) return *this;
76  Mover::operator=( rhs );
78  return *this;
79 }
80 
81 //destructor
83 
84 /// @brief Each derived class must specify its name.
86 {
87  return type();
88 }
89 
90 //@brief clone operator, calls the copy constructor
93 {
94  return new SnugDock( *this );
95 }
96 
97 ///@brief fresh_instance returns a default-constructed object for JD2
100 {
101  return new SnugDock();
102 }
103 
104 ///@brief This mover retains state such that a fresh version is needed if the input Pose is about to change
106 {
107  return true;
108 }
109 
111 {
117 }
118 ///////////////////////////////////////////////////////////////////////////////////////////////////////
119 /////////////////////////////////////// END OF BOILER PLATE CODE //////////////////////////////////////
120 ///////////////////////////////////////////////////////////////////////////////////////////////////////
121 
122 void SnugDock::apply( Pose & pose )
123 {
124  TR << "Beginning apply function of " + get_name() + "." << std::endl;
125  show( TR );
126 
127  if ( ! high_resolution_step_ ) setup_objects( pose );
128 
129  /// minimize the CDRs before move to full-atom SnugDock cycle. Remove clashes which may dissociate L-H
130  pre_minimization_->apply(pose);
131 
132  TR << "Reinitializing the shared MC object before applying the high resolution phase of " + get_name() + "."
133  << std::endl;
134 
135  ( * scorefxn() )( pose );
136  mc_->reset( pose );
137 
138  for ( core::Size i = 0; i < number_of_high_resolution_cycles_; ++i )
139  {
140  high_resolution_step_->apply( pose );
141  }
142 
143  TR << "Setting the structure to the state with the best score observed during the simulation" << std::endl;
144  mc_->recover_low( pose );
145 
146  /// Set the pose's foldtree to Ab-Ag docking (LH_A) to ensure the correct interface.
147  pose.fold_tree(antibody_info_->get_FoldTree_LH_A(pose));
148 }
149 
151 {
153 }
154 
155 void SnugDock::number_of_high_resolution_cycles( Size const number_of_high_resolution_cycles )
156 {
158 }
159 
161 {
162  antibody_info_ = antibody_info;
163 }
164 
165 void SnugDock::setup_objects( Pose const & pose )
166 {
168  using docking::DockMCMCycle;
172  using moves::MonteCarloOP;
173  using moves::RandomMover;
174  using moves::RandomMoverOP;
175  using moves::SequenceMover;
177  using moves::TrialMover;
178  using moves::TrialMoverOP;
179 
180  TR << "Setting up data for " + get_name() + "." << std::endl;
181 
182  /// AntibodyInfo is used to store information about the Ab-Ag complex and to generate useful helper objects based on
183  /// that information (e.g. the various FoldTrees that are needed for SnugDock).
184  if ( ! antibody_info_ ) antibody_info_ = new AntibodyInfo( pose );
185 
186  ///
188 
189 
190  /// A vanilla DockMCMCycle can be used because AntibodyInfo will always make the first jump in the FoldTree dockable.
191  DockMCMCycleOP standard_dock_cycle = new DockMCMCycle;
192 
193  /// Set a default docking task factory to the DockMCMCycle.
194  /// The DockingHighRes base class provides a mechanism to do this.
195  tf2()->create_and_attach_task_factory( this, pose );
196  standard_dock_cycle->set_task_factory( task_factory() );
197 
198  /// This MonteCarlo instance uses 'standard' with the docking patch and a temperature factor of 0.8.
199  /// All movers in the high resolution step will share this MonteCarlo instance to provide consistent results.
200  mc_ = standard_dock_cycle->get_mc();
201 
202  ChangeFoldTreeMoverOP set_foldtree_for_ab_ag_docking = new ChangeFoldTreeMover(
203  antibody_info_->get_FoldTree_LH_A( pose )
204  );
205  ChangeFoldTreeMoverOP set_foldtree_for_vH_vL_docking = new ChangeFoldTreeMover(
206  antibody_info_->get_FoldTree_L_HA( pose )
207  );
208 
209  SequenceMoverOP antibody_antigen_dock_cycle = new SequenceMover(
210  set_foldtree_for_ab_ag_docking,
211  standard_dock_cycle
212  );
213 
214  SequenceMoverOP vH_vL_dock_cycle = new SequenceMover(
215  set_foldtree_for_vH_vL_docking,
216  standard_dock_cycle
217  );
218 
219  /// TODO: Does CDRsMinPackMin need a TaskFactory to be set? Does it get this from AntibodyInfo?
220  CDRsMinPackMinOP minimize_all_cdr_loops_base = new CDRsMinPackMin( antibody_info_ );
221  TrialMoverOP minimize_all_cdr_loops = new TrialMover( minimize_all_cdr_loops_base, mc_ );
222 
223  /// FIXME: The chain break weight configuration and constraint weight should be handled by RefineOneCDRLoop.
224  ScoreFunctionOP high_res_loop_refinement_scorefxn = scorefxn_pack()->clone();
225  high_res_loop_refinement_scorefxn->set_weight( scoring::chainbreak, 1.0 );
226  high_res_loop_refinement_scorefxn->set_weight( scoring::overlap_chainbreak, 10./3. );
227  high_res_loop_refinement_scorefxn->set_weight( scoring::atom_pair_constraint, 100 );
228 
229  RefineOneCDRLoopOP refine_cdr_h2_base = new RefineOneCDRLoop( antibody_info_, h2, loop_refinement_method_, high_res_loop_refinement_scorefxn );
230  TrialMoverOP refine_cdr_h2 = new TrialMover( refine_cdr_h2_base, mc_ );
231 
232  RefineOneCDRLoopOP refine_cdr_h3_base = new RefineOneCDRLoop( antibody_info_, h3, loop_refinement_method_, high_res_loop_refinement_scorefxn );
233  TrialMoverOP refine_cdr_h3 = new TrialMover( refine_cdr_h3_base, mc_ );
234 
235 
236  /// This is a very succinct description of what this mover does. For a description in words, see the implementation
237  /// of the streaming operator.
238  high_resolution_step_ = new RandomMover;
239  high_resolution_step_->add_mover( antibody_antigen_dock_cycle, 0.4 );
240  high_resolution_step_->add_mover( vH_vL_dock_cycle, 0.4 );
241  high_resolution_step_->add_mover( minimize_all_cdr_loops, 0.1 );
242  high_resolution_step_->add_mover( refine_cdr_h2, 0.05 );
243  high_resolution_step_->add_mover( refine_cdr_h3, 0.05 );
244 }
245 
247 {
248  type( "SnugDock" );
249 
250  /// TODO: Allow the refinement method to be set via a mutator and from the options system
251  using basic::options::option;
252  using namespace basic::options::OptionKeys;
253  if ( option[ basic::options::OptionKeys::antibody::refine ].user() ) {
254  loop_refinement_method_ = option[ basic::options::OptionKeys::antibody::refine ]() ;
255  }
256  else{
257  loop_refinement_method_ = "refine_kic";
258  }
259 
260 
262 
263  init_options();
264 }
265 
267 {
268  // copy all data members from rhs to lhs
269  lhs.antibody_info_ = rhs.antibody_info_;
270  lhs.mc_ = rhs.mc_;
271 
272  // Movers
275 
277 }
278 
280 {
281  using basic::options::option;
282  using namespace basic::options::OptionKeys;
283 
284  if ( option[ run::test_cycles ].user() )
285  {
286  /// Ideally we would test a larger number of cycles because we are using a random mover in the apply,
287  /// but because each submove can be quite long, this would take far too long.
288  /// TODO: Create a scientific test for SnugDock that is run regularly.
290  }
291 }
292 
293 void
294 SnugDock::show( std::ostream & out )
295 {
296  out << *this;
297 }
298 
299 std::ostream & operator<<(std::ostream& out, SnugDock const & )
300 {
301  out << "//////////////////////////////////////////////////////////////////////////////////////////////" << std::endl;
302  out << "/// The following description borrows heavily from Fig. 1 of:" << std::endl;
303  out << "/// Sircar A, Gray JJ (2010) SnugDock: Paratope Structural Optimization during" << std::endl;
304  out << "/// Antibody-Antigen Docking Compensates for Errors in Antibody Homology Models." << std::endl;
305  out << "/// PLoS Comput Biol 6(1): e1000644. doi:10.1371/journal.pcbi.1000644" << std::endl;
306  out << "//////////////////////////////////////////////////////////////////////////////////////////////" << std::endl;
307  out << "//////////////////////////////////////////////////////////////////////////////////////////////" << std::endl;
308  out << "///" << std::endl;
309  out << "/// Each iteration of this loop will perform one of five different perturbations followed by" << std::endl;
310  out << "/// packing and minimization of the relevant regions of the pose and then with a Monte Carlo" << std::endl;
311  out << "/// test of the Boltzmann criterion in the indicated frequencies:" << std::endl;
312  out << "/// 1. 40% Perturb rigid body position of antibody relative to antigen" << std::endl;
313  out << "/// a. Set the pose's FoldTree for Ab-Ag docking (FoldTree provided by AntibodyInfo)" << std::endl;
314  out << "/// b. Run one cycle of standard high resolution docking (DockMCMCycle)" << std::endl;
315  out << "/// 2. 40% Perturb rigid body position of vL relative to vH" << std::endl;
316  out << "/// a. Set the pose's FoldTree for vL-vHAg (FoldTree provided by AntibodyInfo)" << std::endl;
317  out << "/// b. Run one cycle of standard high resolution docking (DockMCMCycle)" << std::endl;
318  out << "/// 3. 10% Select all CDRs for minimization" << std::endl;
319  out << "/// a. Apply CDRsMinPackMin" << std::endl;
320  out << "/// b. Monte Carlo accept or reject" << std::endl;
321  out << "/// 4. 5% Perturb CDR H2 loop by small, shear and CCD moves followed by minimization" << std::endl;
322  out << "/// a. Apply RefineOneCDRLoop (AntibodyInfo will setup the FoldTree for H2 refinement)" << std::endl;
323  out << "/// b. Monte Carlo accept or reject" << std::endl;
324  out << "/// 5. 5% Perturb CDR H3 loop by small, shear and CCD moves followed by minimization" << std::endl;
325  out << "/// a. Apply RefineOneCDRLoop (AntibodyInfo will setup the FoldTree for H3 refinement)" << std::endl;
326  out << "/// b. Monte Carlo accept or reject" << std::endl;
327  out << "///" << std::endl;
328  out << "//////////////////////////////////////////////////////////////////////////////////////////////" << std::endl;
329  out << "//////////////////////////////////////////////////////////////////////////////////////////////" << std::endl;
330  return out;
331 }
332 
333 } // namespace antibody2
334 } // namespace protocols