Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LoopRelaxThreadingMover.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 /// @brief
11 /// @author Mike Tyka
12 
13 // include these first for building on Visual Studio
14 
18 
20 // AUTO-REMOVED #include <protocols/electron_density/util.hh>
21 
22 #include <core/fragment/FragSet.hh>
23 // AUTO-REMOVED #include <core/kinematics/FoldTree.hh>
24 // AUTO-REMOVED #include <core/io/pdb/pose_io.hh>
25 #include <core/pose/Pose.hh>
26 #include <basic/Tracer.hh>
27 #include <basic/options/option.hh>
28 // AUTO-REMOVED #include <core/chemical/ChemicalManager.hh>
29 // AUTO-REMOVED #include <core/scoring/Energies.hh>
30 
34 
38 #include <core/sequence/util.hh>
40 
41 #include <utility/vector1.hh>
42 
43 // option key includes
44 #include <basic/options/keys/loops.OptionKeys.gen.hh>
45 #include <basic/options/keys/cm.OptionKeys.gen.hh>
46 #include <basic/options/keys/symmetry.OptionKeys.gen.hh>
47 #include <basic/options/keys/edensity.OptionKeys.gen.hh>
48 
51 // AUTO-REMOVED #include <protocols/jd2/MultiThreadingJob.hh>
52 
55 // AUTO-REMOVED #include <protocols/comparative_modeling/MultiThreadingMover.hh>
57 
59 #include <protocols/jd2/Job.hh>
60 #include <utility/vector0.hh>
61 
62 namespace protocols {
63 namespace comparative_modeling {
64 
66  using namespace basic::options;
67  using namespace basic::options::OptionKeys;
68  // initialize fragments
70 
71  // Read parameters
72  max_loop_rebuild = option[ OptionKeys::cm::max_loop_rebuild ]();
73  loop_rebuild_filter = option[ OptionKeys::cm::loop_rebuild_filter ]();
74  remodel = option[ OptionKeys::loops::remodel ]();
75  relax = option[ OptionKeys::loops::relax ]();
76 }
77 
79  using namespace protocols::loops;
80  using namespace protocols::jd2;
81 
82  // apply a mover which calculates only repulsive energy on designate residues
84  replonly.apply( pose );
85 
86  using core::Size;
87  basic::Tracer tr("protocols.threading");
88  // looprelax
90  JobDistributor::get_instance()->current_job()->inner_job().get()
91  );
92  if ( !job ) {
93  utility_exit_with_message("ERROR: You must use the ThreadingJobInputter with the LoopRelaxThreadingMover - did you forget the -in:file:template_pdb option?");
94  }
95 
96  LoopsOP my_loops = new Loops( job->loops( pose.total_residue() ) );
97  my_loops->choose_cutpoints( pose );
98  tr.Info << "loops to be rebuilt are: " << std::endl;
99  tr.Info << my_loops << std::endl;
100 
101  // Add any ligands specified
102  using namespace basic::options;
103  using namespace basic::options::OptionKeys;
104 
105  // setup for symmetry
106  if ( option[ OptionKeys::symmetry::symmetry_definition ].user() ) {
108  pre_mover.apply( pose );
109  }
110 
111  // Skip modelling if we're just producing starting models
112  if ( option[ OptionKeys::cm::start_models_only ]() ) return;
113 
114  // setup for density
115  if ( option[ edensity::mapfile ].user() ) {
117  pre_mover.mask( *my_loops );
118  pre_mover.apply( pose );
119  }
120 
121  LoopRelaxMoverOP lr_mover( new LoopRelaxMover );
122  lr_mover->frag_libs( frag_libs_ );
123  lr_mover->loops( my_loops );
124  lr_mover->relax( relax );
125  lr_mover->remodel( remodel );
126  lr_mover->cmd_line_csts( true );
127  lr_mover->rebuild_filter( loop_rebuild_filter );
128  lr_mover->n_rebuild_tries( max_loop_rebuild );
129  lr_mover->copy_sidechains( true );
130  lr_mover->set_current_tag( get_current_tag() );
131  lr_mover->apply( pose );
132 
133  // more loop rebuilding (if necessary!)
134  Size const min_loop_size( option [ OptionKeys::cm::min_loop_size ]() );
135  if ( option[ OptionKeys::cm::loop_close_level ]() == 2 ) {
136  // if loops aren't closed here, try to figure out the loops again
137  using namespace protocols::comparative_modeling;
138  LoopsOP temp_loops = pick_loops_chainbreak( pose, min_loop_size );
139  lr_mover->loops( temp_loops );
140  lr_mover->apply( pose );
141  } else if ( option[ OptionKeys::cm::loop_close_level ]() == 3 ) {
142  using namespace protocols::comparative_modeling;
143  Size const max_tries( 10 ); // make this an option?
144  bool loops_closed( false );
145  for ( Size ii = 1; (ii <= max_tries) && !loops_closed; ++ii ) {
146  LoopsOP temp_loops = pick_loops_chainbreak( pose, min_loop_size );
147  loops_closed = ( temp_loops->size() == 0 );
148  if ( !loops_closed ) {
149  lr_mover->loops(temp_loops);
150  lr_mover->apply(pose);
151  lr_mover->relax("no");
152  }
153  }
154 
155  lr_mover->remodel("no");
156  lr_mover->relax(relax);
157  lr_mover->apply(pose);
158  }
159 
160  // recover side chains if requested by user ...
161  if ( option[ cm::recover_side_chains ]() ) {
162  using namespace core::pose;
163  using namespace core::pack;
164  using namespace core::id;
165  using namespace core::scoring;
166  using namespace core::sequence;
167  using namespace protocols::comparative_modeling;
168 
169  Pose template_pose( *job->get_pose() );
170 
172  SequenceMapping map = aln.sequence_mapping(1,2);
173  utility::vector1< bool > residues_to_repack( pose.total_residue(), true );
174 
175  for ( core::Size ii = 1; ii <= pose.total_residue(); ++ii ) {
176  //if ( map[ii] == 0 ) residues_to_repack[ii] = true;
177  residues_to_repack[ii] = true;
178  }
179  StealSideChainsMover sc_mover( template_pose, map );
180  sc_mover.apply( pose );
181  task::PackerTaskOP task
182  = task::TaskFactory::create_packer_task( pose );
183  task->initialize_from_command_line();
184  task->restrict_to_repacking();
185  task->restrict_to_residues(residues_to_repack);
186  ScoreFunctionOP scorefxn(
187  ScoreFunctionFactory::create_score_function( "standard", "score12" )
188  );
189  pack_rotamers( pose, *scorefxn, task );
190  } // recover_side_chains
191 } // apply
192 
195  return "LoopRelaxThreadingMover";
196 }
197 
198 } // namespace loops
199 } // namespace protocols