Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ConnectRight.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/ConnectRight.hh
11 /// @brief instruction to connect one Pose onto the right side of another
12 /// @author Yih-En Andrew Ban (yab@u.washington.edu)
13 
14 #ifndef INCLUDED_protocols_forge_build_ConnectRight_hh
15 #define INCLUDED_protocols_forge_build_ConnectRight_hh
16 
17 // unit headers
19 
20 // package headers
22 
23 // project headers
26 #include <core/id/NamedStubID.hh>
27 #include <core/kinematics/RT.hh>
28 #include <core/pose/Pose.hh>
29 
30 // utility headers
31 // AUTO-REMOVED #include <utility/vector1.hh>
32 
33 // C++ headers
34 #include <string>
35 
36 #include <utility/vector1.hh>
37 
38 
39 
40 namespace protocols {
41 namespace forge {
42 namespace build {
43 
44 
45 /// @brief instruction to connect one Pose onto the right side of another
46 /// @details Denote pose_left = [a,b] and pose_right = [c,d] and the newly
47 /// connected pose_left + pose_right = pose_total = [a,d]. If 'b' of
48 /// pose_left is an upper terminus or 'c' of pose_right is a lower terminus,
49 /// then ConnectRight will start a new chain in the Conformation at 'c' when
50 /// constructing pose_total, otherwise it will continue the chain at 'b'.
52 
53 
54 private: // typedefs
55 
56 
58 
59 
60 public: // typedefs
61 
62 
63  typedef Super::Size Size;
64 
68  typedef Super::Pose Pose;
69 
72 
76 
77 
78 public: // construct/destruct
79 
80 
81  /// @brief default constructor
82  ConnectRight();
83 
84 
85  /// @brief position to position jump constructor
86  /// @param[in] left_position connect at this position on 'pose_left'
87  /// passed into modify()
88  /// @param[in] right_position connect at this position on 'pose_right'
89  /// @param[in] pose_right connect this pose to the right of pose_left when
90  /// modify( pose_left ) is called
92  Size const left_position,
93  Size const right_position,
94  Pose const & pose_right
95  );
96 
97 
98  /// @brief copy constructor
99  ConnectRight( ConnectRight const & rval );
100 
101 
102  /// @brief default destructor
103  virtual
104  ~ConnectRight();
105 
106 
107 public: // assignment
108 
109 
110  /// @brief copy assignment
111  ConnectRight & operator =( ConnectRight const & rval );
112 
113 
114 public: // virtual constructors
115 
116 
117  /// @brief clone this object
118  virtual
119  BuildInstructionOP clone() const;
120 
121 
122 public: // accessors
123 
124 
125  /// @brief connect this pose to the right of pose_left when modify( pose_left )
126  /// is called
127  Pose const & pose_right();
128 
129 
130  /// @brief apply the transform over the jump connection between pose_left and
131  /// pose_right? default False
132  inline
133  bool use_rt() const {
134  return use_rt_;
135  }
136 
137 
138  /// @brief Use these atoms to compute the stub on pose_left.
139  /// Default ["CA", "N", "CA", "C"].
140  /// @details This is an array with 4 elements in the same order as Stub
141  /// initialization: 'center atom', 'point1', 'point2', 'point3'. See
142  /// Stub docs for more details.
143  inline
144  AtomNameList const & left_stub_atoms() const {
145  return left_stub_atoms_;
146  }
147 
148 
149  /// @brief Use these atoms to compute the stub on pose_right.
150  /// Default ["CA", "N", "CA", "C"].
151  /// @details This is an array with 4 elements in the same order as Stub
152  /// initialization: 'center atom', 'point1', 'point2', 'point3'. See
153  /// Stub docs for more details.
154  inline
155  AtomNameList const & right_stub_atoms() const {
156  return right_stub_atoms_;
157  }
158 
159 
160  /// @brief the rotation-translation representing an explicit transform from
161  /// the stub on pose_left to the stub on pose_right, i.e. the representation
162  /// of the "jump"
163  inline
164  RT const & rt() {
165  return rt_;
166  }
167 
168 
169 public: // virtual accessors
170 
171 
172  /// @brief is the original interval storing valid information, or is empty
173  /// or being used for something else?
174  /// @return false, stores invalid interval
175  inline
176  virtual
177  bool original_interval_valid() const {
178  return false;
179  }
180 
181 
182  /// @brief a copy of the working range of residues specifying the modified region
183  /// @details before modify() holds [1, pose_right.n_residue()]; after
184  /// modify() holds [1 + pose_left.n_residue(), pose_right.n_residue + pose_left.n_residue()]
185  /// @remarks This can change if listening to Conformation LengthEvents
186  inline
187  virtual
188  Interval interval() const {
189  return interval_;
190  }
191 
192 
193  /// @brief return a copy of the set of positions within the new region
194  /// that were pre-existing in the original Pose prior to modify()
195  /// @return An empty set -- no positions are pre-existing.
196  virtual
198 
199 
200  /// @brief return a copy of the set of positions that are "new" and did
201  /// not exist in the original Pose.
202  /// @return A set spanning the entire interval -- all positions are new.
203  virtual
204  Positions new_positions() const;
205 
206 
207  /// @brief return a copy of the set of positions within the newly modified
208  /// region that has a defined conformation. E.g. existing or copied residues.
209  /// @return A set spanning the entire interval -- all positions are defined.
210  /// @details This set can change wrt length changes in Pose/Conformation being
211  /// watched.
212  virtual
214 
215 
216  /// @brief return a copy of the set of positions within the newly modified
217  /// region that has an undefined conformation. E.g. newly created residues.
218  /// @return An empty set -- no undefined positions.
219  /// @details This set can change wrt length changes in Pose/Conformation being
220  /// watched.
221  virtual
223 
224 
225  /// @brief return a copy of the MoveMap that defines the moveable/fixed
226  /// positions/dofs for this instruction
227  /// @return a MoveMap with [interval.left, interval.right] bb set to false
228  /// at the MoveMapTorsionID level
229  /// @details This set can change wrt length changes in Pose/Conformation being
230  /// watched.
231  virtual
232  MoveMap movemap() const;
233 
234 
235 public: // mutators
236 
237 
238  /// @brief apply the transform over the jump connection between pose_left and
239  /// pose_right? default False
240  inline
241  void use_rt( bool const flag ) {
242  use_rt_ = flag;
243  }
244 
245 
246  /// @brief extract appropriately computed transform between two stubs that
247  /// represent a jump in the given Pose between the two residues and set it
248  /// as the rt for this ConnectRight
249  /// @param[in] pose The Pose to use.
250  /// @param[in] jump_start_residue The starting residue of the jump.
251  /// This residue should be the equivalent of the jump position on pose_left.
252  /// @param[in] jump_stop-residue The stopping residue of the jump.
253  /// This residue should be the equivalent of the jump position on pose_right.
254  /// @remarks Uses left_stub_atoms() and right_stub_atoms() as the stub atoms
255  /// to compute the transform. Remember to set use_rt() to True after
256  /// calling this function if you want to actually use the transform
257  /// during modify().
258  void extract_rt(
259  Pose const & pose,
260  Size const jump_start_residue,
261  Size const jump_stop_residue
262  );
263 
264 
265  /// @brief Use these atoms to compute the stub on pose_left.
266  /// Default ["CA", "N", "CA", "C"].
267  /// @details This is an array with 4 elements in the same order as Stub
268  /// initialization: 'center atom', 'point1', 'point2', 'point3'. See
269  /// Stub docs for more details.
270  inline
271  void left_stub_atoms( AtomNameList const & atoms ) {
272  assert( atoms.size() == 4 );
273  left_stub_atoms_ = atoms;
274  }
275 
276 
277  /// @brief Use these atoms to compute the stub on pose_right.
278  /// Default ["CA", "N", "CA", "C"].
279  /// @details This is an array with 4 elements in the same order as Stub
280  /// initialization: 'center atom', 'point1', 'point2', 'point3'. See
281  /// Stub docs for more details.
282  inline
283  void right_stub_atoms( AtomNameList const & atoms ) {
284  assert( atoms.size() == 4 );
285  right_stub_atoms_ = atoms;
286  }
287 
288 
289  /// @brief the rotation-translation representing an explicit transform from
290  /// the stub on pose_left to the stub on pose_right, i.e. the representation
291  /// of the "jump"
292  inline
293  void rt( RT const & transform ) {
294  rt_ = transform;
295  }
296 
297 
298 public: // virtual Conformation observer interface
299 
300 
301  /// @brief update indexing on residue append
302  virtual
303  void on_residue_append( LengthEvent const & event );
304 
305 
306  /// @brief update indexing on residue prepend
307  virtual
308  void on_residue_prepend( LengthEvent const & event );
309 
310 
311  /// @brief update indexing on residue delete
312  virtual
313  void on_residue_delete( LengthEvent const & event );
314 
315 
316 public: // original positions
317 
318 
319  /// @brief return the set of positions within the original interval that
320  /// will be kept in this BuildInstruction
321  /// @return An empty set -- no positions are kept.
322  virtual
324 
325 
326  /// @brief return set of positions within the original interval that will
327  /// be deleted in this BuildInstruction
328  /// @return An empty set -- no positions are deleted.
329  virtual
331 
332 
333 public: // instruction comparison
334 
335 
336  /// @brief return set of any fixed positions necessary with respect to the original
337  /// interval and original Pose numbering
338  /// @remarks Used for ensuring build regions for instructions do not overlap and
339  /// so that jumps may be placed correctly.
340  /// @return empty set if no fixed positions
341  virtual
343 
344 
345  /// @brief return set of any mutable positions necessary with respect to the original
346  /// interval and original Pose numbering
347  /// @remarks Used for ensuring build regions for instructions do not overlap and
348  /// so that jumps may be placed correctly.
349  /// @return empty set if no mutable positions
350  virtual
352 
353 
354 public: // virtual object descriptor
355 
356 
357  /// @brief does this object create undefined backbone in the modified region?
358  /// @return false
359  inline
360  virtual
362  return false;
363  }
364 
365 
366 protected: // virtual Pose modification methods
367 
368 
369  /// @brief are dependencies satisfied so that modify_impl() can complete
370  /// successfully?
371  /// @return always True, this BuildInstruction has no dependencies
372  inline
373  virtual
374  bool dependencies_satisfied() const {
375  return true;
376  }
377 
378 
379  /// @brief do the actual work of modifying the Pose
380  virtual
381  void modify_impl( Pose & pose_left );
382 
383 
384 protected: // accessors
385 
386 
387  /// @brief connect at this position on 'pose_left' passed into modify()
388  /// @remarks this position can shift if listening to a Pose/Conformation and the number
389  /// of residues changes
390  inline
391  Size left_position() const {
392  return left_position_;
393  }
394 
395 
396  /// @brief connect at this position on 'pose_right'
397  inline
399  return right_position_;
400  }
401 
402 
403  /// @brief generate the NamedStubID for the left stub atoms on position 'p'
404  inline
406  return NamedStubID( left_stub_atoms_, p );
407  }
408 
409 
410  /// @brief generate the NamedStubID for the left right atoms on position 'p'
411  inline
413  return NamedStubID( right_stub_atoms_, p );
414  }
415 
416 
417 protected: // mutators
418 
419 
420  /// @brief connect at this position on 'pose_left' passed into modify()
421  /// @remarks this position can shift if listening to a Pose/Conformation and the number
422  /// of residues changes
423  inline
424  void left_position( Size const i ) {
425  left_position_ = i;
426  }
427 
428 
429  /// @brief connect at this position on 'pose_right'
430  inline
431  void right_position( Size const i ) {
432  right_position_ = i;
433  }
434 
435 
436 protected: // virtual mutators
437 
438 
439  /// @brief do the actual reset of intervals, positions, etc to initial state
440  virtual
441  void reset_accounting_impl();
442 
443 
444 private: // initialization
445 
446 
447  /// @brief initialization on construction
448  void init();
449 
450 
451 private: // data
452 
453 
454  /// @brief connect at this position on 'pose_left' passed into modify()
455  /// @remarks this position can shift if listening to a Pose/Conformation and the number
456  /// of residues changes
458 
459 
460  /// @brief connect at this position on 'pose_right'
461  /// @remarks this position can shift if listening to a Pose/Conformation and the number
462  /// of residues changes
464 
465 
466  /// @brief connect this pose to the right of pose_left when modify( pose_left ) is called
468 
469 
470  /// @brief apply the transform over the jump connection between pose_left and
471  /// pose_right? default False
472  bool use_rt_;
473 
474 
475  /// @brief Use these atoms to compute the stub on pose_left.
476  /// Default ["CA", "N", "CA", "C"].
477  /// @details This is an array with 4 elements in the same order as Stub
478  /// initialization: 'center atom', 'point1', 'point2', 'point3'. See
479  /// Stub docs for more details.
481 
482 
483  /// @brief Use these atoms to compute the stub on pose_right.
484  /// Default ["CA", "N", "CA", "C"].
485  /// @details This is an array with 4 elements in the same order as Stub
486  /// initialization: 'center atom', 'point1', 'point2', 'point3'. See
487  /// Stub docs for more details.
489 
490 
491  /// @brief the rotation-translation representing an explicit transform from
492  /// the stub on pose_left to the stub on pose_right, i.e. the representation
493  /// of the "jump"
495 
496 
497  /// @brief tracks the numbering of the new region specifying the connected Pose
498  /// @details before modify_impl() holds [1, pose_right.n_residue()]; after
499  /// modify holds [1 + pose_left.n_residue(), pose_right.n_residue + pose_left.n_residue()]
501 
502 
503 };
504 
505 
506 } // namespace build
507 } // namespace forge
508 } // namespace protocols
509 
510 
511 #endif /* INCLUDED_protocols_forge_build_ConnectRight_HH */