Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LoopMoverFromCommandLine.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 under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 
11 /// @file protocols/Loops/LoopMoverFromCommandLine.cc
12 /// @brief Parseable class to do full loop remodeling with input fragment files from command line
13 /// @author Jordan Willis (jordan.r.willis@vanderbilt.edu)
14 
15 // Unit headers
18 
19 // Package headers
20 
21 // Project headers
22 // AUTO-REMOVED #include <protocols/loops/kinematic_closure/KinematicWrapper.hh>
23 // AUTO-REMOVED #include <protocols/loops/kinematic_closure/KinematicMover.hh>
26 // AUTO-REMOVED #include <protocols/loops/LoopMover_QuickCCD.hh>
29 #include <protocols/loops/loops_main.hh> // for various loop utility fxns
30 #include <protocols/loops/Loops.hh>
33 #include <basic/Tracer.hh>
34 
35 #include <utility/tag/Tag.hh>
38 // AUTO-REMOVED #include <protocols/forge/remodel/RemodelLoopMover.hh>
39 
40 
43 
44 // AUTO-REMOVED #include <protocols/simple_moves/MinMover.hh>
45 
46 // AUTO-REMOVED #include <core/chemical/util.hh>
49 
50 #include <core/pose/Pose.hh>
51 
52 #include <core/scoring/dssp/Dssp.hh> //getting SS from frag files
53 
55 
56 
61 // AUTO-REMOVED #include <core/pack/task/operation/OperateOnCertainResidues.hh>
62 // AUTO-REMOVED #include <core/pack/task/operation/ResLvlTaskOperations.hh>
63 
64 // AUTO-REMOVED #include <protocols/simple_moves/PackRotamersMover.hh>
65 
66 // AUTO-REMOVED #include <basic/options/option.hh>
67 // AUTO-REMOVED #include <basic/options/keys/packing.OptionKeys.gen.hh>
68 // AUTO-REMOVED #include <basic/options/keys/loops.OptionKeys.gen.hh>
69 //create option keys for loop movers
70 
71 // AUTO-REMOVED #include <core/fragment/ConstantLengthFragSet.hh>
72 // AUTO-REMOVED #include <core/fragment/FrameIteratorWorker_.hh>
73 #include <core/fragment/FragSet.hh>
74 #ifdef WIN32
75 #include <core/fragment/FragID.hh>
76 #endif
77 
78 // AUTO-REMOVED #include <core/fragment/Frame.hh>
79 // AUTO-REMOVED #include <core/fragment/picking_old/vall/util.hh>
80 // AUTO-REMOVED #include <core/fragment/picking_old/FragmentLibraryManager.hh>
81 
84 #include <utility/vector0.hh>
85 #include <utility/vector1.hh>
86 
87 //Auto Headers
89 
90 
91 
92 namespace protocols {
93 namespace protein_interface_design {
94 namespace movers {
95 
96 static basic::Tracer TR( "protocols.moves.LoopRemodelFromCommandLine" );
97 static basic::Tracer TR_report( "protocols.moves.LoopRemodelFromCommandLine.REPORT" );
98 
101 {
103 }
104 
107  return new LoopMoverFromCommandLine;
108 }
109 
111 {
112  return "LoopMoverFromCommandLine";
113 }
114 
116 
117 
120 {
121  return( protocols::moves::MoverOP( new LoopMoverFromCommandLine( *this ) ) );
122 }
123 
124 
125 //call on empty constructor
127  simple_moves::DesignRepackMover( LoopMoverFromCommandLineCreator::mover_name() ),
128  intermedrelax_( "no" ),
129  remodel_( "no" ),
130  relax_( "no" ),
131  string_refine_( "no" )
132 {
133  design(false);
134 }
135 
136 //full member variables defined in constructor
137 
139  std::string const protocol,
140  bool const perturb,
141  bool const refine,
142  core::scoring::ScoreFunctionOP & hires_score,
143  core::scoring::ScoreFunctionOP & lores_score,
144  std::string const loop_file_name,
146  ) :
147  simple_moves::DesignRepackMover ( LoopMoverFromCommandLineCreator::mover_name()),
148  protocol_ ( protocol ),
149  perturb_( perturb),
150  refine_(refine),
151  intermedrelax_( "no" ),
152  remodel_( "no" ),
153  relax_( "no" ),
154  string_refine_( "no" )
155 {
156  hires_score_ = hires_score;
157  lores_score = new core::scoring::ScoreFunction ( *lores_score );
158  loop_file_name_= loop_file_name;
159  loops_ = new protocols::loops::Loops( *loops );
160  design(false);
161 }
162 
163 
164 
165 //apply to pose
166 void
168 {
169  using namespace protocols::loops;
170  pose.conformation().detect_disulfides(); // I don't think that this is important but just in case
171  core::pose::Pose native_pose = pose;
174  loops->verify_against(pose);
175  loops->auto_choose_cutpoints(pose);
176  if( loops->size() == 0) {
177  TR << "No loops found!" << std::endl;
178  return; // bounce out if we didn't define any loops
179  }
180  else
181  {
182  TR << *loops << std::endl;
183  }
184  if( loops->size() > 0 ) {
186  task_factory->push_back( new core::pack::task::operation::InitializeFromCommandline );
187  task_factory->push_back( new core::pack::task::operation::IncludeCurrent );
188  task_factory->push_back( new core::pack::task::operation::NoRepackDisulfides );
189  // set up temporary fold tree for loop closure
190  TR.Debug << "Original FoldTree " << pose.fold_tree() << std::endl;
191  core::kinematics::FoldTree old_ft( pose.fold_tree() );
192  for( Loops::iterator it = loops->v_begin(); it != loops->v_end(); ++it ) {
193  it->set_extended( true ); // set all loops to extended (needed for CCD mover to really perturb)
195  single_loop->add_loop(*it);
197  pose.fold_tree( new_ft );
198  add_cutpoint_variants( pose );
200  //pose will always start full atom
201  //protocols::moves::MonteCarlo mc( pose, *scorefxn_repack_, mc_kt );
203  retrieve_sc.allsc( true );
204 
205  if( protocol_ == "automatic" ){
208 
210  lrm.frag_libs( frag_libs );
211  lrm.loops( single_loop );
212  lrm.relax( relax() );
213  lrm.refine( string_refine() );
214  lrm.remodel( remodel() );
215  lrm.intermedrelax( intermedrelax() );
217  lrm.apply( pose );
218  return;
219  }
221  if( protocol_ == "kinematic" ) {
222  if( perturb_ ) {
224  perturb.set_native_pose( new core::pose::Pose ( native_pose ) );
225  perturb.apply( pose );
226  }
228  retrieve_sc.apply( pose ); // recover sidechains from pre-centroid pose
229  if( refine_ ) {
231  refine.set_redesign_loop(false); // design?
232  refine.set_native_pose( new core::pose::Pose ( native_pose ) );
234  refine.apply( pose );
235  }
236  } // protocol == kinematic
237  else if( protocol_ == "ccd" ) {
238  TR << "Task Factory =" << task_factory;
239  TR << "ccd protocol" << std::endl;
241  core::scoring::dssp::Dssp dssp( pose );
242  dssp.insert_ss_into_pose( pose );
243  std::string const full_ss = pose.secstruct();
244  std::string const full_sequence = pose.sequence();
247  if( perturb_ ) {
249  for ( core::Size i = 1; i <= frag_libs.size(); ++i ) {
250  perturb.add_fragments( frag_libs[i] );
251  }
252  perturb.set_strict_loops( true );
253  perturb.set_native_pose( new core::pose::Pose ( native_pose ) );
254  perturb.apply( pose );
255  }
257  retrieve_sc.apply( pose ); // recover sidechains from pre-centroid pose
258  if( refine_ ) {
260  for ( core::Size i = 1; i <= frag_libs.size(); ++i ) {
261  refine.add_fragments( frag_libs[i] );
262  }
263  //core::pack::task::PackerTaskOP task = task_factory->create_task_and_apply_taskoperations( pose );
264  refine.set_redesign_loop( false );
265  refine.set_native_pose( new core::pose::Pose ( native_pose ) );
266  refine.apply( pose );
267  }//refine
268  }//ccd
269  }//end single loop
270  }//loops>0
271 }
275 }
276 void
278 {
279  protocol_ = tag->getOption<std::string>( "protocol", "ccd" );
280  perturb_ = tag->getOption<bool>( "perturb", 1 );
281  if( protocol_ == "automatic" ) // ugly, but LoopRemodelMover accepts string whereas the other movers accept bool
282  refine( tag->getOption< std::string >( "refine", "no" ) );
283  else
284  refine( tag->getOption<bool>( "refine", 1 ) );
285  intermedrelax( tag->getOption< std::string >( "intermedrelax", "no" ) );
286  remodel( tag->getOption< std::string >( "remodel", "no" ) );
287  relax( tag->getOption< std::string > ("relax", "no" ) );
288  std::string const hires_score( tag->getOption<std::string>( "refine_score", "score12" ) );
289  std::string const lores_score( tag->getOption<std::string>( "perturb_score", "score4L" ) );
290  hires_score_ = new core::scoring::ScoreFunction( *data.get< core::scoring::ScoreFunction * >( "scorefxns", hires_score ));
291  lores_score_ = new core::scoring::ScoreFunction( *data.get< core::scoring::ScoreFunction * >( "scorefxns", lores_score ));
292 
293  loop_file_name_ = tag->getOption<std::string>("loop_file", "loops.loops");
294 // task_factory(protocols::rosetta_scripts::parse_task_operations( tag, data ));
295 
296 }//parsemytags
297 }//movers
298 }//protein_interface_design
299 }//protocols