Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StepWiseRNA_JobParameters.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 StepWiseRNA_JobParameters
11 /// @brief Parameters to be passed between different modules of stepwise RNA building.
12 /// @detailed
13 /// @author Rhiju Das
14 
15 
16 //////////////////////////////////
20 
21 #include <core/pose/Pose.hh>
22 #include <ObjexxFCL/FArray1D.hh>
23 #include <ObjexxFCL/string.functions.hh>
24 
25 #include <string>
26 
27 using namespace core;
28 using core::Real;
29 
30 namespace protocols {
31 namespace swa {
32 namespace rna {
33 
34  //////////////////////////////////////////////////////////////////////////////////////////
35  // Constructor
36  StepWiseRNA_JobParameters::StepWiseRNA_JobParameters():
37  output_extra_RMSDs_(false),
38  Is_simple_full_length_job_params_(false),
39  full_sequence_( "" ),
40  working_sequence_( "" ),
41  moving_res_( 0 ),
42  working_moving_res_( 0 ),
43  working_moving_suite_( 0 ),
44  //which_chain_has_moving_res_( 0 ),
45  gap_size_( 0 ),
46  five_prime_chain_break_res_( 0 ),
47  Is_prepend_( false ),
48  Is_internal_( false ),
49  add_virt_res_as_root_( false )
50  {
51 
52  //These vectors and map should be empty to begin with, but not harm to ensure this.
53  is_working_res_.clear();
56  full_to_sub_.clear();
57  sub_to_full_.clear();
58  Is_prepend_map_.clear();
59  chain_boundaries_.clear();
60  partition_definition_.clear();
61  working_fixed_res_.clear();
62  rmsd_res_list_.clear();
63  working_terminal_res_.clear();
65  fold_tree_.clear();
66  input_res_vectors_.clear();
67  cutpoint_closed_list_.clear();
69  native_alignment_.clear();
81  }
82 
84 
85  //////////////////////////////////////////////////////////////////////////////////////////
87  return output_extra_RMSDs_;
88  }
89  ///////////////////////////////////////////////////////////////////////////////////////
92  }
93  ///////////////////////////////////////////////////////////////////////////////////////
95 
96  if(full_sequence_.size()==0) utility_exit_with_message( "full_sequence_.size()==0" );
97  return full_sequence_;
98  }
99  //////////////////////////////////////////////////////////////////////////////////////////
101 
102  if(working_sequence_.size()==0) utility_exit_with_message( "working_sequence_.size()==0" );
103  return working_sequence_;
104  }
105  //////////////////////////////////////////////////////////////////////////////////////////
107  return moving_res_;
108  }
109  //////////////////////////////////////////////////////////////////////////////////////////
111  return working_moving_res_;
112  }
113  //////////////////////////////////////////////////////////////////////////////////////////
115  if(working_moving_res_list_.size()==0) utility_exit_with_message("working_moving_res_list_.size()==0");
117  }
118  //////////////////////////////////////////////////////////////////////////////////////////
119  Size StepWiseRNA_JobParameters::working_reference_res() const{ //the last static_residues that this attach to the moving residues
120 
121  Size const num_nucleotides=working_moving_res_list_.size();
122 
123  //check that moving_res_ and working_moving_res_list list are intialized (note this is not foolproof)
124  if(num_nucleotides==0) utility_exit_with_message( "num_building_nucleotides==0!!" );
125  if(working_moving_res_==0) utility_exit_with_message( "working_moving_res_==0!!" );
126 
127 
128  Size const working_reference_res_ = (Is_prepend_) ? working_moving_res_ + num_nucleotides : working_moving_res_ - num_nucleotides;
129 
130  return working_reference_res_;
131  }
132  //////////////////////////////////////////////////////////////////////////////////////////
134  return working_moving_suite_;
135  }
136  //////////////////////////////////////////////////////////////////////////////////////////
138  if(working_moving_suite_list_.size()==0) utility_exit_with_message("working_moving_suite_list_.size()==0");
140  }
141  //////////////////////////////////////////////////////////////////////////////////////////
143  if(is_working_res_.size()==0) utility_exit_with_message("is_working_res_.size()==0");
144  return is_working_res_;
145  }
146  //////////////////////////////////////////////////////////////////////////////////////////
147  std::map< core::Size, core::Size > & StepWiseRNA_JobParameters::full_to_sub(){
148  if(full_to_sub_.size()==0) utility_exit_with_message("full_to_sub_.size()==0");
149  return full_to_sub_;
150  }
151  //////////////////////////////////////////////////////////////////////////////////////////
152  std::map< core::Size, core::Size > & StepWiseRNA_JobParameters::sub_to_full(){
153  if(sub_to_full_.size()==0) utility_exit_with_message("sub_to_full_.size()==0");
154  return sub_to_full_;
155  }
156  //////////////////////////////////////////////////////////////////////////////////////////
157  std::map< core::Size, core::Size > const & StepWiseRNA_JobParameters::const_full_to_sub() const{
158  if(full_to_sub_.size()==0) utility_exit_with_message("full_to_sub_.size()==0");
159  return full_to_sub_;
160  }
161  //////////////////////////////////////////////////////////////////////////////////////////
162  std::map< core::Size, core::Size > const & StepWiseRNA_JobParameters::const_sub_to_full() const{
163  if(sub_to_full_.size()==0) utility_exit_with_message("sub_to_full_.size()==0");
164  return sub_to_full_;
165  }
166  //////////////////////////////////////////////////////////////////////////////////////////
168  if(fold_tree_.size()==0) utility_exit_with_message("fold_tree_.size()==0"); //Thie is the number of edge. simple_tree have 1 edge!
169  return fold_tree_;
170  }
171  //////////////////////////////////////////////////////////////////////////////////////////
172  std::map< core::Size, bool > const & StepWiseRNA_JobParameters::Is_prepend_map() const {
173  if(Is_prepend_map_.size()==0) utility_exit_with_message("Is_prepend_map_.size()==0");
174  return Is_prepend_map_;
175  }
176  //////////////////////////////////////////////////////////////////////////////////////////
178  return chain_boundaries_;
179  }
180  //////////////////////////////////////////////////////////////////////////////////////////
181  //Size const & StepWiseRNA_JobParameters::which_chain_has_moving_res() const{
182  // return which_chain_has_moving_res_;
183  //}
184  //////////////////////////////////////////////////////////////////////////////////////////
186  return gap_size_;
187  }
188  //////////////////////////////////////////////////////////////////////////////////////////
191  }
192  //////////////////////////////////////////////////////////////////////////////////////////
194  return Is_prepend_;
195  }
196  //////////////////////////////////////////////////////////////////////////////////////////
198  return Is_internal_;
199  }
200  //////////////////////////////////////////////////////////////////////////////////////////
202  return add_virt_res_as_root_;
203  }
204  //////////////////////////////////////////////////////////////////////////////////////////
205  ObjexxFCL::FArray1D< bool > const & StepWiseRNA_JobParameters::partition_definition() const{
206  if(partition_definition_.size()==0) utility_exit_with_message("partition_definition_.size()==0!");
207  return partition_definition_;
208  }
209  //////////////////////////////////////////////////////////////////////////////////////////
211  return working_fixed_res_;
212  }
213  //////////////////////////////////////////////////////////////////////////////////////////
215  if(rmsd_res_list_.size()==0) utility_exit_with_message("rmsd_res_list_.size()==0");
216  return rmsd_res_list_;
217  }
218  //////////////////////////////////////////////////////////////////////////////////////////
220  return working_terminal_res_;
221  }
222  //////////////////////////////////////////////////////////////////////////////////////////
225  }
226  //////////////////////////////////////////////////////////////////////////////////////////
228  if(input_res_vectors_.size()==0) utility_exit_with_message("input_res_vectors_.size()==0");
229  return input_res_vectors_;
230  }
231  //////////////////////////////////////////////////////////////////////////////////////////
233  return cutpoint_closed_list_;
234  }
235  //////////////////////////////////////////////////////////////////////////////////////////
237 
238  if(working_best_alignment_.size()==0) utility_exit_with_message("working_best_alignment_.size()==0!");
239 
241  }
242  //////////////////////////////////////////////////////////////////////////////////////////
244  return native_alignment_;
245  }
246  //////////////////////////////////////////////////////////////////////////////////////////
249  }
250 
251  //////////////////////////////////////////////////////////////////////////////////////////
254  }
255  //////////////////////////////////////////////////////////////////////////////////////////
258  }
259  //////////////////////////////////////////////////////////////////////////////////////////
262  }
263  //////////////////////////////////////////////////////////////////////////////////////////
266  }
267  //////////////////////////////////////////////////////////////////////////////////////////
270  }
271  //////////////////////////////////////////////////////////////////////////////////////////
274  }
275  //////////////////////////////////////////////////////////////////////////////////////////
278  }
279  //////////////////////////////////////////////////////////////////////////////////////////
282  }
283  //////////////////////////////////////////////////////////////////////////////////////////
286  }
287  //////////////////////////////////////////////////////////////////////////////////////////
290  }
291  //////////////////////////////////////////////////////////////////////////////////////////
293  output_extra_RMSDs_=setting;
294  }
295  //////////////////////////////////////////////////////////////////////////////////////////
296  void StepWiseRNA_JobParameters::set_Is_simple_full_length_job_params( bool const & setting ){ //Oct 31, 2011
298  }
299  //////////////////////////////////////////////////////////////////////////////////////////
301  full_sequence_ = setting;
302 
304 
305  std::cout << "full_sequence_= " << full_sequence_ << std::endl;
306  std::cout << "working_sequence_= " << working_sequence_ << std::endl;
307 
308  }
309 
310  //////////////////////////////////////////////////////////////////////////////////////////
312  moving_res_ = setting;
313  }
314  //////////////////////////////////////////////////////////////////////////////////////////
316  working_moving_res_list_ = setting;
318 
319  update_working_moving_suite(); //Be careful..currently when working_moving_res_list is first initialize in JP_Setup, Is_Prepend is not setup yet.
320  }
321 
322 
323 
324  //////////////////////////////////////////////////////////////////////////////////////////
325  //void StepWiseRNA_JobParameters::set_working_moving_res( Size const & setting ){
326  // working_moving_res_ = setting;
327  //}
328  //////////////////////////////////////////////////////////////////////////////////////////
329  //void StepWiseRNA_JobParameters::set_working_moving_suite_list( utility::vector1< Size > const & setting ){
330  // working_moving_suite_list_ = setting;
331  //}
332  ////////////////////////////////////////////////////////////////////////////////////////////
333  //void StepWiseRNA_JobParameters::set_working_moving_suite( Size const & setting ){
334  // working_moving_suite_ = setting;
335  //}
336  //////////////////////////////////////////////////////////////////////////////////////////
338  is_working_res_ = setting;
339 
341  }
342  //////////////////////////////////////////////////////////////////////////////////////////
343  void StepWiseRNA_JobParameters::set_full_to_sub( std::map< core::Size, core::Size > const & setting ){
344  full_to_sub_ = setting;
345  sub_to_full_=create_sub_to_full_map(full_to_sub_); //Parin Jan 18, 2009
346  }
347 
348  //////////////////////////////////////////////////////////////////////////////////////////
350  fold_tree_=setting;
351  }
352  //////////////////////////////////////////////////////////////////////////////////////////
353  void StepWiseRNA_JobParameters::set_Is_prepend_map( std::map< core::Size, bool > const & setting ){
354  Is_prepend_map_ = setting;
355  }
356  //////////////////////////////////////////////////////////////////////////////////////////
357  void StepWiseRNA_JobParameters::set_chain_boundaries( utility::vector1< std::pair< core::Size, core::Size > > const & setting ){
358  chain_boundaries_ = setting;
359  }
360  //////////////////////////////////////////////////////////////////////////////////////////
361  //void StepWiseRNA_JobParameters::set_which_chain_has_moving_res( Size const & setting ){
362  // which_chain_has_moving_res_ = setting;
363  //}
364  //////////////////////////////////////////////////////////////////////////////////////////
366  gap_size_ = setting;
367  }
368  //////////////////////////////////////////////////////////////////////////////////////////
370  five_prime_chain_break_res_ = setting;
371  }
372  //////////////////////////////////////////////////////////////////////////////////////////
373  void StepWiseRNA_JobParameters::set_Is_prepend( bool const & setting ){
374  Is_prepend_ = setting;
376  }
377  //////////////////////////////////////////////////////////////////////////////////////////
378  void StepWiseRNA_JobParameters::set_Is_internal( bool const & setting ){
379  Is_internal_ = setting;
380  }
381  //////////////////////////////////////////////////////////////////////////////////////////
382  void StepWiseRNA_JobParameters::set_partition_definition( ObjexxFCL::FArray1D< bool > const & setting ){
383  partition_definition_ = setting;
384  }
385  //////////////////////////////////////////////////////////////////////////////////////////
388  return working_native_pose_;
389  }
390 
391  //////////////////////////////////////////////////////////////////////////////////////////
392  void
394  working_native_pose_ = pose;
395  }
396 
397  //////////////////////////////////////////////////////////////////////////////////////////
398  Size
400  return working_moving_res_;
401 
402  }
403  //////////////////////////////////////////////////////////////////////////////////////////
404  void
407  }
408  //////////////////////////////////////////////////////////////////////////////////////////
409  void
413  }
414  //////////////////////////////////////////////////////////////////////////////////////////
415  void
418  }
419  //////////////////////////////////////////////////////////////////////////////////////////
420  void
423  }
424  //////////////////////////////////////////////////////////////////////////////////////////
425  void
427  input_res_vectors_=setting;
428  }
429  //////////////////////////////////////////////////////////////////////////////////////////
430  void
432  cutpoint_closed_list_= setting;
433  }
434  //////////////////////////////////////////////////////////////////////////////////////////
435  void
437  working_best_alignment_=setting;
438  }
439  //////////////////////////////////////////////////////////////////////////////////////////
440  void
442  native_alignment_=setting;
443  }
444  //////////////////////////////////////////////////////////////////////////////////////////
445  void
448  }
449 
450  //////////////////////////////////////////////////////////////////////////////////////////
451  void
453  global_sample_res_list_=setting;
455 
456  }
457  //////////////////////////////////////////////////////////////////////////////////////////
458  void
460  force_syn_chi_res_list_=setting;
462  }
463  //////////////////////////////////////////////////////////////////////////////////////////
464  void
466  force_north_ribose_list_=setting;
468 
469  for(Size n=1; n<=force_north_ribose_list_.size(); n++){
471  utility_exit_with_message("seq_num= " + ObjexxFCL::string_of(force_north_ribose_list_[n]) + " is in both force_north_ribose_list_ and force_south_ribose_list_! " );
472  }
473  }
474  }
475  //////////////////////////////////////////////////////////////////////////////////////////
476  void
478  force_south_ribose_list_=setting;
480 
481  for(Size n=1; n<=force_north_ribose_list_.size(); n++){
483  utility_exit_with_message("seq_num= " + ObjexxFCL::string_of(force_north_ribose_list_[n]) + " is in both force_north_ribose_list_ and force_south_ribose_list_! " );
484  }
485  }
486  }
487  //////////////////////////////////////////////////////////////////////////////////////////
488  void
492  }
493  //////////////////////////////////////////////////////////////////////////////////////////
494  void
496 
497  //std::cout << "update_working_moving_suite " << std::endl;
498  if( (working_moving_res_list_.size()==0) && (working_moving_res_!=0) ){
499  utility_exit_with_message( "working_moving_res_list_.size()==0) && (working_moving_res_!=0");
500  }
501 
502  if( (working_moving_res_list_.size()!=0) && (working_moving_res_==0) ){
503  utility_exit_with_message( "working_moving_res_list_.size()!=0) && (working_moving_res_==0");
504  }
505 
506  if(working_moving_res_list_.size()==0) return;
507 
508  if(working_moving_res_==0) utility_exit_with_message( "working_moving_res_list_.size()!=0) && (working_moving_res_==0");
509 
510 
511 
513 
514  if(Is_prepend_ ){
517  }else{
519 
520  for(Size n=1; n<=working_moving_res_list_.size(); n++){
522  }
523 
524  }
525 
526  //check
527  if(working_moving_suite_!=working_moving_suite_list_[1]) utility_exit_with_message( "working_moving_suite_!=working_moving_suite_list_[1]");
528 
529  }
530 
531  //////////////////////////////////////////////////////////////////////////////////////////
532  std::map< core::Size, core::Size > //Parin Jan 18, 2009
533  StepWiseRNA_JobParameters::create_sub_to_full_map(std::map< core::Size, core::Size > const & full_to_sub) const{
534 
535  std::map< core::Size, core::Size > ::const_iterator it;
536  std::map< core::Size, core::Size > sub_to_full;
537  sub_to_full.clear();
538 
539  for (it=full_to_sub.begin(); it!=full_to_sub.end(); it++ ){
540  sub_to_full[it->second]=it->first;
541  }
542 
543  //output for debug
544  // std::cout << "full_to_sub" << std::endl;
545  for (it=full_to_sub.begin(); it!=full_to_sub.end(); it++ ){
546  // std::cout << it->first << " => " << it->second << std::endl;
547  }
548 
549  // std::cout << "sub_to_full" << std::endl;
550  for (it=sub_to_full.begin(); it!=sub_to_full.end(); it++ ){
551  // std::cout << it->first << " => " << it->second << std::endl;
552  }
553 
554  return sub_to_full;
555 
556  }
557 
558  //////////////////////////////////////////////////////////////////////////////////////////
559 
561 
562  if(full_sequence_.size()==0) return;
563  if(is_working_res_.size()==0) return;
564 
566 
567  for ( Size full_seq_num = 1; full_seq_num <= full_sequence_.size(); full_seq_num++ ) {
568 
569  if ( is_working_res_[ full_seq_num ] ) {
570  working_sequence_ += full_sequence_[ full_seq_num-1 ]; //i-1 because std::string elements starts at 0...
571  }
572 
573  }
574 
575  }
576 
577  //////////////////////////////////////////////////////////////////////////////////////////
578 
579 
580 }
581 }
582 }