Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FragmentMover.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 // :noTabs=false:tabSize=4:indentSize=4:
4 //
5 // (c) Copyright Rosetta Commons Member Institutions.
6 // (c) This file is part of the Rosetta software suite and is made available under license.
7 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
8 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
9 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
10 
11 /// @file core/fragments/FragSet.hh
12 /// @brief set of fragments
13 /// @author Oliver Lange
14 /// @date Wed Aug 22 12:08:31 2007
15 ///
16 
17 #ifndef INCLUDED_protocols_simple_moves_FragmentMover_HH
18 #define INCLUDED_protocols_simple_moves_FragmentMover_HH
19 
20 // Unit Headers
22 
23 // Package Headers
24 // AUTO-REMOVED #include <core/fragment/FragData.fwd.hh>
29 
30 // Project Headers
32 #include <core/pose/Pose.fwd.hh>
33 #include <protocols/moves/Mover.hh>
34 
35 
36 // ObjexxFCL Headers
37 
38 // Utility headers
39 #include <utility/vector1.fwd.hh>
40 
41 #include <utility/vector1.hh>
42 
43 
44 namespace protocols {
45 namespace simple_moves {
46 // might want to live in protocols::moves
47 
48 ///@brief abstract base class for FragmentMovers
49 class FragmentMover : public moves::Mover {
50 public:
52 
53  ///@brief choose and insert a fragment --> has to be overloaded
54  virtual void apply( core::pose::Pose& ) = 0;
55 
56  using moves::Mover::apply;
57 
58  ///@broef apply a fragment at pos to movemable dofs
59  virtual bool apply( core::pose::Pose&, Size pos ) const; // apply fragment at seqpos ( if possible )
60  virtual std::string get_name() const;
61 
62 
63  ///@brief apply at all movemable positions --- honors movemap
64  virtual Size apply_at_all_positions( core::pose::Pose& ) const; //apply one fragment at each insertable position
65 
66  ///@brief accessor to the fragment set
68 
69  ///@brief setter for the fragment set
70  virtual void set_fragments( core::fragment::FragSetCOP new_frags_ );
71 
72  ///@brief setter for the movemap
74 
76 
78  return insert_map_;
79  }
80 
82  return insert_size_;
83  }
84 
85 protected:
89  );
90 
91 
92  ///@brief constructor
97  );
98 
99  virtual void on_new_fragments() {
101  //invalid_insert_map();
102  }
103 
104 // void invalid_insert_map() {
105 // bValidInsertMap_ = false;
106 // insert_map_.clear();
107 // insert_size_.clear();
108 // }
109 
110  void update_insert_map();
111 
112  virtual bool apply_frames( core::pose::Pose &, core::fragment::FrameList const& ) const = 0;
113 
116 
117  // bool bValidInsertMap_;
120 
121 };
122 
123 /// @brief A FragmentMover that applies uniform sampling of fragments
125 public:
126 
127  /// @brief
130  );
131 
132 
133  /// @brief
137  );
138 
139 
140  /// @brief
141  /// @note: temp work around for PyRosetta code, until we find a way to handle owning pointers in this case
144  core::kinematics::MoveMap const & movemap
145  );
146 
148 
149  /// @brief Applies classic fragment insertion based on a FragSet
150  ///
151  /// example:
152  /// mover_3mer.apply(pose)
153  /// See also:
154  /// ClassicFragmentMover
155  /// Pose
156  /// ConstantLengthFragSet
157  void apply( core::pose::Pose & );
158  virtual std::string get_name() const;
159 
160  // Not defined, commenting out to make Python binding compile
161  //bool apply( core::pose::Pose &, Size pos );
162 
163  ///@brief check_ss controls whether fragment insertions are rejected that create short helices (<3) or strands (<2)
164  void set_check_ss( bool setting ) {
165  check_ss_=setting;
166  }
167 
168  ///@brief accessor
169  bool
170  check_ss() const {
171  return check_ss_;
172  }
173 
175  return end_bias_;
176  }
177 
178  void set_end_bias( core::Real setting ) {
179  end_bias_ = setting;
180  }
181  bool end_bias_check_enabled() const {
182  return bApplyEndBias_;
183  }
184 
185  void enable_end_bias_check( bool setting = true ) {
186  bApplyEndBias_ = setting;
187  }
188 
189  ///@brief min_overlap controls the behaviour fragset->region()
190  void set_min_overlap( Size setting ) {
191  min_overlap_ = setting;
192  }
193 
194  ///@brief min_frag_length controls the behaviour fragset->region()
195  void set_min_frag_length( Size setting ) {
196  min_frag_length_ = setting;
197  }
198 
199  friend std::ostream &operator<< ( std::ostream &os, ClassicFragmentMover const &cfmover );
200 
201 protected:
202 
203  ///@brief alternative Constructor to be used by derived classes
208  );
209 
210  ///@brief alternative Constructor to be used by derived classes
214  );
215 
216  virtual bool apply_frames( core::pose::Pose &, core::fragment::FrameList const& ) const;
217 
218 public: //this is actually protected: but need public for some unit-testing
219  /// @brief apply the chosen fragment,
220  /// @detail this can be overloaded to change action, e.,g., WobbleMover introduces chain-break
221  /// before fragment insertion and does ccd-loop closure afterwards
222  virtual
223  bool
225  core::fragment::Frame const& frame,
226  Size frag_num,
227  core::kinematics::MoveMap const& movemap,
228  core::pose::Pose &pose
229  ) const;
230 
231  /// @brief set defaults
232  virtual void set_defaults();
233 
234  // A Fragment mover has to make choices according which fragments are retrieved from the fragset_.
235  // the following virtual functions may be overloaded to influence these choices.
236  // generally they return bool if they were successfully in choosing a value
237  // and return their choice(s) in the last by-value parameter(s) of the calls
238 
239  /// @brief given FrameList and pose, this method yields a fragment ( frame_num/ frag_num);
240  /// return false if nothing suitable is found
241  virtual
242  bool choose_fragment(
244  core::pose::Pose const&,
245  Size &frame_num,
246  Size &frag_num
247  ) const;
248 
249  /// @brief apply fragment at predefined position
250  void define_start_window( Size window_start );
251 
252  /// @brief yields a start position (window_start) for fragment window to sample from
253  /// ( return false, if nothing suitable is found )
254  virtual bool choose_window_start( core::pose::Pose const&, Size window_length, Size &window_start ) const;
255 
256  /// @brief yields a length (window_length) of the fragment window to sample from
257  /// ( return false, if no suitable length is found )
258  virtual bool choose_window_length( core::pose::Pose const&, Size &window_length) const {
259  window_length = 1 ; //traditionally a constant value
260  return true;
261  }
262 
263  ///@brief is called from set_fragments()
265  }
266 
267  virtual bool end_bias_check( core::pose::Pose const&, Size window_start ) const;
268 
269  ///@brief returns true if the ss string is acceptable
270  virtual bool
271  valid_ss( std::string const & new_ss ) const;
272 
273 
274 
275 private:
276 
277  // these parameters seem to be more like constant options and therefore I didn't
278  // wrap them in virtual function calls... but of course one may change that...
281  bool check_ss_;
283 
284  // @brief if true, fragments are less likely to be inserted at tails of pose
285  // IN JUMPING MODE THIS SHOULD PROBABLY BE MADE RELATIVE TO DIST TO CHAINBREAK ?
289 };
290 
293  struct Item {
294  Item( Size a, Size b) : frame_pos( a), frag_num( b) {}
297  };
298 
299 public:
301 
305  );
306 
307  virtual std::string get_name() const;
308 
309  virtual
310  bool
312  core::fragment::Frame const& frame,
313  Size frag_num,
315  core::pose::Pose &pose
316  ) const;
317 
318  void show( std::ostream& ) const;
319  void clear();
320 private:
322  mutable Storage logs_;
323 };
324 
325 } //simple_moves
326 } //protocols
327 #endif