Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CDRsMinPackMin.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/CDRsMinPackMin.cc
12 /// @brief Build a homology model of an antibody2
13 /// @detailed
14 ///
15 ///
16 /// @author Jianqing Xu ( xubest@gmail.com )
17 
18 
20 
25 
27 #include <core/pose/util.hh>
30 #include <basic/Tracer.hh>
32 #include <protocols/loops/Loop.hh>
33 #include <protocols/loops/Loops.hh>
44 
45 
46 #include <ObjexxFCL/format.hh>
47 #include <ObjexxFCL/string.functions.hh>
48 
49 
50 
51 
52 using basic::T;
53 using basic::Error;
54 using basic::Warning;
55 
56 static basic::Tracer TR("protocols.antibody2.CDRsMinPackMin");
57 using namespace core;
58 
59 namespace protocols {
60 namespace antibody2 {
61 
62 
63 
64 CDRsMinPackMin::CDRsMinPackMin(AntibodyInfoOP antibody_info) : Mover()
65 {
66  user_defined_ = false;
67 
68  ab_info_ = antibody_info;
69 
70  init();
71 }
72 
74  AntibodyInfoOP antibody_info,
77  kinematics::MoveMapOP movemap
78 ) : Mover()
79 {
80  user_defined_ = true;
81 
82  ab_info_ = antibody_info;
83  loop_scorefxn_highres_ = scorefxn;
84  tf_ = tf;
85  allcdr_map_ = movemap;
86 
87  init();
88 }
89 
90 
91 
93 
94 
95 
97 
98  benchmark_ = false;
99  sc_min_ = false;
100  rt_min_ = false;
101  turnoff_minimization_ = false;
102 
103  min_type_ = "dfpmin_armijo_nonmonotone";
104  Temperature_ = 0.8;
105  min_tolerance_ = 0.1;
106  update_rounds_ = 0;
107 
108  if (!user_defined_){
109  tf_ = NULL;
110  allcdr_map_ = NULL;
111 
112  // setup all the scoring functions
114  loop_scorefxn_highres_->set_weight( core::scoring::chainbreak, 10. / 3. );
116  }
117 
118 
119 
120 
121 }
122 
124 {
125  using namespace pack;
126  using namespace pack::task;
127  using namespace pack::task::operation;
128  using namespace protocols;
129  using namespace protocols::toolbox::task_operations;
130  using namespace protocols::moves;
131 
133 
134  // **************** FoldTree ****************
135  pose.fold_tree( * ab_info_->get_FoldTree_AllCDRs(pose) );
136  TR<<pose.fold_tree()<<std::endl;
137 
138  // adding cutpoint variants for chainbreak score computation
139  loops::remove_cutpoint_variants( pose, true ); //remove first
141 
142  // must score first
143  ( *loop_scorefxn_highres_ )( pose );
144 
145  //**************** MoveMap ****************
146  if(!allcdr_map_){ // use this if, because sometimes a user may input a movemap at the beginning
148  *allcdr_map_=ab_info_->get_MoveMap_for_Loops(pose, *ab_info_->get_AllCDRs_in_loopsop(), false, true, 10.0);
149  }
150  else{
151  if(update_rounds_ > 0 ){
152  allcdr_map_->clear();
153  *allcdr_map_=ab_info_->get_MoveMap_for_Loops(pose, *ab_info_->get_AllCDRs_in_loopsop(), false, true, 10.0);
154  }
155  }
156 
157 
158  //**************** TaskFactory ****************
159  if(!tf_){ //use this if, because sometimes a user may input a taskfactory at the beginning
160  tf_ = ab_info_->get_TaskFactory_AllCDRs(pose);
161 
162  //core::pack::task::PackerTaskOP my_task2(tf_->create_task_and_apply_taskoperations(pose));
163  //TR<<*my_task2<<std::endl; //exit(-1);
164  }
165  else{
166  if(update_rounds_ > 0){
167  tf_->clear();
168  tf_ = ab_info_->get_TaskFactory_AllCDRs(pose);
169  }
170  }
171 
172  // 1. rotamer_trial
174  cdr_sequence_move_->add_mover(rotamer_trial_mover);
175 
176  // 2. all_cdr_min_moves
178  if (!turnoff_minimization_ ) cdr_sequence_move_ -> add_mover(all_cdr_min_moves);
179 
180 
181 
183 
184 
185  // 3. PackRotamer and Trial
187  repack->task_factory( tf_ );
188  moves::TrialMoverOP repack_trial = new moves::TrialMover(repack, mc);
189  cdr_sequence_move_ -> add_mover(repack_trial);
190 
191 
192  // 4. optional, rt_min_ or sc_min_
193  if ( rt_min_ ){
195  moves::TrialMoverOP rtmin_trial = new moves::TrialMover( rtmin, mc );
196  cdr_sequence_move_ -> add_mover(rtmin_trial);
197  }
198  if ( sc_min_ ){
199  core::pack::task::TaskFactoryCOP my_tf( tf_); // input must be COP, weird
201  moves::TrialMoverOP scmin_trial = new moves::TrialMover( scmin_mover, mc );
202  cdr_sequence_move_ -> add_mover(scmin_trial);
203  }
204 
205 
206 
207 }//finalize_setup
208 
209 
210 
211 
213  finalize_setup(pose);
214  cdr_sequence_move_ -> apply(pose);
215  update_rounds_++;
216 
217 }
218 
219 
220 
221 
222 
223 
224 
225 /// @details Show the complete setup of the antibody modeler protocol
226 void CDRsMinPackMin::show( std::ostream & out ) {
227  out << *this;
228 }
229 
230 std::ostream & operator<<(std::ostream& out, const CDRsMinPackMin & ab_m_2 ){
231  using namespace ObjexxFCL::fmt;
232 
233  // All output will be 80 characters - 80 is a nice number, don't you think?
234  std::string line_marker = "///";
235  out << "////////////////////////////////////////////////////////////////////////////////" << std::endl;
236  out << line_marker << A( 47, "Rosetta 3 Antibody Modeler" ) << space( 27 ) << line_marker << std::endl;
237  out << line_marker << space( 74 ) << line_marker << std::endl;
238  out << line_marker << " sc_min : " << ab_m_2.sc_min_ << std::endl;
239  out << line_marker << " rt_min : " << ab_m_2.rt_min_ << std::endl;
240  out << line_marker << std::endl;
241 
242  // Display the state of the antibody modeler protocol that will be used
243  out << line_marker << std::endl;
244  out << "////////////////////////////////////////////////////////////////////////////////" << std::endl;
245  return out;
246 }
247 
248 
249 
250 
251 
253  return "CDRsMinPackMin";
254 }
255 
257  tf_ = new pack::task::TaskFactory(*tf);
258 }
259 
261  allcdr_map_ = new kinematics::MoveMap(*movemap);
262 }
263 
264 
265 } // end antibody2
266 } // end protocols
267