Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RefineOneCDRLoopCentroid.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/RefineOneCDRLoopCentroid.cc
12 /// @brief Build a homology model of an antibody2
13 /// @detailed
14 ///
15 ///
16 /// @author Jianqing Xu (xubest@gmail.com)
17 
18 
19 
21 
22 #include <basic/Tracer.hh>
23 #include <basic/options/option.hh>
24 #include <basic/options/keys/in.OptionKeys.gen.hh>
25 
28 
31 
34 #include <protocols/loops/Loop.hh>
35 #include <protocols/loops/Loops.hh>
42 #include <core/io/pdb/pose_io.hh>
43 #include <core/pose/Pose.hh>
44 #include <core/pose/PDBInfo.hh>
45 #include <core/pose/util.hh>
46 
47 
49 
51 //JQX:: this header file took care of the "CUTPOINT_LOWER" options below
52 
53 
54 
55 
56 
57 using basic::T;
58 using basic::Error;
59 using basic::Warning;
60 
61 static basic::Tracer TR("protocols.antibody2.RefineOneCDRLoopCentroid");
62 
63 
64 
65 
66 using namespace core;
67 namespace protocols {
68 namespace antibody2 {
69 
70 
71 
72 RefineOneCDRLoopCentroid::RefineOneCDRLoopCentroid( AntibodyInfoCOP antibody_info,
73  AntibodyCDRNameEnum const & loop_name ) : Mover()
74 {
75  the_cdr_loop_ = antibody_info->get_CDR_loop(loop_name);
76  set_default();
77 }
78 
80  AntibodyCDRNameEnum const & loop_name,
81  core::scoring::ScoreFunctionCOP scorefxn) : Mover()
82 {
84  the_cdr_loop_ = antibody_info->get_CDR_loop(loop_name);
85  set_default();
86 }
87 
88 
90 {
91  the_cdr_loop_ = a_cdr_loop;
92  set_default();
93 }
94 
96  core::scoring::ScoreFunctionCOP scorefxn ) : Mover()
97 {
99  the_cdr_loop_ = a_cdr_loop;
100  set_default();
101 }
102 
103 
104 
105 
107 
108  benchmark_ = false;
109  snug_fit_ = false;
110  refine_input_loop_ = true;
111 
112  TR << "Finished Setting Defaults" << std::endl;
113 
114 }
115 
116 
117 
118 // default destructor
120 
121 
122 
123 
124 
126  return "RefineOneCDRLoopCentroid";
127 }
128 
131 }
132 
133 
134 
135 
136 
138  TR<<" start finalize_setup function ..."<<std::endl;
139  if (!lowres_scorefxn_) {
141  lowres_scorefxn_->set_weight( scoring::chainbreak, 10./3. );
142  }
143  TR<<" finish finalize_setup function !!!"<<std::endl;
144 
145 }
146 
147 
148 
150  TR<<"start apply function ..."<<std::endl;
151 
152  finalize_setup(pose);
153 
154 
156 
157 
158  TR<<"finish apply function !!!"<<std::endl;
159 
160  return;
161 
162 }
163 
164 
165 
166 ///////////////////////////////////////////////////////////////////////////
167 /// @begin loop_centroid_relax
168 ///
169 /// @brief actually relaxes the region specified
170 ///
171 /// @detailed This is all done in low resolution. Intention was to give
172 /// camelid CDR H1 a larger perturbation.
173 ///
174 /// @param[in] pose, loop begin position, loop end position
175 ///
176 ///
177 /// @authors Aroop 05/07/2010
178 ///
179 /// @last_modified 05/07/2010
180 ///////////////////////////////////////////////////////////////////////////
182  pose::Pose & pose_in,
183  Size const loop_begin,
184  Size const loop_end ){
185  using namespace protocols;
186  using namespace protocols::simple_moves;
187  using namespace protocols::loops;
188  using namespace protocols::moves;
189 
192 
193  // storing starting fold tree
194  kinematics::FoldTree tree_in( pose_in.fold_tree() );
195 
196  //setting MoveMap
197  kinematics::MoveMapOP loop_map;
198  loop_map = new kinematics::MoveMap();
199  loop_map->clear();
200  loop_map->set_chi( false );
201  loop_map->set_bb( false );
202  utility::vector1< bool> allow_bb_move( pose_in.total_residue(), false );
203  for( Size ii = loop_begin; ii <= loop_end; ii++ ){
204  allow_bb_move[ ii ] = true;
205  }
206  loop_map->set_bb( allow_bb_move );
207  loop_map->set_jump( 1, false );
208 
209 
210  Size loop_size = ( loop_end - loop_begin ) + 1;
211  Size cutpoint = loop_begin + Size(loop_size/2);
212 
213  loops::Loop one_loop( loop_begin, loop_end, cutpoint, 0, false );
214  simple_one_loop_fold_tree( pose_in, one_loop );
215 
216  // set cutpoint variants for correct chainbreak scoring
217  if( !pose_in.residue( cutpoint ).is_upper_terminus() ) {
218  if( !pose_in.residue( cutpoint ).has_variant_type(chemical::CUTPOINT_LOWER))
220  if( !pose_in.residue( cutpoint + 1 ).has_variant_type(chemical::CUTPOINT_UPPER ) )
222  }
223 
224 
225 
226  Real min_tolerance = 0.001;
227  if( benchmark_ ) min_tolerance = 1.0;
228  std::string min_type = std::string( "dfpmin_armijo_nonmonotone" );
229  bool nb_list = true;
230  MinMoverOP loop_min_mover = new MinMover( loop_map, lowres_scorefxn_, min_type, min_tolerance, nb_list );
231 
232  // more params
233  Size n_small_moves ( numeric::max(Size(5), Size(loop_size/2)) );
234  Size inner_cycles( loop_size );
235  Size outer_cycles( 1 );
236  if( refine_input_loop_ ){
237  outer_cycles = 5;
238  }
239  if( snug_fit_ ){
240  outer_cycles = 2;
241  }
242  if( benchmark_ ) {
243  n_small_moves = 1;
244  inner_cycles = 1;
245  outer_cycles = 1;
246  }
247 
248  Real high_move_temp = 2.00;
249  // minimize amplitude of moves if correct parameter is set
250  BackboneMoverOP small_mover = new SmallMover( loop_map, high_move_temp, n_small_moves );
251  BackboneMoverOP shear_mover = new ShearMover( loop_map, high_move_temp, n_small_moves );
252  small_mover->angle_max( 'H', 2.0 );
253  small_mover->angle_max( 'E', 5.0 );
254  small_mover->angle_max( 'L', 6.0 );
255 
256  shear_mover->angle_max( 'H', 2.0 );
257  shear_mover->angle_max( 'E', 5.0 );
258  shear_mover->angle_max( 'L', 6.0 );
259 
260  CcdMoverOP ccd_moves = new CcdMover( one_loop, loop_map );
261  RepeatMoverOP ccd_cycle = new RepeatMover(ccd_moves, n_small_moves);
262 
263  SequenceMoverOP wiggle_cdr_centroid_loop_( new SequenceMover() );
264  wiggle_cdr_centroid_loop_->add_mover( small_mover );
265  wiggle_cdr_centroid_loop_->add_mover( shear_mover );
266  wiggle_cdr_centroid_loop_->add_mover( ccd_cycle );
267 
268 
269  loop_min_mover->apply( pose_in );
270 
271  Real const init_temp( 2.0 );
272  Real const last_temp( 0.5 );
273  Real const gamma = std::pow( (last_temp/init_temp), (1.0/inner_cycles));
274  Real temperature = init_temp;
275 
276  MonteCarloOP mc;
277  mc = new protocols::moves::MonteCarlo( pose_in, *lowres_scorefxn_, temperature );
278  mc->reset( pose_in ); // monte carlo reset
279 
280  // outer cycle
281  for(Size i = 1; i <= outer_cycles; i++) {
282  mc->recover_low( pose_in );
283 
284  // inner cycle
285  for ( Size j = 1; j <= inner_cycles; j++ ) {
286  temperature *= gamma;
287  mc->set_temperature( temperature );
288  wiggle_cdr_centroid_loop_->apply( pose_in );
289  loop_min_mover->apply( pose_in );
290 
291  mc->boltzmann( pose_in );
292 
293  } // inner cycles
294  } // outer cycles
295  mc->recover_low( pose_in );
296 
297 
298  // minimize
299  if( !benchmark_ ){
300  loop_min_mover->apply( pose_in );
301  }
302 
303  // Restoring pose stuff
304  pose_in.fold_tree( tree_in ); // Tree
305 
306 
307  return;
308 } // loop_centroid_relax
309 
310 
311 
312 
313 
314 } // namespace antibody2
315 } // namespace protocols
316 
317 
318