Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ClassicAbinitio.hh
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 src/protocols/abinitio/ClassicAbinitio.hh
11 /// @brief header file for ClassicAbinitio protocol
12 /// @detailed
13 /// Contains currently: Classic Abinitio
14 ///
15 ///
16 /// @author Oliver Lange
17 /// @author James Thompson
18 /// @author Mike Tyka
19 
20 
21 #ifndef INCLUDED_protocols_abinitio_ClassicAbinitio_hh
22 #define INCLUDED_protocols_abinitio_ClassicAbinitio_hh
23 
24 // Unit Headers
25 
26 // AUTO-REMOVED #include <core/io/silent/SilentFileData.hh>
27 // AUTO-REMOVED #include <core/io/silent/SilentFileData.fwd.hh>
28 // AUTO-REMOVED #include <core/io/silent/SilentStructFactory.hh>
29 
31 // AUTO-REMOVED #include <protocols/abinitio/SmoothFragmentMover.fwd.hh>
32 
33 #include <core/types.hh>
34 
36 #include <core/pose/Pose.fwd.hh>
39 // AUTO-REMOVED #include <core/pack/task/PackerTask.fwd.hh>
40 
43 
44 // ObjexxFCL Headers
45 
46 // Utility headers
47 #include <utility/pointer/ReferenceCount.hh>
48 
49 //// C++ headers
50 // AUTO-REMOVED #include <cstdlib>
51 #include <string>
52 #include <vector>
53 
55 #include <utility/vector1.hh>
56 
57 
58 namespace protocols {
59 namespace abinitio {
60 
61 /// Move these forward declarations to ClassicAbinitio.fwd.hh
62 class ClassicAbinitio;
64 
65 //@ brief The Classic Abinitio protocol from rosetta++
66 /*!
67 @ detail
68 general usage:
69 ClassicAbinitio abinitio;
70 abinitio.init( pose );
71 ...
72 while(nstruct) {
73  abinitio.apply( pose );
74 }
75 
76 call ClassicAbinitio::register_options() before core::init to add relevant options to the applications help
77 
78 , with the following
79 stages, all of which uses a different ScoreFunction based on the cen_std.wts in minirosetta_database:
80 
81 - Stage 1: large (usually 9mer) randomly selected fragment insertions, only VDW term turned on.
82 Uses score0.wts_patch and runs for either a maximum of 2000 cycles or until all moveable phi/psi values
83 have been changed.
84 
85 - Stage 2: large randomly selected fragment insertions, more score terms turned on. Uses score1.wts_patch
86 and runs for 2000 cycles.
87 
88 - Stage 3: uses large randomly selected fragment insertions, although the size of the fragment insertions
89 is tunable via the set_apply_large_frags( bool ) method. Alternates between score2.wts_patch and score5.wts_patch,
90 running tunable numbers of 2000-cycle iterations between the two scoring functions.
91 
92 - Stage 4: uses small (usually 3mer) fragment insertions with the fragment selection based on the Gunn cost for
93 finding local fragment moves. Runs for 4000-cycles and uses score3.wts_patch.
94 
95 The class implements the basic abinito approach as known from rosetta++. We tried to set this up, such that
96 behaviour of the protocol can be changed in many different ways ( see, e.g., FoldConstraints ). To be able to change the
97 behaviour of the protocol easily the class-apply function and methods called therein (e.g., prepare_XXX() / do_XXX_cycles() ) should
98 not directly change moves or trials. A reference to the currently used score-function should be obtained by
99 mc().score_function() ...
100 
101 Behaviour can be changed in the following ways:
102 
103 use non-classic FragmentMover --> eg. not uniformly sampled fragments, but using some weighting
104  --> large and small moves doesn't have to be 3mers and 9mers... use other movers...
105  ---> or other fragets for the "convenience constructor"
106 use custom trial classes --> overload update_moves()
107 
108 change sampling behaviour:
109  overload prepare_XXX() methods: these are called before the cycling for a certain stage begins
110  overload do_stageX_cycles() : the actual loops over trial-moves ...
111 
112 change scoring functions:
113  overload set_default_scores()
114  weight-changes effective for all stages: set_score_weight()
115 
116 */
117 
118 
119 class ClassicAbinitio : public Protocol {
120  typedef Protocol Parent;
121 public:
122  enum StageID {
130  };
131  ///@brief This constructor does not work -- Fix it before using it.
132  // constructor: supply mover classes for Fragment Moves
137  int /*dummy otherwise the two constructors are ambiguous */
138  );
139 
140  ///@brief constructor: supply fragsets for large and small fragment moves
142  core::fragment::FragSetCOP fragset_small,
143  core::fragment::FragSetCOP fragset_large,
145  );
146 
147  /// @brief Explicit copy constructor since this class contains OPs of other classes
148  ClassicAbinitio( ClassicAbinitio const & src );
149 
150  /// @brief Explicit destructor since this class contains OPs of other classes
152 
153  //@brief setup moves, mc-object, scores
154  //@details can't call this from constructor; virtual functions don't operate
155  //until construction has completed.
156  virtual
157  void init( core::pose::Pose const& pose );
158 
159  //@brief ClassicAbinitio has virtual functions... use this to obtain a new instance
160  virtual
161  moves::MoverOP clone() const;
162 
163  //@brief run protocol on pose
164  virtual void apply( core::pose::Pose & pose );
165  virtual std::string get_name() const;
166 
167  //@brief return FramgentMover for smooth_small fragment insertions (i.e., stage4 moves)
169 
170  //@brief return FragmentMover for small fragment insertions ( i.e., stage3/4 moves )
172 
173  //@brief return FragmentMover for large fragment insertions (i.e., stage1/2 moves )
175 
176  //@brief change the movemap ( is propagated to mover-objects )
177  //@detail overload if your extension stores additional moves as member variables
178  virtual void set_movemap ( core::kinematics::MoveMapCOP mm );
179 
180  //@brief returns current movemap
182 
183  //@brief set new instances of FragmentMovers
184  void set_moves (
188  );
189 
190  //@brief set new monte-carlo object
191  void set_mc( moves::MonteCarloOP );
192 
193  //@brief obtain currently used monte-carlo object --> use to obtain current score-func: mc().score_function()
195  return *mc_;
196  }
197 
198  //@brief obtain currently used monte-carlo object --> use to obtain current score-func: mc().score_function()
199  moves::MonteCarlo const & mc() const {
200  return *mc_;
201  }
202 
203  //@brief override cycle setting ( init() -> sets it according to cmd-line options )
204  virtual void set_cycles( core::Real increase_cycles = 1.0 );
205 
206  //@brief
207  Size total_trials() const {
208  return total_trials_;
209  }
210 
211  /// @brief for debugging, one wants to have access to the native pose.
212  // void set_native_pose( core::pose::Pose const & pose );
213 
214  //@brief set weight - effective for all scoring functions stage == -1 --> set weight for all stages
215  // mod -1 (ignored) , in stage3 mod = 1 --> 3a , mod = 2 --> 3b
216  virtual void set_score_weight( core::scoring::ScoreType, core::Real setting, StageID stage = ALL_STAGES );
217 
218 protected:
219  //@brief called to notify about changes regarding movers... new movemap / new instances of FragmentMover
220  virtual void update_moves();
221 
222  //@brief called by init() --- calls all set_default_XXX methods
223  virtual void set_defaults( core::pose::Pose const& pose );
224 
225  //@brief read out cmd-line options
226  virtual void set_default_options();
227 
228  //@brief register cmd-line options in option system ( call before core::init )
229 public:
230  static void register_options();
231 protected:
232  //@brief construct default monto-carlo object
233  virtual void set_default_mc(
234  core::pose::Pose const& pose,
235  core::scoring::ScoreFunction const& scorefxn
236  );
237 
238  //@brief assigns default score-functions to the 4 stages--> score0 / score1 / (score2/score5) / score3
239  virtual void set_default_scores();
240 
241  //@brief currently used score function ( depends on stage )
243 
244  //@brief set current scorefunction
245  void current_scorefxn( core::scoring::ScoreFunction const& scorefxn );
246 
247  //@brief If appropriate for the stage then recover low mc.
248  void recover_low( core::pose::Pose& pose, StageID stage );
249 
250  //@brief this is called if the scorefxn is replaced with a new one
251  virtual void replace_scorefxn( core::pose::Pose& pose, StageID stage, core::Real intra_stage_progress );
252 
253  //@brief set individual weight of current scorefunction
254  //@details NOTE: does not change the predefined weights, this information is lost each time the score is set
255  // weight will be overwritten with default ->at beginning of stages, each iteration of loop in stage3
256  // we could change this behaviour by having a pointer to the current score and making sure that nobody can
257  // change the score inside the mc-object (only const accessor )
259 
260  //@brief run cycles for different scoring_stages, return number of steps used
261  virtual bool do_stage1_cycles( core::pose::Pose &pose );
262  virtual bool do_stage2_cycles( core::pose::Pose &pose );
263  virtual bool do_stage3_cycles( core::pose::Pose &pose );
264  virtual bool do_stage4_cycles( core::pose::Pose &pose );
265  virtual bool do_stage5_cycles( core::pose::Pose &pose );//vats
266 
267  //@brief returns true if pose is < 3.0 A rms to last pose sent to this function
268  // bool convergence_check( core::pose::Pose const & pose );
269 
270  //@brief returns the Mover that is applied inside the stage1 loop
271  virtual moves::TrialMoverOP
273 
274 
275  //@brief returns the Mover that is applied inside the stage3 double loop
276  virtual moves::TrialMoverOP
278 
279  //@brief returns the Mover that is applied inside the stage3 double loop
280  virtual moves::TrialMoverOP
281  stage3_mover( core::pose::Pose & pose, int lct1, int lct2, moves::TrialMoverOP trials_in );
282 
283  //@brief returns the Mover that is applied inside the stage4 loop
284  virtual moves::TrialMoverOP
285  stage4_mover( core::pose::Pose &pose, int kk, moves::TrialMoverOP trials_in );
286 
287  //@brief returns the Mover that is applied inside the stage5 loop
288  virtual moves::TrialMoverOP
289  stage5_mover( core::pose::Pose &pose, moves::TrialMoverOP trials_in );//vats
290 
291  //@brief called by update_moves() creates the instances of TrialMover with the FragmentMoves
292  virtual void set_trials();
293 
294  //@brief accessor for instances of TrialMover
296 
297  //@brief accessor for instances of TrialMover
299 
300  //@brief accessor for instances of TrialMover
302 
303  // anything you want to have done before the stages ?
304  //@brief prepare_stageX is called before do_stageX_cycles... overload to change status/scoring/conformation....
305  virtual bool prepare_stage1( core::pose::Pose &pose );
306  virtual bool prepare_stage2( core::pose::Pose &pose );
307  virtual bool prepare_stage3( core::pose::Pose &pose );
308  virtual bool prepare_stage4( core::pose::Pose &pose );
309  virtual bool prepare_stage5( core::pose::Pose &pose );//vats
310 
311  //@brief called in each iteration of inner loop in stage3 before stage3_cycles_ of trials commence
312  virtual bool prepare_loop_in_stage3(
314  Size, /* loop_iteration*/
315  Size /* total_iterations */
316  );
317 
318  //@brief called in each iteration of the loop in stage4 before the stage4_cycles_ of trials commence
319  virtual bool prepare_loop_in_stage4(
321  Size, /* loop_iteration*/
322  Size /* total_iterations */
323  );
324 
325 
326 public:
327  //@brief accessor for boolean flag: just_smooth_cycles
328  inline
329  bool just_smooth_cycles() const {
330  return just_smooth_cycles_;
331  }
332 
333  //@brief Accessor for number of stage1 cycles
334  inline
335  Size stage1_cycles() const {
336  return stage1_cycles_;
337  }
338 
339  //@brief Accessor for number of stage2
340  inline
341  Size stage2_cycles() const {
342  return stage2_cycles_;
343  }
344 
345  //@brief Accessor for number of stage3 cycles
346  inline
347  Size stage3_cycles() const {
348  return stage3_cycles_;
349  }
350 
351  //@brief Setter for number of stage4 cycles
352  inline
353  void set_stage4_cycles(Size stage4_cycles_new) {
354  stage4_cycles_ = stage4_cycles_new;
355  }
356 
357  //@brief Accessor for number of stage4 cycles
358  inline
359  Size stage4_cycles() const {
360  return stage4_cycles_;
361  }
362 
363  //@brief Accessor for number of stage5 cycles //vats
364  inline
365  Size stage5_cycles() const {
366  return stage5_cycles_;
367  }
368 
369 
370  //@brief query this flag if you have time-intensive stuff and cut it short
371  bool bQuickTest() const {
372  return bQuickTest_;
373  }
374 
375  void set_skip_stage1 ( bool setting ) {
376  bSkipStage1_ = setting;
377  }
378 
379  void set_skip_stage2 ( bool setting ) {
380  bSkipStage2_ = setting;
381  }
382 
383 protected:
384  void output_debug_structure( core::pose::Pose & pose, std::string prefix );
385 
386  //@brief obtain currently used monte-carlo object --> use to obtain current score-func: mc().score_function()
388 
389 protected:
390  //@brief cycles_numbers -- modified by set_cycles(), set_default_options()
393  Size stage3_cycles_; //score25
396 
397 public:
398 
399 
400 
401 private:
402  //@brief scoring functions -- modified by set_default_scores() / set_score_weight()
408  core::scoring::ScoreFunctionOP score_stage5_; //score3 //vats lets try score3 first
409 
410  //@brief flags
411  bool apply_large_frags_; //above contig_cut2
412  bool short_insert_region_; //below contig_cut3
414  bool bQuickTest_; // this flag might land in base-class
415  bool close_chbrk_; // closing chainbreaks in old style pose_abinitio
416 
417  //@brief a temperature
419 
420  //@brief movemap --> which dofs can be moved during abinitio
422 
423  //@brief a MonteCarlo object -- set_default_mc() , access: mc()
425 
426  // Large and small Fragments
430 
431  // TrialMovers
435 
437 
438 public:
444 
446 
447 private:
448  /// @brief Private, unimplemented assignment operator to prevent assignment of this class.
449  /// Copy-constructor copying only.
450  ClassicAbinitio const & operator = ( ClassicAbinitio const & src );
451 
452 
453 };
454 
455 } // abinitio
456 } // protocols
457 
458 #endif