Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StepWiseJobParameters.cc
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 StepWiseJobParameters
11 /// @brief Parameters to be passed between different modules of stepwise RNA building.
12 /// @detailed
13 /// @author Rhiju Das
14 
15 
16 //////////////////////////////////
18 #include <core/pose/Pose.hh>
19 #include <ObjexxFCL/FArray1D.hh>
20 
21 #include <string>
22 
23 //Auto Headers
24 #include <utility/vector1.hh>
25 
26 using namespace core;
27 using core::Real;
28 
29 namespace protocols {
30 namespace swa {
31 
32  //////////////////////////////////////////////////////////////////////////////////////////
33  // Constructor
34  StepWiseJobParameters::StepWiseJobParameters():
35  sequence_( "" ),
36  working_sequence_( "" ),
37  which_chain_has_moving_res_( 0 ),
38  gap_size_( 0 ),
39  first_chain_break_res_( 0 ),
40  Is_prepend_( false ),
41  Is_internal_( false )
42  {
43  }
44 
46 
47  //////////////////////////////////////////////////////////////////////////////////////////
49  return sequence_;
50  }
51  //////////////////////////////////////////////////////////////////////////////////////////
53  return working_sequence_;
54  }
55  //////////////////////////////////////////////////////////////////////////////////////////
57  return working_res_list_;
58  }
59  //////////////////////////////////////////////////////////////////////////////////////////
62  }
63  //////////////////////////////////////////////////////////////////////////////////////////
65  return working_bridge_res_;
66  }
67  //////////////////////////////////////////////////////////////////////////////////////////
70  }
71  //////////////////////////////////////////////////////////////////////////////////////////
72  ObjexxFCL::FArray1D< Size > const & StepWiseJobParameters::is_working_res() const{
73  return is_working_res_;
74  }
75  //////////////////////////////////////////////////////////////////////////////////////////
76  ObjexxFCL::FArray1D< Size > const & StepWiseJobParameters::is_moving_res() const{
77  return is_moving_res_;
78  }
79  //////////////////////////////////////////////////////////////////////////////////////////
80  std::map< core::Size, core::Size > & StepWiseJobParameters::full_to_sub(){
81  return full_to_sub_;
82  }
83  //////////////////////////////////////////////////////////////////////////////////////////
84  std::map< core::Size, core::Size > & StepWiseJobParameters::sub_to_full(){
85  return sub_to_full_;
86  }
87  //////////////////////////////////////////////////////////////////////////////////////////
89  return chain_boundaries_;
90  }
91  //////////////////////////////////////////////////////////////////////////////////////////
94  }
95  //////////////////////////////////////////////////////////////////////////////////////////
97  return gap_size_;
98  }
99  //////////////////////////////////////////////////////////////////////////////////////////
101  return first_chain_break_res_;
102  }
103  //////////////////////////////////////////////////////////////////////////////////////////
104  bool const & StepWiseJobParameters::Is_prepend() const{
105  return Is_prepend_;
106  }
107  //////////////////////////////////////////////////////////////////////////////////////////
109  return Is_internal_;
110  }
111  //////////////////////////////////////////////////////////////////////////////////////////
112  ObjexxFCL::FArray1D< bool > const & StepWiseJobParameters::partition_definition() const{
113  return partition_definition_;
114  }
115  //////////////////////////////////////////////////////////////////////////////////////////
117  return working_fixed_res_;
118  }
119  //////////////////////////////////////////////////////////////////////////////////////////
121  return working_terminal_res_;
122  }
123  //////////////////////////////////////////////////////////////////////////////////////////
126  }
127  //////////////////////////////////////////////////////////////////////////////////////////
129  return working_calc_rms_res_;
130  }
131  //////////////////////////////////////////////////////////////////////////////////////////
133  return moving_pos_;
134  }
135  //////////////////////////////////////////////////////////////////////////////////////////
137  sequence_ = setting;
138  }
139  //////////////////////////////////////////////////////////////////////////////////////////
141  working_sequence_ = setting;
142  }
143  //////////////////////////////////////////////////////////////////////////////////////////
145  working_res_list_ = setting;
146  }
147  //////////////////////////////////////////////////////////////////////////////////////////
149  working_moving_res_list_ = setting; //Could just store moving_res internally and full_to_sub map + moving_res to calculate and return working_moving_res when working_moving_res() is called
150  }
151  //////////////////////////////////////////////////////////////////////////////////////////
153  working_moving_suite_list_ = setting;
154  }
155  //////////////////////////////////////////////////////////////////////////////////////////
156  void StepWiseJobParameters::set_is_working_res( ObjexxFCL::FArray1D< Size > const & setting ){
157  is_working_res_ = setting;
158  }
159  //////////////////////////////////////////////////////////////////////////////////////////
160  void StepWiseJobParameters::set_is_moving_res( ObjexxFCL::FArray1D< Size > const & setting ){
161  is_moving_res_ = setting;
162  }
163  //////////////////////////////////////////////////////////////////////////////////////////
164  void StepWiseJobParameters::set_full_to_sub( std::map< core::Size, core::Size > const & setting ){
165  full_to_sub_ = setting;
166  sub_to_full_=create_sub_to_full_map(full_to_sub_); //Parin Jan 18, 2009
167  }
168 
169  //////////////////////////////////////////////////////////////////////////////////////////
170  std::map< core::Size, core::Size > //Parin Jan 18, 2009
171  StepWiseJobParameters::create_sub_to_full_map(std::map< core::Size, core::Size > const & full_to_sub) const{
172 
173  std::map< core::Size, core::Size > ::const_iterator it;
174  std::map< core::Size, core::Size > sub_to_full;
175  sub_to_full.clear();
176 
177  for (it=full_to_sub.begin(); it!=full_to_sub.end(); it++ ){
178  sub_to_full[it->second]=it->first;
179  }
180 
181  //output for debug
182  // std::cout << "full_to_sub" << std::endl;
183  for (it=full_to_sub.begin(); it!=full_to_sub.end(); it++ ){
184  // std::cout << it->first << " => " << it->second << std::endl;
185  }
186 
187  // std::cout << "sub_to_full" << std::endl;
188  for (it=sub_to_full.begin(); it!=sub_to_full.end(); it++ ){
189  // std::cout << it->first << " => " << it->second << std::endl;
190  }
191 
192  return sub_to_full;
193 
194  }
195  //////////////////////////////////////////////////////////////////////////////////////////
198 
200 
201  for ( Size i = 1; i <= working_res_list_.size(); i++ ){
202 
203  Size const & full_seq_pos = working_res_list_[ i ];
204 
205  if ( full_seq_pos == sequence_.size() ) {
206  is_pre_proline.push_back( false );
207  } else {
208  is_pre_proline.push_back( sequence_[ full_seq_pos ] == 'P' ); /*note offset by one -- this is the *next* sequence position*/
209  }
210  }
211 
212  return is_pre_proline;
213  }
214  //////////////////////////////////////////////////////////////////////////////////////////
215  void StepWiseJobParameters::set_chain_boundaries( utility::vector1< std::pair< core::Size, core::Size > > const & setting ){
216  chain_boundaries_ = setting;
217  }
218  //////////////////////////////////////////////////////////////////////////////////////////
220  which_chain_has_moving_res_ = setting;
221  }
222  //////////////////////////////////////////////////////////////////////////////////////////
223  void StepWiseJobParameters::set_gap_size( Size const & setting ){
224  gap_size_ = setting;
225  }
226  //////////////////////////////////////////////////////////////////////////////////////////
228  first_chain_break_res_ = setting;
229  }
230  //////////////////////////////////////////////////////////////////////////////////////////
231  void StepWiseJobParameters::set_Is_prepend( bool const & setting ){
232  Is_prepend_ = setting;
233  }
234  //////////////////////////////////////////////////////////////////////////////////////////
235  void StepWiseJobParameters::set_Is_internal( bool const & setting ){
236  Is_internal_ = setting;
237  }
238  //////////////////////////////////////////////////////////////////////////////////////////
239  void StepWiseJobParameters::set_partition_definition( ObjexxFCL::FArray1D< bool > const & setting ){
240  partition_definition_ = setting;
241  }
242  //////////////////////////////////////////////////////////////////////////////////////////
245  return working_native_pose_;
246  }
247 
248  //////////////////////////////////////////////////////////////////////////////////////////
249  void
251  working_native_pose_ = pose;
252  }
253 
254  //////////////////////////////////////////////////////////////////////////////////////////
255  Size
256  StepWiseJobParameters::actually_moving_res() const{ //Should rewrite code so that there is moving_suite and moving_res......having actually_moving_res is confusing..Parin Jan 30, 2010
257  return ( Is_prepend_ ?
260  }
261  //////////////////////////////////////////////////////////////////////////////////////////
262  void
265  }
266  //////////////////////////////////////////////////////////////////////////////////////////
267  void
270  }
271  //////////////////////////////////////////////////////////////////////////////////////////
272  void
275  }
276  //////////////////////////////////////////////////////////////////////////////////////////
277  void
280  }
281  //////////////////////////////////////////////////////////////////////////////////////////
283  working_bridge_res_ = setting;
284  }
285  //////////////////////////////////////////////////////////////////////////////////////////
286  void
289  }
290 
291  ///////////////////////////////////////////////////////////////////////////////////////////////
294 
295  utility::vector1< core::Size > working_res_vector;
296  for ( Size n = 1; n <= res_vector.size(); n++ ) {
297  if ( !is_working_res_( res_vector[ n ] ) ) continue;
298  working_res_vector.push_back( full_to_sub_[ res_vector[ n ] ]);
299  }
300 
301  return working_res_vector;
302  }
303 
304  ///////////////////////////////////////////////////////////////////////////////////////////////
305  Size
307 
308  std::map<Size,Size>::const_iterator iter = full_to_sub_.find( res );
309  if ( iter == full_to_sub_.end() ) return 0;
310  return iter->second;
311 
312  }
313 
314 
315 
316 
317 }
318 }