Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SnugDockProtocol.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/SnugDockProtocol.cc
12 /// @brief Dock and antigen to an antibody while optimizing the rigid body orientation of the VH and VL chains and
13 /// performing CDR loop minimization.
14 /// @detailed
15 ///
16 ///
17 /// @author Jianqing Xu ( xubest@gmail.com )
18 /// @author Brian D. Weitzner ( brian.weitzner@gmail.com )
19 
20 // Unit headers
22 
23 // Package headers
27 
28 // Project headers
30 
31 #include <core/pose/Pose.hh>
33 #include <basic/options/option.hh>
34 #include <basic/options/keys/antibody.OptionKeys.gen.hh>
35 #include <basic/options/keys/run.OptionKeys.gen.hh>
36 
37 
38 // Basic headers
39 #include <basic/Tracer.hh>
40 
41 // Utility headers
42 #include <utility/excn/Exceptions.hh>
43 
44 static basic::Tracer TR("protocols.antibody2.SnugDockProtocol");
45 using namespace core;
46 
47 namespace protocols {
48 namespace antibody2 {
49 
50 ///////////////////////////////////////////////////////////////////////////////////////////////////////
51 ////////////////////////////////////////////// BOILER PLATE CODE //////////////////////////////////////
52 ///////////////////////////////////////////////////////////////////////////////////////////////////////
53 
54 ///@brief default constructor
55 SnugDockProtocol::SnugDockProtocol() : Mover()
56 {
57  init();
58 }
59 
60 ///@brief copy constructor
62 {
64 }
65 
66 ///@brief assignment operator
68  //abort self-assignment
69  if ( this == &rhs ) return *this;
70  Mover::operator=( rhs );
72  return *this;
73 }
74 
75 //destructor
77 
78 /// @brief Each derived class must specify its name.
80 {
81  return type();
82 }
83 
84 //@brief clone operator, calls the copy constructor
87 {
88  return new SnugDockProtocol( *this );
89 }
90 
91 ///@brief fresh_instance returns a default-constructed object for JD2
94 {
95  return new SnugDockProtocol();
96 }
97 
98 ///@brief This mover retains state such that a fresh version is needed if the input Pose is about to change
100 {
101  return true;
102 }
103 
105 {
109 }
110 ///////////////////////////////////////////////////////////////////////////////////////////////////////
111 /////////////////////////////////////// END OF BOILER PLATE CODE //////////////////////////////////////
112 ///////////////////////////////////////////////////////////////////////////////////////////////////////
113 
115 {
116  TR << "Beginning apply function of " + get_name() + "." << std::endl;
117 
118  if ( ! antibody_info_ ) setup_objects( pose );
119 
120  show( TR );
121  TR << "Setting the input structure's FoldTree for Antibody-Antigen docking." << std::endl;
122  pose.fold_tree( antibody_info_->get_FoldTree_LH_A( pose ) );
123 
124  TR << "Beginning application of " + docking()->get_name() + "." << std::endl;
125  docking()->apply( pose );
126 }
127 
129 {
130  TR << "Setting up data for " + get_name() + "." << std::endl;
131 
132  /// AntibodyInfo is used to store information about the Ab-Ag complex and to generate useful helper objects based on
133  /// that information (e.g. the various FoldTrees that are needed for SnugDock).
134  antibody_info_ = new AntibodyInfo( pose );
135 
137  docking()->add_additional_low_resolution_step( low_res_refine_cdr_h2_ );
138  docking()->add_additional_low_resolution_step( low_res_refine_cdr_h3_ );
139 
140  SnugDockOP high_resolution_phase = new SnugDock;
141  high_resolution_phase->set_antibody_info( antibody_info_ );
142  docking()->set_docking_highres_mover( high_resolution_phase );
143 
144 }
145 
147 {
150 
151  if ( ! antibody_info_ )
152  {
153  using utility::excn::EXCN_Msg_Exception;
154  throw EXCN_Msg_Exception( "A valid AntibodyInfo instance is required to setup " + get_name() + "'s centroid loop "
155  + "refinement movers." );
156  }
157 
158  /// FIXME: The chain break weight configuration and constraint weight should be handled by RefineOneCDRLoop.
159  ScoreFunctionOP low_res_loop_refinement_scorefxn = ScoreFunctionFactory::create_score_function("cen_std", "score4L");
160  low_res_loop_refinement_scorefxn->set_weight( scoring::chainbreak, 1.0 );
161  low_res_loop_refinement_scorefxn->set_weight( scoring::overlap_chainbreak, 10./3. );
162  low_res_loop_refinement_scorefxn->set_weight( scoring::atom_pair_constraint, 100 );
163 
166  h2,
168  low_res_loop_refinement_scorefxn
169  );
170 
173  h3,
175  low_res_loop_refinement_scorefxn
176  );
177 }
178 
180 {
181  type( "SnugDockProtocol" );
182 
183  /// TODO: Allow the refinement method to be set via a mutator and from the options system
184  using basic::options::option;
185  using namespace basic::options::OptionKeys;
186  if ( option[ basic::options::OptionKeys::antibody::refine ].user() ) {
187  loop_refinement_method_ = option[ basic::options::OptionKeys::antibody::centroid_refine ]() ;
188  }
189  else{
190  loop_refinement_method_ = "refine_kic";
191  }
192 }
193 
195  SnugDockProtocol & lhs,
196  SnugDockProtocol const & rhs
197 ){
198  // copy all data members from rhs to lhs
199  lhs.antibody_info_ = rhs.antibody_info_;
200 
201  // Movers
204  lhs.docking_ = rhs.docking_;
205 
207 }
208 
210 {
211  if ( ! docking_ )
212  {
213  /// The full DockingProtocol is used with a custom high resolution phase and post-low-resolution phase
214  /// All FoldTrees will be setup through AntibodyInfo so DockingProtocol's autofoldtree setup is disabled.
216  docking_->set_autofoldtree( false );
217  }
218  return docking_;
219 }
220 
221 void
222 SnugDockProtocol::show( std::ostream & out )
223 {
224  out << *this;
225 }
226 
227 std::ostream & operator<<(std::ostream& out, SnugDockProtocol const & snugdockprotocol )
228 {
229  if ( snugdockprotocol.antibody_info_ )
230  {
231  out << snugdockprotocol.get_name() << " has been configured to operate on an Antibody-Antigen complex with the "
232  << "following information:" << std::endl;
233  out << * snugdockprotocol.antibody_info_ << std::endl;
234  }
235  else
236  {
237  out << snugdockprotocol.get_name() << " has not been used yet. " << snugdockprotocol.get_name()
238  <<"'s data initialization occurs the first time its apply method is called." << std::endl;
239  }
240  return out;
241 }
242 
243 } // namespace antibody2
244 } // namespace protocols