Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JumpSetup.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 JumpSetup
11 /// @brief read jump-definition file setups fold tree an chainbreak variants
12 /// loop code didn't work because fold-tree to complicated ( overlapping loops )
13 /// @detailed
14 /// @author Oliver Lange
15 
16 
17 #ifndef INCLUDED_protocols_jumping_JumpSetup_hh
18 #define INCLUDED_protocols_jumping_JumpSetup_hh
19 
20 
21 // Unit Headers
23 
24 // Package Headers
25 //#include <protocols/jumping/PairingLibrary.hh>
27 
28 // Project Headers
29 #include <core/types.hh>
32 
33 #include <core/pose/Pose.fwd.hh>
36 //#include <core/scoring/constraints/ConstraintForest.fwd.hh>
37 
38 
39 // ObjexxFCL Headers
40 #include <ObjexxFCL/FArray1D.hh>
41 #include <ObjexxFCL/FArray2D.hh>
42 
43 // Utility headers
44 // AUTO-REMOVED #include <utility/vector1.hh>
45 #include <utility/pointer/ReferenceCount.hh>
46 
47 //// C++ headers
48 #include <cstdlib>
49 #include <string>
50 
51 #include <utility/vector1.hh>
52 
53 
54 
55 namespace protocols {
56 namespace jumping {
57 
58 
59 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
60 ///@brief two numbers, i.e., jump start end residue, or cut-regions...
61 class Interval {
62 public:
63  Interval() {};
64 
66  start_( start ), end_( end ) {};
67  core::Size start() { return start_; };
68  core::Size stop() { return end_; };
69  core::Size end() { return end_; };
72 };
73 
74 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
75 /// forward declaration
76 class JumpSample;
77 
78 class JumpSetup;
79 
80 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
81 ///@brief virtual base class: can create a set of jumps and cuts
83 public:
84  ///@brief Automatically generated virtual destructor for class deriving directly from ReferenceCount
85  virtual ~BaseJumpSetup();
86  virtual
88  create_jump_sample( ) const = 0;
89 
90  ///@brief returns an ordered FragSet that is compatible with the JumpSample
91  /// default: generate jumps from ss-library according to JumpSample
92  // if the movemap allows sampling of the down-residue but not the up-residue:
93  // include a jump with torsions only for the "down" residue
94  // if the movemap allows neither sampling of up or down, don't include the jump
97 
98  ///@brief take from a given JumpSample only those Jumps, which could also have been created by create_jump_sample()
99  virtual
100  JumpSample clean_jumps( JumpSample const& ) const = 0;
101 
102  virtual std::string type_name() const = 0;
103 
104 };
105 
106 
107 /// @brief output operator
108 std::ostream & operator <<(std::ostream & os, JumpSample const & t);
109 
110 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
111 class JumpSetup : public BaseJumpSetup {
112 public:
113  class JumpDef {
114  public:
115  JumpDef( Interval jump, Interval cut_reg ) :
116  jump_( jump ), cut_reg_ ( cut_reg) { };
117 
118  Interval jump_;
120  };
121 
123  return "JumpSetup";
124  }
125 public:
126 
129 
130  //@brief c'stor
132  total_residue_( total_residue )
133  {};
134 
135  //@brief add a new jump to the list
136  void
137  add_jump ( JumpDef const& jd ) {
138  jumps_.push_back ( jd );
139  jump_sample_ = JumpSample( *this );
140  }
141 
142  void
143  add_jump ( Interval const& jump, Interval const& cut_reg ) {
144  add_jump( JumpDef( jump, cut_reg ) );
145  jump_sample_ = JumpSample( *this );
146  }
147 
148  void
150  add_jump( JumpDef( Interval( js, je ), Interval( crs, cre ) ) );
151  jump_sample_ = JumpSample( *this );
152  }
153 
154  core::Size
155  size() const {
156  return jumps_.size();
157  };
158 
160  begin() const {
161  return jumps_.begin();
162  };
163 
165  end() const {
166  return jumps_.end();
167  };
168 
169  void clear() {
170  jumps_.clear();
171  }
172  void
173  read_file( std::string file );
174 
175  JumpSample
177  { return jump_sample_; }
178 
179  JumpSample
180  clean_jumps( JumpSample const& js ) const
181  {
182  std::cerr << "ERROR: JumpSetup::clean_jumps() not implemented" << std::endl;
183  return js;
184  }
185 
186  void set_jump_sample( JumpSample const& jump_sample ) {
187  jump_sample_ = jump_sample;
188  }
189 
190  core::Size
191  total_residue() const {
192  return total_residue_;
193  }
194 
195 
196 private:
200 };
201 
202 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
204  public:
205 
206  JumpsFromAllPairings( const core::Size total_residue, core::scoring::dssp::PairingsList const& jumps, ObjexxFCL::FArray1D_float const& cut_probability ) : total_residue_(total_residue), jumps_(jumps), cut_prob_(cut_probability) {
207  }
208 
211  }
212 
213  private:
216  ObjexxFCL::FArray1D_float cut_prob_;
217 };
218 
219 
220 //class JumpsFromConstraintForest : public BaseJumpSetup {
221 //public:
222 //
223 // JumpsFromConstraintForest(
224 // const core::Size total_residue,
225 // core::scoring::constraints::ConstraintForestOP forest,
226 // ObjexxFCL::FArray1D_float const& cut_probability );
227 //
228 // JumpSample create_jump_sample() const;
229 // ~JumpsFromConstraintForest();
230 //
231 // /// @brief Unimplemented!
232 // JumpSample
233 // clean_jumps( JumpSample const& js ) const;
234 //
235 //private:
236 // core::Size total_residue_;
237 // core::scoring::constraints::ConstraintForestOP forest_;
238 // ObjexxFCL::FArray1D_float cut_prob_;
239 //};
240 
241 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
242 class JumpSelector : public BaseJumpSetup {
243 public:
244 
246  public:
248  jump_( jump ), weight_( weight) { };
249 
250  Interval jump_;
252  };
253 
255  return "JumpSelector";
256  }
257 
258 public:
260  typedef JumpList::const_iterator const_iterator;
261  typedef JumpList::iterator iterator;
262 
263  JumpSelector();
265  ~JumpSelector();
266 
267  //@brief add a new jump to the list
268  void
269  add_jump ( JumpWeightDef const& jd ) {
270  jumps_.push_back ( jd );
272  }
273 
274  void
275  add_jump ( Interval const& jump, core::Real weight ) {
276  add_jump( JumpWeightDef( jump, weight ) );
277  }
278 
279  void
281  add_jump( JumpWeightDef( Interval( js, je ), weight ) );
282  }
283 
284  core::Size
285  size() const {
286  return jumps_.size();
287  };
288 
290  begin() const {
291  return jumps_.begin();
292  };
293 
295  end() const {
296  return jumps_.end();
297  };
298 
299  void
300  read_file( std::string file );
301 
302  Interval
303  select_random() const;
304 
305  JumpSample
306  create_jump_sample( ) const;
307 
308  JumpSample
309  clean_jumps( JumpSample const& js ) const {
310  std::cerr << "NOT IMPLEMENTED" << std::endl;
311  return js;
312  };
313 
314  void
316  secstruct_ = ss;
317  }
318 
319 private:
324  core::Size min_loop_length_; // minimum length required to introduce cut
325  core::Size loop_extension_; // grow loops at either side ( to consilidate things like LLL..LLL into a single loop-region
328 };
329 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
330 } //jumping
331 } //protocols
332 #endif