Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SegmentInsert.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/SegmentInsert.hh
11 /// @brief insert an external segment flanked by new regions
12 /// @author Yih-En Andrew Ban (yab@u.washington.edu)
13 
14 #ifndef INCLUDED_protocols_forge_build_SegmentInsert_hh
15 #define INCLUDED_protocols_forge_build_SegmentInsert_hh
16 
17 // unit headers
19 
20 // package headers
22 
23 // project headers
25 #include <core/pose/Pose.hh>
26 
27 #include <utility/vector1.hh>
28 
29 
30 
31 namespace protocols {
32 namespace forge {
33 namespace build {
34 
35 
36 // description namespace to hold enum
37 namespace SegmentInsertConnectionScheme {
38  /// @brief connect insertion on its N-side, C-side, or decide randomly
39  /// between the two
40  enum Enum {
42  N,
43  C
44  };
45 }
46 
47 
48 /// @brief insert an external segment flanked by new regions
49 /// @remarks Similar to SegmentRebuild, but with the addition of a defined
50 /// segment located in the modified region.
52 
53 
54 private: // typedefs
55 
56 
58 
59 
60 public: // typedefs
61 
62 
63  typedef Super::Size Size;
64  typedef Super::Real Real;
65 
69  typedef Super::Pose Pose;
70 
73 
74 
75 public: // construct/destruct
76 
77 
78  /// @brief default constructor
79  SegmentInsert();
80 
81 
82  /// @brief sec.struct only constructor (poly-ala for flanking regions)
83  /// @param[in] interval The interval between which the insert will span.
84  /// To perform a pure insertion without replacing any residues
85  /// within a region, use an interval with a zero as the left endpoint, e.g.
86  /// [0, insert_after_this_residue]. If inserting before the first residue
87  /// of the Pose then interval = [0,0]. If inserting after the last residue
88  /// of the Pose then interval = [0, last_residue].
89  /// @param[in] ss The secondary structure specifying the flanking regions,
90  /// with a character '^' specifying where the insert is to be placed.
91  /// @param[in] insert The Pose to insert.
92  /// @param[in] keep_known_bb_torsions_at_junctions Attempt to keep the omega
93  /// at original_interval().left-1, the phi at original_interval().left, and
94  /// the psi+omega at original_interval().right present from the original Pose
95  /// in the modified Pose. This should be false for pure insertions.
96  /// @param[in] connection_scheme Connect insertion on its N-side, C-side,
97  /// or decide randomly between the two (default RANDOM).
99  Interval const & i,
100  String const & ss,
101  Pose const & insert,
102  bool const keep_known_bb_torsions_at_junctions = false,
104  );
105 
106 
107  /// @brief sec.struct + aa constructor
108  /// @param[in] interval The interval between which the insert will span.
109  /// To perform a pure insertion without replacing any residues
110  /// within a region, use an interval with a zero as the left endpoint, e.g.
111  /// [0, insert_after_this_residue]. If inserting before the first residue
112  /// of the Pose then interval = [0,0]. If inserting after the last residue
113  /// of the Pose then interval = [0, last_residue].
114  /// @param[in] ss The secondary structure specifying the flanking regions,
115  /// with a character '^' specifying where the insert is to be placed.
116  /// @param[in] aa The annotated amino acid string specifying the flanking
117  /// regions, with a character '^' specifying where the insert is to be
118  /// placed.
119  /// @param[in] insert The Pose to insert.
120  /// @param[in] keep_known_bb_torsions_at_junctions Attempt to keep the omega
121  /// at original_interval().left-1, the phi at original_interval().left, and
122  /// the psi+omega at original_interval().right present from the original Pose
123  /// in the modified Pose. This should be false for pure insertions.
124  /// @param[in] connection_scheme Connect insertion on its N-side, C-side,
125  /// or decide randomly between the two (default RANDOM).
126  /// @remarks length of the *one-letter* aa must equal the length of ss
128  Interval const & i,
129  String const & ss,
130  String const & aa,
131  Pose const & insert,
132  bool const keep_known_bb_torsions_at_junctions = false,
134  );
135 
136 
137  /// @brief copy constructor
138  SegmentInsert( SegmentInsert const & rval );
139 
140 
141  /// @brief default destructor
142  virtual
143  ~SegmentInsert();
144 
145 
146 public: // assignment
147 
148 
149  /// @brief copy assignment
150  SegmentInsert & operator =( SegmentInsert const & rval );
151 
152 
153 public: // virtual constructors
154 
155 
156  /// @brief clone this object
157  virtual
158  BuildInstructionOP clone() const;
159 
160 
161 public: // accessors
162 
163 
164  /// @brief the character representing the insertion point
165  /// @return '^'
166  inline
167  static
168  char insertion_char() {
169  return '^';
170  }
171 
172 
173  /// @brief performing a pure insertion/extension?
174  /// @return True if SegmentInsert was initialized with an interval whose
175  /// left endpoint == 0, False otherwise.
176  inline
178  return original_interval().left == 0;
179  }
180 
181 
182  /// @brief Attempt to keep the phi at original_interval().left and the psi+omega
183  /// at original_interval().right present from the original Pose in the modified
184  /// Pose? Not applicable for pure insertions. Default False.
185  inline
188  }
189 
190 
191  /// @brief the pose to insert
192  Pose const & insert_pose() const;
193 
194 
195  /// @brief get secondary structure string (includes insertion point as '^')
196  inline
197  String const & ss() const {
198  return ss_;
199  }
200 
201 
202  /// @brief get annotated amino acid string (includes insertion point as '^')
203  inline
204  String const & aa() const {
205  return aa_;
206  }
207 
208 
209  /// @brief get the insert connection scheme -- whether the insertion will
210  /// be glued on the N-side, C-side, or if SegmentInsert will pick randomly
211  /// between the two
212  inline
215  }
216 
217 
218  /// @brief get the absolute index of the insertion point with respect to the
219  /// flanking regions (i.e. the index inside the ss string)
221 
222 
223  /// @brief get the residue at the start of the insertion relative to the
224  /// modified interval (flanking positions are not part of the insertion!)
226 
227 
228  /// @brief get the residue at the end of the insertion relative to the
229  /// modified interval (flanking positions are not part of the insertion!)
230  Size insertion_end_residue() const;
231 
232 
233  /// @brief get the number of flanking residues to the left of the insertion
234  /// point
235  Size flanking_left_nres() const;
236 
237 
238  /// @brief get the number of flanking residues to the right of the insertion
239  /// point
240  Size flanking_right_nres() const;
241 
242 
243  /// @brief get the ss string of the flanking residues to the left of the
244  /// insertion point
245  String flanking_left_ss() const;
246 
247 
248  /// @brief get the ss string of the flanking residues to the right of the
249  /// insertion point
250  String flanking_right_ss() const;
251 
252 
253  /// @brief get the annotated aa string of the flanking residues to the left
254  /// of the insertion point
255  String flanking_left_aa() const;
256 
257 
258  /// @brief get the annotated aa string of the flanking residues to the right
259  /// of the insertion point
260  String flanking_right_aa() const;
261 
262 
263  /// @brief a torsion (bb/chi) specific override movemap indexed wrt the insert Pose
264  /// (residue indices may only be within the range [1, insert_pose.n_residue()]
265  /// @remarks When generating the movemap(), this torsion movemap will be enforced.
266  /// Only *explicit* settings of TorsionType, MoveMapTorsionID, and TorsionID will
267  /// be honored. Implicit false settings are ignored.
268  inline
271  }
272 
273 
274 public: // virtual accessors
275 
276 
277  /// @brief is the original interval storing valid information, or is empty
278  /// or being used for something else?
279  /// @return always false, original interval invalid
280  inline
281  virtual
282  bool original_interval_valid() const {
283  return false;
284  }
285 
286 
287  /// @brief a copy of the working range of residues specifying the modified region
288  /// @details This residue range can change wrt length changes in Pose /Conformation
289  /// being watched.
290  virtual
291  Interval interval() const;
292 
293 
294  /// @brief return a copy of the set of positions within the new region
295  /// that were pre-existing in the original Pose prior to modify()
296  /// @return An empty set, there are no pre-existing positions.
297  virtual
299 
300 
301  /// @brief return a copy of the set of positions that are "new" and did
302  /// not exist in the original Pose.
303  virtual
304  Positions new_positions() const;
305 
306 
307  /// @brief return a copy of the set of positions within the newly modified
308  /// region that has a defined conformation. E.g. existing or copied residues.
309  /// @details This set can change wrt length changes in Pose/Conformation being
310  /// watched.
311  virtual
313 
314 
315  /// @brief return a copy of the set of positions within the newly modified
316  /// region that has an undefined conformation. E.g. newly created residues.
317  /// @details This set can change wrt length changes in Pose/Conformation being
318  /// watched.
319  virtual
321 
322 
323  /// @brief return a copy of the MoveMap that defines the moveable/fixed
324  /// positions/dofs for this instruction
325  /// @return TO BE FILLED IN
326  /// @details This set can change wrt length changes in Pose/Conformation being
327  /// watched.
328  virtual
329  MoveMap movemap() const;
330 
331 
332 public: // mutators
333 
334 
335  /// @brief set a torsion (bb/chi) specific override movemap indexed wrt the insert
336  /// Pose (residue indices may only be within the range [1, insert_pose.n_residue()]
337  /// @remarks When generating the movemap(), this torsion movemap will be enforced.
338  /// Only *explicit* settings of TorsionType, MoveMapTorsionID, and TorsionID will
339  /// be honored. Implicit false settings are ignored.
341 
342 
343 public: // virtual Conformation observer interface
344 
345 
346  /// @brief update indexing on residue append
347  virtual
348  void on_residue_append( LengthEvent const & event );
349 
350 
351  /// @brief update indexing on residue prepend
352  virtual
353  void on_residue_prepend( LengthEvent const & event );
354 
355 
356  /// @brief update indexing on residue delete
357  virtual
358  void on_residue_delete( LengthEvent const & event );
359 
360 
361 public: // original positions
362 
363 
364  /// @brief return the set of positions within the original interval that
365  /// will be kept in this BuildInstruction
366  /// @return An empty set -- no positions are kept.
367  virtual
369 
370 
371  /// @brief return set of positions within the original interval that will
372  /// be deleted in this BuildInstruction
373  virtual
375 
376 
377 public: // instruction comparison
378 
379 
380  /// @brief return set of any fixed positions necessary with respect to the original
381  /// interval and original Pose numbering
382  /// @remarks Used for ensuring build regions for instructions do not overlap and
383  /// so that jumps may be placed correctly.
384  /// @return empty set if no fixed positions necessary
385  virtual
387 
388 
389  /// @brief return set of any mutable positions necessary with respect to the original
390  /// interval and original Pose numbering
391  /// @remarks Used for ensuring build regions for instructions do not overlap and
392  /// so that jumps may be placed correctly.
393  virtual
395 
396 
397 public: // virtual object descriptor
398 
399 
400  /// @brief does this object create undefined backbone in the modified region?
401  inline
402  virtual
404  return true;
405  }
406 
407 
408 protected: // virtual Pose modification methods
409 
410 
411  /// @brief are dependencies satisfied so that modify_impl() can complete
412  /// successfully?
413  /// @return always True, this BuildInstruction has no dependencies
414  inline
415  virtual
416  bool dependencies_satisfied() const {
417  return true;
418  }
419 
420 
421  /// @brief do the actual work of modifying the Pose
422  virtual
423  void modify_impl( Pose & pose );
424 
425 
426 protected: // virtual mutators
427 
428 
429  /// @brief do the actual reset of intervals, positions, etc to initial state
430  virtual
431  void reset_accounting_impl();
432 
433 
434 private: // initialization
435 
436 
437  /// @brief init to be called during non-default constructors
438  void init();
439 
440 
441 private: // data
442 
443 
444  /// @brief the working range of residues
445  /// @remarks this range can shift if listening to a Pose/Conformation and the number
446  /// of residues changes
448 
449 
450  /// @brief secondary structure string defining the flanking regions and the
451  /// insertion point
452  /// @details The insertion point is marked as '^'. For instance, "L^LLL"
453  /// means one residue to the left of the insertion point and three residues
454  /// to the right of the insertion point.
456 
457 
458  /// @brief annotated amino acid string including the insertion point
459  /// @details Length of the one-letter version must be equal to length of ss.
460  /// The insertion point must exist in the same spot as the insertion point in
461  /// secondary structure string.
463 
464 
465  /// @brief Attempt to keep the omega at original_interval().left-1, the phi
466  /// at original_interval().left and the psi+omega at original_interval().right
467  /// present from the original Pose in the modified Pose? This should be
468  /// false for pure insertions.
469  /// @details If True, during modify(), will (1) set the omega of interval_.left-1
470  /// in the newly modified Pose equal to the omega of the original Pose at
471  /// original_interval().left-1, (2) set the phi of interval_.left in
472  /// the newly modified Pose equal to the phi of the original Pose in
473  /// original_interval().right, and (3) set the psi+omega of interval_.right
474  /// in the newly modified Pose equal to the original psi+omega of
475  /// original_interval().right. Default False.
477 
478 
479  /// @brief connect insertion on its N-side, C-side, or decide randomly
480  /// between the two (default RANDOM_SIDE)
482 
483 
484  /// @brief insert this Pose
486 
487 
488  /// @brief a torsion (bb/chi) specific override movemap indexed wrt the insert Pose
489  /// (residue indices may only be within the range [1, insert_pose.n_residue()]
490  /// @remarks When generating the movemap(), this torsion movemap will be enforced.
491  /// Only *explicit* settings of TorsionType, MoveMapTorsionID, and TorsionID will
492  /// be honored. Implicit false settings are ignored.
494 
495 
496 };
497 
498 
499 } // namespace build
500 } // namespace forge
501 } // namespace protocols
502 
503 
504 #endif /* INCLUDED_protocols_forge_build_SegmentInsert_HH */