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