Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SegmentSwap.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/build/SegmentSwap.hh
11 /// @brief instruction to swap a segment with an external segment
12 /// @author Yih-En Andrew Ban (yab@u.washington.edu)
13 
14 #ifndef INCLUDED_protocols_forge_build_SegmentSwap_hh
15 #define INCLUDED_protocols_forge_build_SegmentSwap_hh
16 
17 // unit headers
19 
20 // package headers
22 
23 // project headers
26 #include <core/pose/Pose.hh>
27 
28 // C++ headers
29 #include <string>
30 
31 #include <utility/vector1.hh>
32 
33 
34 
35 namespace protocols {
36 namespace forge {
37 namespace build {
38 
39 
40 /// @brief instruction to swap a segment with an external segment
41 class SegmentSwap : public BuildInstruction {
42 
43 
44 private: // typedefs
45 
46 
48 
49 
50 public: // typedefs
51 
52 
53  typedef Super::Size Size;
54 
57  typedef Super::Pose Pose;
58 
61 
63 
64 
65 public: // construct/destruct
66 
67 
68  /// @brief default constructor
69  SegmentSwap();
70 
71 
72  /// @brief constructor
73  /// @param[in] interval swap out this range of residues
74  /// @param[in] move_map fixed backbone residues in this movemap will be used for new jumps
75  /// @param[in] swap_in swap in this pose
77  Interval const & i,
78  MoveMap const & swap_in_movemap,
79  Pose const & swap_in
80  );
81 
82 
83  /// @brief copy constructor
84  SegmentSwap( SegmentSwap const & rval );
85 
86 
87  /// @brief default destructor
88  virtual
89  ~SegmentSwap();
90 
91 
92 public: // assignment
93 
94 
95  /// @brief copy assignment
96  SegmentSwap & operator =( SegmentSwap const & rval );
97 
98 
99 public: // virtual constructors
100 
101 
102  /// @brief clone this object
103  virtual
104  BuildInstructionOP clone() const;
105 
106 
107 public: // accessors
108 
109 
110  /// @brief fixed backbone residues in this movemap will be used for new jumps
111  /// @remarks Procedure will attempt to honor this movemap as much as it can.
112  /// The caveat is that sequences of calls to some FoldTree routines may shift
113  /// the jumps internally in a way that is not easily predictable. If the
114  /// procedure cannot find an allowed residue for a jump, it will make a jump
115  /// to the (lower) median residue in the disconnected fold tree interval.
116  MoveMap const & swap_in_movemap() const;
117 
118 
119  /// @brief the pose to swap in
120  Pose const & swap_in() const;
121 
122 
123 public: // virtual accessors
124 
125 
126  /// @brief is the original interval storing valid information, or is empty
127  /// or being used for something else?
128  /// @return true, stores valid interval
129  inline
130  virtual
131  bool original_interval_valid() const {
132  return true;
133  }
134 
135 
136  /// @brief a copy of the working range of residues specifying the swapped region
137  /// @details This residue range can change wrt length changes in Pose /Conformation
138  /// being watched.
139  virtual
140  Interval interval() const;
141 
142 
143  /// @brief return a copy of the set of positions within the new region
144  /// that were pre-existing in the original Pose prior to modify()
145  /// @return An empty set -- no positions are pre-existing.
146  virtual
148 
149 
150  /// @brief return a copy of the set of positions that are "new" and did
151  /// not exist in the original Pose.
152  /// @return A set of positions spanning the interval -- all positions are
153  /// are defined.
154  virtual
155  Positions new_positions() const;
156 
157 
158  /// @brief return a copy of the set of positions within the newly modified
159  /// region that has a defined conformation. E.g. existing or copied residues.
160  /// @return A set of positions spanning the interval -- all positions are
161  /// are defined.
162  /// @details This set can change wrt length changes in Pose/Conformation being
163  /// watched.
164  virtual
166 
167 
168  /// @brief return a copy of the set of positions within the newly modified
169  /// region that has an undefined conformation. E.g. newly created residues.
170  /// @return An empty set -- no undefined positions.
171  /// @details This set can change wrt length changes in Pose/Conformation being
172  /// watched.
173  virtual
175 
176 
177  /// @brief return a copy of the MoveMap that defines the moveable/fixed
178  /// positions/dofs for this instruction
179  /// @return a MoveMap with [interval.left, interval.right] bb set to false
180  /// at the MoveMapTorsionID level
181  /// @details This set can change wrt length changes in Pose/Conformation being
182  /// watched.
183  virtual
184  MoveMap movemap() const;
185 
186 
187 public: // virtual Conformation observer interface
188 
189 
190  /// @brief update indexing on residue append
191  virtual
192  void on_residue_append( LengthEvent const & event );
193 
194 
195  /// @brief update indexing on residue prepend
196  virtual
197  void on_residue_prepend( LengthEvent const & event );
198 
199 
200  /// @brief update indexing on residue delete
201  virtual
202  void on_residue_delete( LengthEvent const & event );
203 
204 
205 public: // original positions
206 
207 
208  /// @brief return the set of positions within the original interval that
209  /// will be kept in this BuildInstruction
210  /// @return An empty set -- no positions are kept.
211  virtual
213 
214 
215  /// @brief return set of positions within the original interval that will
216  /// be deleted in this BuildInstruction
217  /// @return An empty set -- no positions are deleted.
218  virtual
220 
221 
222 public: // instruction comparison
223 
224 
225  /// @brief return set of any fixed positions necessary with respect to the original
226  /// interval and original Pose numbering
227  /// @remarks Used for ensuring build regions for instructions do not overlap and
228  /// so that jumps may be placed correctly.
229  /// @return empty set if no fixed positions necessary
230  virtual
232 
233 
234  /// @brief return set of any mutable positions necessary with respect to the original
235  /// interval and original Pose numbering
236  /// @remarks Used for ensuring build regions for instructions do not overlap and
237  /// so that jumps may be placed correctly.
238  virtual
240 
241 
242 public: // virtual object descriptor
243 
244 
245  /// @brief does this object create undefined backbone in the modified region?
246  inline
247  virtual
249  return false;
250  }
251 
252 
253 protected: // virtual Pose modification methods
254 
255 
256  /// @brief are dependencies satisfied so that modify_impl() can complete
257  /// successfully?
258  /// @return always True, this BuildInstruction has no dependencies
259  inline
260  virtual
261  bool dependencies_satisfied() const {
262  return true;
263  }
264 
265 
266  /// @brief do the actual work of modifying the Pose
267  virtual
268  void modify_impl( Pose & pose );
269 
270 
271 protected: // virtual mutators
272 
273 
274  /// @brief do the actual reset of intervals, positions, etc to initial state
275  virtual
276  void reset_accounting_impl();
277 
278 
279 private: // init
280 
281 
282  /// @brief init to be called during non-default constructors
283  void init();
284 
285 
286 private: // data
287 
288 
289  /// @brief range of residues to swap out
290  /// @remarks this range can shift if listening to a Pose/Conformation and the number
291  /// of residues changes
293 
294 
295  /// @brief fixed backbone residues in this movemap will be used for new jumps
296  /// @remarks Procedure will attempt to honor this movemap as much as it can.
297  /// The caveat is that sequences of calls to some FoldTree routines may shift
298  /// the jumps internally in a way that is not easily predictable. If the
299  /// procedure cannot find an allowed residue for a jump, it will make a jump
300  /// to the (lower) median residue in the disconnected fold tree interval.
302 
303 
304  /// @brief swap in this Pose
306 
307 
308 };
309 
310 
311 } // namespace build
312 } // namespace forge
313 } // namespace protocols
314 
315 
316 #endif /* INCLUDED_protocols_forge_build_SegmentSwap_HH */