Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DesignTask.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 protocols/flxbb/DesignTask.cc
11 /// @brief
12 /// @author Nobuyasu Koga ( nobuyasu@uw.edu )
13 ///
14 
15 // Unit Headers
17 
18 // Package Headers
19 //#include <protocols/flxbb/DesignLayerOperation.hh>
22 
23 // Project Headers
24 // AUTO-REMOVED #include <core/pose/Pose.hh>
25 #include <core/chemical/AA.hh>
30 #include <basic/options/option.hh>
31 #include <protocols/moves/Mover.hh>
32 #include <basic/Tracer.hh>
33 
34 // option key includes
35 #include <basic/options/keys/packing.OptionKeys.gen.hh>
36 
37 #include <utility/vector1.hh>
38 
39 
40 static basic::Tracer TR("protocols.flxbb.DesignTask");
41 
42 namespace protocols {
43 namespace flxbb{
44 
45 using namespace core;
46 using namespace basic::options;
47 using namespace basic::options::OptionKeys;
48 
49 ///////////////////////////////////////////////////////////////////////////////////////////////////////
50 /// @brief default constructor
52  ncycle_( 1 ),
53  scorefxn_( NULL ),
54  mover_( NULL ),
55  filter_structs_( NULL ),
56  task_( NULL ),
57  resfile_( "" )
58 {
59  if ( option[ packing::resfile ].user() ) resfile_ = option[ packing::resfile ].value().at(1);
60 }
61 
62 /// @brief value constructor
64  Size const ncycle,
65  ScoreFunctionOP const sfxn,
66  MoverOP const mover,
67  FilterStructsOP const filter_structs,
68  PackerTaskOP const taskf,
69  String const & resfile
70 ):
71  ncycle_( ncycle ),
72  scorefxn_( sfxn ),
73  mover_( mover ),
74  filter_structs_( filter_structs ),
75  task_( taskf ),
76  resfile_( resfile )
77 {
78  if ( option[ packing::resfile ].user() ) resfile_ = option[ packing::resfile ].value().at(1);
79 }
80 
81 /// @brief value constructor
83  utility::pointer::ReferenceCount(),
84  ncycle_( rval.ncycle_ ),
85  scorefxn_( rval.scorefxn_ ),
86  mover_( rval.mover_ ),
87  filter_structs_( rval.filter_structs_ ),
88  task_( rval.task_ ),
89  resfile_( rval.resfile_ )
90 {}
91 
92 /// @brief destructor
94 
95 /// @brief the number of cycles of fixbb design and mover
96 Size
98 {
99  return ncycle_;
100 }
101 
102 /// @brief scorefxn for fixbb design
105 {
106  return scorefxn_;
107 }
108 
109 /// @brief mover after fixbb design
112 {
113  return mover_;
114 }
115 
116 /// @brief filter during fixbb design
119 {
120  return filter_structs_;
121 }
122 
123 /// @brief packer task for fixbb design
126 {
127  return task_;
128 }
129 
130 /// @brief resfile
133 {
134  return resfile_;
135 }
136 
137 /// @brief the number of cycles of fixbb design and mover
138 void
139 DesignTask::set_ncycle( Size const & ncycle )
140 {
141  ncycle_ = ncycle;
142 }
143 
144 /// @brief filter during fixbb design
145 void
147 {
148  scorefxn_ = sfxn;
149 }
150 
151 /// @brief mover after fixbb design
152 void
154 {
155  mover_ = value;
156 }
157 
158 /// @brief filter during fixbb design
159 void
161 {
162  filter_structs_ = value;
163 }
164 
165 /// @brief packer task for fixbb design
166 void
168 {
169  task_ = taskf;
170 }
171 
172 /// @brief set resfile
173 void
174 DesignTask::set_resfile( String const & resfile )
175 {
176  resfile_ = resfile;
177 }
178 
179 void
180 DesignTask::dump_packertask( std::ostream & os )
181 {
182  os << *task_;
183 }
184 
185 
186 void
188 {
189  for( utility::vector1< TaskOperationOP >::const_iterator it=tops.begin(); it!=tops.end(); ++it ) {
190  add_task_operation( *it );
191  }
192 }
193 
194 void
196 {
197  task_operations_.push_back( top );
198 }
199 
200 
201 ///////////////////////////////////////////////////////////////////////////////////////////////////////
202 /// @brief default constructor
204 
205 /// @brief value constructor
207  bool dsgn_core,
208  bool dsgn_boundary,
209  bool dsgn_surface,
210  bool use_original_seq,
211  Size ncycle,
212  ScoreFunctionOP sfxn,
213  MoverOP mover,
214  FilterStructsOP filter_structs
215 ):
216  DesignTask( ncycle, sfxn, mover, filter_structs ),
217  dsgn_core_(dsgn_core),
218  dsgn_boundary_(dsgn_boundary),
219  dsgn_surface_(dsgn_surface),
220  use_original_seq_( use_original_seq )
221 {}
222 
223 /// @brief destructor
225 
226 /// @brief setup PackerTask
228 {
229 
230  using namespace core::pack;
232  cmop->apply( pose, *task );
233  //DesignLayerOperationOP op = new DesignLayerOperation( dsgn_core_, dsgn_boundary_, dsgn_surface_ );
236 
237  if( resfile() != "" ){
238  TR << "Resfile is applied, except for the positions of AUTO " << std::endl;
240  rrop->apply( pose, *task );
241  }
242 
243  TR << "Designed layer: core = " << dsgn_core_ << ", boundary = " << dsgn_boundary_
244  << ", sufrace = " << dsgn_surface_ << std::endl;
245 
246  if( use_original_seq_ ){
247  op->use_original_seq();
248  TR << "Original sequences are preserved for the layer you don't design." << std::endl;
249  }else{
250  TR << "The region you don't design turned into Ala." << std::endl;
251  }
252 
253  op->apply( pose, *task );
254 
255  // apply additional task_opertaions
257  (*it)->apply( pose, *task );
258  }
259 
260  this->set_packertask( task );
261 }
262 
263 //////////////////////////////////////////////////////////////////////////////////////////////////////////
264 /// @brief default constructor
266 
267 /// @brief value constructor
269  Size ncycle,
271  MoverOP mover,
273 ):
274  DesignTask( ncycle, sfxn, mover, filter_structs )
275 {}
276 
277 /// @brief destructor
279 
280 /// @brief set up packer task
282 
283  using namespace core::pack;
285 
286  // set packertask based on resfile
287  if( resfile() != "" ){
288  TR << "Resfile " << resfile() << " is applied." << std::endl;
290  rrop->apply( pose, *task );
291  }
292  // initialize from command line
293  cmop->apply( pose, *task );
294 
295  // apply additonal taskoperations
297  (*it)->apply( pose, *task );
298  }
299 
300  this->set_packertask( task );
301 }
302 
303 } // namespace flxbb
304 } //namespace protocols
305