Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DockTaskFactory.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 /// @file DockTaskFactory
11 /// @brief sets up the task factory for docking movers
12 /// @detailed
13 /// This contains the functions that set up the taskfactory for docking
14 /// movers depending on the command line options
15 /// @author Krishna Kilambi
16 
17 #include <basic/options/option.hh>
20 #include <core/pack/task/operation/TaskOperations.hh> // trans-clude <core/pack/task/operation/TaskOperation.hh>
24 #include <core/conformation/Residue.hh> // for design() flag
26 // AUTO-REMOVED #include <core/pack/task/operation/OperateOnCertainResidues.hh>
27 // AUTO-REMOVED #include <core/pack/task/operation/ResLvlTaskOperations.hh> // PreventRepackingRLT
28 // AUTO-REMOVED #include <core/pack/task/operation/ResFilters.hh> // ResidueLacksProperty
30 // AUTO-REMOVED #include <core/pack/dunbrack/RotamerConstraint.hh>
31 #include <core/pose/Pose.hh>
32 #include <core/pose/PDBInfo.hh>
33 // AUTO-REMOVED #include <core/conformation/Conformation.hh>
34 
35 //for resfile reading
36 #include <basic/options/keys/packing.OptionKeys.gen.hh>
37 
38 // ObjexxFCL Headers
39 #include <ObjexxFCL/string.functions.hh>
40 
41 #include <basic/Tracer.hh>
42 #include <utility/vector1.hh>
43 #include <utility/tools/make_vector1.hh>
44 // AUTO-REMOVED #include <utility/tag/Tag.hh> // REQUIRED FOR WINDOWS
45 
46 // option key includes
47 #include <basic/options/keys/docking.OptionKeys.gen.hh>
48 
49 // C++ headers
50 #include <string>
51 
53 #include <core/kinematics/Jump.hh>
55 #include <utility/vector0.hh>
56 
57 
58 using basic::T;
59 using basic::Error;
60 using basic::Warning;
61 
62 static basic::Tracer TR("protocols.docking.DockTaskFactory");
63 
64 using namespace core;
65 
66 namespace protocols {
67 namespace docking {
68 
69 // default constructor
70 DockTaskFactory::DockTaskFactory() : utility::pointer::ReferenceCount()
71 {
72  set_default();
75 }
76 
77 DockTaskFactory::DockTaskFactory( DockTaskFactory const & old_instance ) : utility::pointer::ReferenceCount( old_instance )
78 {
79  resfile_ = old_instance.resfile_;
80  norepack1_ = old_instance.norepack1_;
81  norepack2_ = old_instance.norepack2_;
82  design_chains_ = old_instance.design_chains_;
83  prepack_only_ = old_instance.prepack_only_;
85 }
86 //destructor
88 
89 void
91 {
92  prepack_only_ = false;
93  norepack1_ = false;
94  norepack2_ = false;
95  resfile_ = false;
96  //design_chains_ = utility::tools::make_vector1( NULL );
97  design_chains_.clear();
99 
101 
102  // @TODO needs to change so that these options can be set through setters and
103  // do not have to be called from the commandline
104  // the following should default to true always for docking
105  // ex1_ = true;
106  // ex2aro_ = true;
107  // include_input_sc_ = true;
108 }
109 
110 void
112 {
113  using namespace basic::options;
114 
115  if ( option[ OptionKeys::docking::norepack1 ].user() )
116  set_norepack1(option[ OptionKeys::docking::norepack1 ]());
117  else
118  set_norepack1(false);
119  if ( option[ OptionKeys::docking::norepack2 ].user() )
120  set_norepack2(option[ OptionKeys::docking::norepack2 ]());
121  else
122  set_norepack2(false);
123  // why is it like this? should true be the default value?
124  if ( option[ OptionKeys::packing::resfile].user() )
125  resfile_ = true;
126 
127  // @TODO should be packing level, not docking level
128  if ( option[ OptionKeys::docking::design_chains ].user() ) {
129  utility::vector1< std::string > chains = option[ OptionKeys::docking::design_chains ]();
130  for ( core::Size i = 1; i <= chains.size(); ++i ) {
131  design_chains_.push_back( chains[i][0] );
132  }
133  }
134 }
135 
136 void
138 {
139  using namespace basic::options;
140 
141  option.add_relevant( OptionKeys::docking::norepack1 );
142  option.add_relevant( OptionKeys::docking::norepack2 );
143  option.add_relevant( OptionKeys::packing::resfile );
144 }
146 {
147  additional_task_operations_ = additional_task_operations;
148 }
149 
151 {
152  additional_task_operations_.push_back( task_operation );
153 }
154 
156 {
158 }
159 
161 {
162  //restrict_to_interface_ = interface_definition;
163  return;
164 }
165 void
167  DockingHighResOP docker,
168  core::pose::Pose const & pose
169 ) const
170 {
171  using namespace core::pack::task;
172  using namespace core::pack::task::operation;
173  using namespace protocols::toolbox::task_operations;
174 
175  TaskFactoryOP tf = new TaskFactory();
176 
177 // if ( init_tf_ ) tf = new TaskFactory( *init_tf_ );
178 
179  // check to see which specific chains are being redesigned
180  // set restrict_to_repacking on all other chains
181  if ( design_chains_.size() > 0 ) {
182  // check for movable jumps
183  for ( core::Size i = 1; i <= pose.num_jump(); ++i ) {
184  core::Size const cutpoint = pose.fold_tree().cutpoint_by_jump( i );
185  char chain = pose.pdb_info()->chain( pose.pdb_info()->number( cutpoint ) );
186  if ( find( design_chains_.begin(), design_chains_.end(), chain ) != design_chains_.end() ) {
188  }
189  }
190  } else {
191  tf->push_back( new RestrictToRepacking );
192  }
193 
194  tf->push_back( new InitializeFromCommandline );
195  tf->push_back( new IncludeCurrent );
196  tf->push_back( new NoRepackDisulfides );
197  if( resfile_ ) tf->push_back( new ReadResfile );
198 
199  // DockingNoRepack only works over the first rb_jump in movable_jumps
200  // In a 2-body case this separates 1 & 2 based on the only cutpoint
201  // In a multibody case, this separates 1 & 2 based on the first cutpoint
202  if ( norepack1_ ) tf->push_back( new DockingNoRepack1( docker->movable_jumps()[1] ) );
203  if ( norepack2_ ) tf->push_back( new DockingNoRepack2( docker->movable_jumps()[1] ) );
204 
205  // incorporating Ian's UnboundRotamer operation.
206  // note that nothing happens if unboundrot option is inactive!
208  unboundrot->initialize_from_command_line();
209  operation::AppendRotamerSetOP unboundrot_operation = new operation::AppendRotamerSet( unboundrot );
210  tf->push_back( unboundrot_operation );
211 
212  //@TODO pose needed for this, set it up somewhere else
213  // core::pack::dunbrack::load_unboundrot(pose); // adds scoring bonuses for the "unbound" rotamers, if any
214 
215  // note that RestrictToInterfaceOperation is added during set_dock_mcm_protocol
216  if( !prepack_only_ ){
217  restrict_to_interface_->set_movable_jumps( docker->movable_jumps() );
218  tf->push_back( restrict_to_interface_ ); //JQX: add restrict to interface, the Legacy code used this in the initial packing as well
219  }
220 
221  // Add user specified task operations
223  tf->push_back( *operation );
224  }
225 
226  docker->set_task_factory( tf );
227 }
228 
229 
230 } // namespace docking
231 } // namespace protocols