Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
VarLengthBuild.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 protocols/forge/components/VarLengthBuild.fwd.hh
11 /// @brief Component that performs a simplified version of a protocol for
12 /// variable length remodeling of protein backbone segments.
13 /// @author Yih-En Andrew Ban (yab@u.washington.edu)
14 
15 #ifndef INCLUDED_protocols_forge_components_VarLengthBuild_hh
16 #define INCLUDED_protocols_forge_components_VarLengthBuild_hh
17 
18 // unit headers
20 
21 // package headers
26 #ifdef WIN32
28 #endif
29 
30 // project headers
32 // AUTO-REMOVED #include <core/fragment/FragData.fwd.hh>
33 // AUTO-REMOVED #include <core/fragment/FrameList.hh>
37 #include <core/pose/Pose.fwd.hh>
39 #include <protocols/moves/Mover.hh>
40 
41 // utility headers
42 // AUTO-REMOVED #include <utility/vector1.hh>
43 
44 // C++ headers
45 #include <string>
46 
48 #include <utility/vector1.hh>
49 
50 
51 
52 namespace protocols {
53 namespace forge {
54 namespace components {
55 
56 
57 /// @brief Component that performs a protocol for user-specified variable length
58 /// remodeling of protein backbone segments.
59 /// @details This bootstrap implementation performs centroid level loop building
60 /// using 9,3,1-mer fragments and running a LoopMover with the Remodel 'remodel_cen'
61 /// score function. The default loop mover is the forge RemodelLoopMover.
62 /// It does not yet handle extensions or continuous replacements.
63 /// This class is under heavy development, expect many changes to both API and
64 /// internals.
66 
67 
68 private: // typedefs
69 
70 
72 
73 
74 public: // typedefs
75 
77 
78  typedef core::Real Real;
79  typedef core::Size Size;
90 
94 
98 
99 
100 public: // construct/destruct
101 
102 
103  /// @brief default constructor
104  VarLengthBuild();
105 
106 
107  /// @brief BuildManager constructor
109 
110  /// @brief BuildManager + RemodelData constructor
111  VarLengthBuild( BuildManager const & manager , RemodelData const & remodel_data); //copy remodeldata
112 
113 
114  /// @brief copy constructor
115  VarLengthBuild( VarLengthBuild const & rval );
116 
117 
118  /// @brief default destructor
119  ~VarLengthBuild();
120 
121 
122 private: // assignment
123 
124 
125  /// @brief disallow copy assignment
126  /// @remarks Mover base class prevents this from working...
127  VarLengthBuild & operator =( VarLengthBuild const & rval );
128 
129 
130 public: // virtual constructors
131 
132 
133  /// @brief clone this object
134  virtual
135  MoverOP clone() const;
136 
137 
138  /// @brief create a new instance of this type of object
139  virtual
140  MoverOP fresh_instance() const;
141 
142 
143 public: // accessors
144 
145 
146  /// @brief build manager
147  inline
148  BuildManager const & manager() const {
149  return manager_;
150  }
151 
152 
153  /// @brief at the end of apply(), reset the Pose to the original Pose if
154  /// mover was not successful? (default true)
155  inline
158  }
159 
160 
161  /// @brief the string id of the loop mover to use
162  /// (default "RemodelLoopMover")
163  /// @return "RemodelLoopMover" for the forge RemodelLoopMover, otherwise a
164  /// string recognized by create_loop_mover() in the "LoopMoverFactory".
165  inline
166  String const & loop_mover_str() const {
167  return loop_mover_str_;
168  }
169 
170 
171  /// @brief cache fragments after picking? (default true)
172  /// @details If true, will cache fragments and reuse them upon each
173  /// apply() call instead of repicking every time.
174  inline
175  bool cache_fragments() const {
176  return cache_fragments_;
177  }
178 
179 
180  /// @brief option dictating whether to keep VallLibrary in memory or clear
181  /// it under certain circumstances after picking fragments.
182  /// (default KEEP_IN_MEMORY)
183  inline
185  return vall_memory_usage_;
186  }
187 
188 
189  /// @brief the number of fragments to pick at each position
190  /// (default 200)
191  inline
192  Size num_fragpick() const {
193  return num_fragpick_;
194  }
195 
196 
197  /// @brief also use fragments spanning the entire length of a loop?
198  /// (default false)
199  inline
200  bool use_fullmer() const {
201  return use_fullmer_;
202  }
203 
204 
205  /// @brief full sequence string corresponding to original input pose
206  /// used to pick sequence biased fragments; if empty, sequence bias
207  /// is not used when picking fragments
208  inline
210  return original_sequence_;
211  }
212 
213 
214  /// @brief full sequence string with length corresponding to the *new*
215  /// modified pose used to pick secondary structure biased fragments.
216  /// @remarks IMPORTANT: This is an override! If this string is filled,
217  /// it will be used as the string to pick secondary structure biased
218  /// fragments without modification. All secondary structure settings
219  /// that might be taken from the original Pose or from the BuildInstructions
220  /// *will be ignored*. The length of this string must be equal to the
221  /// length of the *NEW* modified pose, otherwise the protocol will stop
222  /// with error -- you can use BuildManager::dummy_modify() to help
223  /// figure things out.
224  inline
227  }
228 
229 
230  /// @brief full amino acid string with length corresponding to the *new*
231  /// modified pose used to pick sequence biased fragments.
232  /// @remarks IMPORTANT: This is an override! If this string is filled,
233  /// it will be used as the string to pick sequence biased
234  /// fragments without modification. All sequence settings
235  /// that might be taken from the original Pose or from the BuildInstructions
236  /// *will be ignored*. The length of this string must be equal to the
237  /// length of the *NEW* modified pose, otherwise the protocol will stop
238  /// with error -- you can use BuildManager::dummy_modify() to help
239  /// figure things out.
240  inline
241  String const & new_sequence_override() const {
242  return new_sequence_override_;
243  }
244 
245 
246  /// @brief return the highest linear chainbreak score a chainbreak can have
247  /// and still be considered closed
248  /// @remarks default 0.07
249  inline
251  return max_linear_chainbreak_;
252  }
253 
254 
255  /// @brief Flag to turn on restart mode, in which VLB assumes that the Pose
256  /// fed to it during apply() has already been modified by the manager.
257  /// (default False)
258  /// @remarks In restart mode, VLB only runs the manager's dummy modify
259  /// capability during apply() to get the mapping info.
260  inline
261  bool restart_mode() const {
262  return restart_mode_;
263  }
264 
265 
266 public: // mutators
267 
268 
269  /// @brief set ScoreFunction used during build
270  void scorefunction( ScoreFunction const & sfx );
271 
272 
273  /// @brief set ScoreFunction used during build
274  void scorefunction( ScoreFunctionOP const & sfx );
275 
276 
277  /// @brief set build manager; also clears any cached fragments
278  void manager( BuildManager const & manager );
279 
280 
281  /// @brief at the end of apply(), reset the Pose to the original Pose if
282  /// mover was not successful?
283  inline
284  void recover_original_on_failure( bool const flag ) {
286  }
287 
288 
289  /// @brief set the loop mover to use via string
290  /// @details use "RemodelLoopMover" for the forge RemodelLoopMover,
291  /// otherwise set it to a string recognized by
292  /// create_loop_mover() in the "LoopMoverFactory".
293  inline
294  void loop_mover_str( String const & str ) {
296  }
297 
298 
299  /// @brief cache fragments after picking?
300  /// @details If true, will cache fragments and reuse them upon each
301  /// apply() call instead of repicking every time.
302  inline
303  void cache_fragments( bool const flag ) {
304  cache_fragments_ = flag;
305  }
306 
307 
308  /// @brief option dictating whether to keep VallLibrary in memory or clear
309  /// it under certain circumstances after picking fragments.
310  inline
312  vall_memory_usage_ = level;
313  }
314 
315 
316  /// @brief the number of fragments to pick at each position (default 200)
317  inline
318  void num_fragpick( Size const num ){
319  num_fragpick_ = num;
320  }
321 
322 
323  /// @brief also use fragments spanning the entire length of a loop?
324  inline
325  void use_fullmer( bool const flag ) {
326  use_fullmer_ = flag;
327  }
328 
329 
330  /// @brief full sequence string corresponding to original input pose
331  /// used to pick sequence biased fragments; if empty, sequence bias
332  /// is not used when picking fragments
333  inline
334  void original_sequence( String const & seq ) {
335  original_sequence_ = seq;
336  }
337 
338 
339  /// @brief full sequence string with length corresponding to the *new*
340  /// modified pose used to pick secondary structure biased fragments.
341  /// @param[in] str String with length equals to the *new* modified pose.
342  /// See remarks for help on how to determine this. String is allowed
343  /// to be empty, in which case it will clear the setting.
344  /// @remarks IMPORTANT: This is an override! If this string is filled,
345  /// it will be used as the string to pick secondary structure biased
346  /// fragments without modification. All secondary structure settings
347  /// that might be taken from the original Pose or from the BuildInstructions
348  /// *will be ignored*. The length of this string must be equal to the
349  /// length of the *NEW* modified pose, otherwise the protocol will stop
350  /// with error -- you can use BuildManager::dummy_modify() to help
351  /// figure things out.
352  inline
355  }
356 
357 
358  /// @brief full amino acid string with length corresponding to the *new*
359  /// modified pose used to pick sequence biased fragments.
360  /// @param[in] str String with length equals to the *new* modified pose.
361  /// See remarks for help on how to determine this. String is allowed
362  /// to be empty, in which case it will clear the setting.
363  /// @remarks IMPORTANT: This is an override! If this string is filled,
364  /// it will be used as the string to pick sequence biased
365  /// fragments without modification. All sequence settings
366  /// that might be taken from the original Pose or from the BuildInstructions
367  /// *will be ignored*. The length of this string must be equal to the
368  /// length of the *NEW* modified pose, otherwise the protocol will stop
369  /// with error -- you can use BuildManager::dummy_modify() to help
370  /// figure things out.
371  inline
372  void new_sequence_override( String const & str ) {
374  }
375 
376 
377  /// @brief set the highest linear chainbreak score a chainbreak can have
378  /// and still be considered closed
379  inline
380  void max_linear_chainbreak( Real const tol ) {
382  }
383 
384  inline
385  void loop_mover_fold_tree_constant( bool const flag ){
387  }
388 
389  /// @brief Flag to turn on restart mode, in which VLB assumes that the Pose
390  /// fed to it during apply() has already been modified by the manager.
391  /// (default False)
392  /// @remarks In restart mode, VLB only runs the manager's dummy modify
393  /// capability during apply() to get the mapping info.
394  inline
395  void restart_mode( bool const flag ) {
396  restart_mode_ = flag;
397  }
398 
399  inline
400  void ignore_cmdline_enzdes_cstfile( bool const flag ) {
402  }
403 
404 
405 public: //constraint / setup mover management management
406 
407  void
408  clear_rcgs();
409 
410  void
412 
413  void
415 
416  void
417  add_setup_mover( moves::MoverOP mover_in );
418 
419  void
421 
422  void
424 
425 
426 public: // fragment management
427 
428 
429  /// @brief clear any currently cached fragments
430  void clear_fragments();
431 
432  /// @brief set abego definition for fragments
434  abego_ = abego;
435  }
436 
437 
438 public: // main operations
439 
440 
441  /// @brief run protocol on given Pose
442  /// @return if procedure successful, return Pose with modifications and a
443  /// sealed fold tree, otherwise return Pose with modifications and the
444  /// in-progress cut fold tree
445  /// @remarks Before invoking this function it's best to make sure
446  /// the secondary structure in the Pose is marked via the method
447  /// that you would prefer, e.g. by Dssp (protocols::jumping::Dssp),
448  /// by the old Rosetta++ binning method (core::pose::set_ss_from_phipsi)
449  /// or by external method such as reading in a file.
450  virtual
451  void apply( Pose & pose );
452 
453  virtual std::string get_name() const;
454 
455 protected: // main operations
456 
457 
458  /// @brief run centroid level protocol on given Pose
459  /// @return true if regions modeled within tolerances, false otherwise
460  virtual
461  bool centroid_build(
462  Pose & pose
463  );
464 
465 
466  /// @brief return the appropriate loop mover
467  /// @param[in] loops The loops to model.
468  /// @param[in] false_mm Enforce False settings in this MoveMap. Currently
469  /// only useful with the RemodelLoopMover.
470  virtual
472  loops::LoopsOP const loops,
473  MoveMap const & false_mm
474  );
475 
476 
477 protected: // fragment management
478 
479 
480  /// @brief pick fragments of size full, 9, 3, 1
481  /// @param[in] complete_ss The complete secondary structure string, typically from a Pose.
482  /// @param[in] complete_aa The complete amino acid string, typically from a Pose;
483  /// can be empty. If empty, sequence bias is not used to pick fragments.
484  /// @param[in] complete_abego The complete abego string, typically from setter, set_abego
485  /// @param[in] interval The interval [left, right] to pick fragments from; Pose
486  /// numbering (i.e. 1-based indexing).
487  /// @param[in] n_frags The number of fragments to pick per position.
488  void pick_all_fragments(
489  String const & complete_ss,
490  String const & complete_aa,
491  utility::vector1< String > const & complete_abego,
492  Interval const & interval,
493  Size const n_frags
494  );
495 
496 
497  /// @brief pick fragments of a given length, padding when necessary
498  /// @param[in] complete_ss The complete secondary structure string, typically from a Pose.
499  /// @param[in] complete_aa The complete amino acid string, typically from a Pose;
500  /// can be empty. If empty, sequence bias is not used to pick fragments.
501  /// @param[in] complete_abego The complete abego string, typically from a setter, set_abego
502  /// @param[in] interval The interval [left, right] to pick fragments from; Pose
503  /// numbering (i.e. 1-based indexing).
504  /// @param[in] frag_length The desired length of the fragments
505  /// @param[in] n_frags The number of fragments to pick per position.
507  String const & complete_ss,
508  String const & complete_aa,
509  utility::vector1< String > const & complete_abego,
510  Interval const & interval,
511  Size const frag_length,
512  Size const n_frags
513  );
514 
515 
516 protected: //constraint management
517 
518 
519  void setup_remodel_constraints( Pose & pose );
520 
521 
522  void remove_remodel_constraints( Pose & pose );
523 
524 
525 private: // data
526 
527 
528  /// @brief manages desired build instructions
530 
531 
532  /// @brief the ScoreFunction used during build
534 
535  /// @remodelData, used when constraints are defined through Remodel
537 
538 
539  /// @brief at the end of apply(), reset the Pose to the original Pose if
540  /// mover was not successful? (default true)
542 
543 
544  /// @brief the string ID of the LoopMover used during build
545  /// (default "RemodelLoopMover" )
546  /// @details use "RemodelLoopMover" for the forge RemodelLoopMover,
547  /// otherwise set it to a string recognized by
548  /// create_loop_mover() in the "LoopMoverFactory".
550 
551 
552  /// @brief cache fragments after picking? (default true)
553  /// @details If true, will cache fragments and reuse them upon each
554  /// apply() call instead of repicking every time.
556 
557 
558  /// @brief option dictating whether to keep VallLibrary in memory or clear
559  /// it under certain circumstances after picking fragments.
560  /// (default KEEP_IN_MEMORY)
562 
563 
564  /// @brief the number of fragments to pick at each position (default 200)
566 
567 
568  /// @brief also use fragments spanning the entire length of a loop?
569  /// (default false)
571 
572 
573  /// @brief full sequence string corresponding to original input pose
574  /// used to pick sequence biased fragments; if empty, sequence bias
575  /// is not used when picking fragments
577 
578 
579  /// @brief full sequence string with length corresponding to the *new*
580  /// modified pose used to pick secondary structure biased fragments.
581  /// @remarks IMPORTANT: This is an override! If this string is filled,
582  /// it will be used as the string to pick secondary structure biased
583  /// fragments without modification. All secondary structure settings
584  /// that might be taken from the original Pose or from the BuildInstructions
585  /// *will be ignored*. The length of this string must be equal to the
586  /// length of the *NEW* modified pose, otherwise the protocol will stop
587  /// with error -- you can use BuildManager::dummy_modify() to help
588  /// figure things out.
590 
591 
592  /// @brief full amino acid string with length corresponding to the *new*
593  /// modified pose used to pick sequence biased fragments.
594  /// @remarks IMPORTANT: This is an override! If this string is filled,
595  /// it will be used as the string to pick sequence biased
596  /// fragments without modification. All sequence settings
597  /// that might be taken from the original Pose or from the BuildInstructions
598  /// *will be ignored*. The length of this string must be equal to the
599  /// length of the *NEW* modified pose, otherwise the protocol will stop
600  /// with error -- you can use BuildManager::dummy_modify() to help
601  /// figure things out.
603 
604 
605  /// @brief the highest linear chainbreak score a chainbreak can have
606  /// and still be considered closed
608 
609 
610  /// @brief internal flag indicating if fragments for all intervals have been
611  /// picked
613 
614 
615  /// @brief full-mer to use during fragment insertion
617 
618 
619  /// @brief 9-mers to use during fragment insertion
621 
622 
623  /// @brief 3-mers to use during fragment insertion
625 
626 
627  /// @brief 1-mers to use during fragment insertion
629 
630  /// @brief abego for picking fragments
632 
633  /// @brief collection of RCGs to manage remodel constraints
635 
636  /// @brief collection of movers that get a chance to modify
637  /// the pose after the new lenght has been setup but before
638  /// remodeling starts
640 
641  /// @brief collection of movers that mess with the pose
642  /// during RemodelLoopMover apply where n is determined by the variable below
643  /// gets piped straight into RemodelLoopMover, only has an effect
644  /// if this is the loop mover used
646 
647  /// @brief determines how often the above movers get called
648  /// in the loop mover, also only has an effect if the
649  /// RemodelLoopMover is used (default 3)
651 
652  /// @brief tell RemodelLoopMover to keep the foldtree untouched
653  /// also only has an effect if RemodelLoopmover is used
654  /// note: will only tell loop mover is this is set to true
656 
657  /// @brief Flag to turn on restart mode, in which VLB assumes that the Pose
658  /// fed to it during apply() has already been modified by the manager.
659  /// (default False)
660  /// @remarks In restart mode, VLB only runs the manager's dummy modify
661  /// capability during apply() to get the mapping info.
663 
664 
665  /// @brief flo jan 11 reading an enzdes cstfile in the middle of
666  /// remodel fucks up up a remodel run that was started from enzdes
668 
670 
671 
672 };
673 
674 
675 } // components
676 } // forge
677 } // protocols
678 
679 
680 #endif /* INCLUDED_protocols_forge_components_VarLengthBuild_HH */