Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StepWiseRNA_JobParameters_Setup.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_Setup
11 /// @brief Sets up pose and job parameters for RNA stepwise building.
12 /// @detailed
13 /// @author Rhiju Das, Parin Sripakdeevong
14 
15 
16 //////////////////////////////////
21 
23 //////////////////////////////////
24 #include <core/chemical/util.hh>
33 #include <core/types.hh>
34 #include <core/pose/Pose.hh>
35 #include <core/pose/util.hh>
36 #include <basic/Tracer.hh>
37 #include <core/io/pdb/pose_io.hh>
38 #include <core/id/TorsionID.hh>
41 #include <ObjexxFCL/string.functions.hh>
42 #include <ObjexxFCL/format.hh>
43 
44 #include <ObjexxFCL/FArray1D.hh>
45 #include <ObjexxFCL/FArray2D.hh>
46 
47 
48 #include <utility/exit.hh>
49 #include <time.h>
50 
51 #include <string>
52 
53 using namespace core;
54 using core::Real;
55 
56 //////////////////////////////////////////////////////////////////////////
57 //////////////////////////////////////////////////////////////////////////
58 // Core routine for stepwise sampling of proteins (and probably other
59 // biopolymers soon). Take a starting pose and a list of residues to sample,
60 // and comprehensively sample all backbone torsion angles by recursion.
61 //////////////////////////////////////////////////////////////////////////
62 //////////////////////////////////////////////////////////////////////////
63 //////////////////////////////////////////////////////////////////////////
64 
65 static basic::Tracer TR( "protocols.swa.rna.stepwise_rna_jobparameter_setup" ) ;
66 
67 namespace protocols {
68 namespace swa {
69 namespace rna {
70 
71  //////////////////////////////////////////////////////////////////////////
72  //constructor!
73  StepWiseRNA_JobParameters_Setup::StepWiseRNA_JobParameters_Setup( utility::vector1< core::Size > const & moving_res_list,
74  std::string const & full_sequence,
75  utility::vector1< core::Size > const & input_res,
76  utility::vector1< core::Size > const & input_res2,
77  utility::vector1< core::Size > const & cutpoint_open,
78  Size const & user_specified_cutpoint_closed ):
79  moving_res_( moving_res_list[1] ),
80  moving_res_list_( moving_res_list ),
81  cutpoint_open_( cutpoint_open ),
82  is_cutpoint_( full_sequence.size(), false ),
83  job_parameters_( new StepWiseRNA_JobParameters ),
84  filter_user_alignment_res_(true), //Generally want to keep this true!
85  allow_chain_boundary_jump_partner_right_at_fixed_BP_(false), //hacky, just to get the Square RNA working..Nov 6, 2010
86  allow_fixed_res_at_moving_res_(false), //hacky, just to get the Hermann Duplex RNA working..Nov 15, 2010
87  simple_append_map_(false),
88  skip_complicated_stuff_(false)
89  {
90  Output_title_text("Enter StepWiseRNA_JobParameters_Setup::constructor");
91  ///////////////////////////////////////////////////////
92  // Cutpoint setup
93 
94  for ( Size n = 1; n <= cutpoint_open_.size(); n++ ) {
95  is_cutpoint_( cutpoint_open_[ n ] ) = true;
96  if ( cutpoint_open_[ n ] == user_specified_cutpoint_closed ) utility_exit_with_message( "Position cannot be both cutpoint_open and user_specified_cutpoint_closed" );
97  }
98 
99  utility::vector1< Size > cutpoint_closed_list;
100 
101  if ( user_specified_cutpoint_closed > 0 ) {
102  is_cutpoint_( user_specified_cutpoint_closed ) = true;
103  cutpoint_closed_list.push_back(user_specified_cutpoint_closed);
104  }
105 
106  job_parameters_->set_cutpoint_closed_list(cutpoint_closed_list);
107 
108  ///////////////////////////////////////////////////////
109 
110  Output_seq_num_list("input_res= ", input_res, 30);
111  Output_seq_num_list("input_res2= ", input_res2, 30);
112  Output_seq_num_list("moving_res_list= ", moving_res_list_, 30);
113  std::cout << "moving_res= " << moving_res_ << std::endl;
114 
115  utility::vector1< utility::vector1< Size > > input_res_vectors;
116  input_res_vectors.push_back( input_res );
117  input_res_vectors.push_back( input_res2 );
118  job_parameters_->set_input_res_vectors(input_res_vectors);
119 
120  ////////////////////////////////////////////////////////
121  job_parameters_->set_full_sequence( full_sequence );
122  job_parameters_->set_moving_res( moving_res_ );
123 
124  figure_out_working_sequence_and_mapping(); //Initialize this here since full_to_sub and Is_working_res is needed by many setting functions
125 
126  Output_title_text("Exit StepWiseRNA_JobParameters_Setup::constructor");
127  }
128 
129  //////////////////////////////////////////////////////////////////////////
130  //destructor
132  {}
133 
134  //////////////////////////////////////////////////////////////////////////
135  void
137 
138  using namespace core::pose;
139  using namespace core::kinematics;
140  using namespace core::chemical;
141 
142  Output_title_text("Enter StepWiseRNA_JobParameter_Setup::apply");
143 
145 
148  figure_out_cuts();
149 
150  setup_fold_tree();
151 
152  ////////////////Change the order that these functions are called on May 3, 2010 Parin S./////////////////////////////////////
153  Size root_res( 1 );
154  if ( !skip_complicated_stuff_ ){
156 
157  root_res = reroot_fold_tree(internal_params.fake_working_moving_suite);
158 
159  //need the final rerooted fold_tree, WARNING: this function resets the working_moving_res_list annd working_moving_res for the internal case...
160  //Warning this leaves is_working_res NOT updated...
161  figure_out_Prepend_Internal(root_res, internal_params);
162 
163  figure_out_gap_size_and_five_prime_chain_break_res(); //Need partition definition to be initialized...
164 
165  ///////////////////////////////////////////////////////////////////////
166 
167  figure_out_Is_prepend_map(); //Need fold_tree and fixed_res to be initialized
168  } else {
169  root_res = reroot_fold_tree_simple();
171  }
172 
173  utility::vector1< core::Size > const working_best_alignment=get_user_input_alignment_res_list(root_res);
174  if(working_best_alignment.size()>0){
175  job_parameters_->set_working_best_alignment(working_best_alignment);
176  }else{
178  }
179 
180  Output_title_text("Exit StepWiseRNA_JobParameter_Setup::apply");
181 
182  }
183 
184  //////////////////////////////////////////////////////////////////////////
187 
188  Output_title_text("Enter get_user_input_alignment_res_list");
189 
190  utility::vector1< core::Size > working_best_alignment;
191 
192  if(working_best_alignment.size()!=0){ //make sure the initial size of the vector is zero..this is kinda dumb...but safe.. May 4, 2010 Parin S.
193  utility_exit_with_message( " empty_working_best_alignment.size()!=0" );
194  }
195 
196  utility::vector1< std::string > const & alignment_res_string_list=alignment_res_string_list_;
197 
198  if(alignment_res_string_list.size()==0){
199  std::cout << "WARNING: alignment_res_string_list.size()==0. EARLY RETURN AN EMPTY LIST" << std::endl;
200  return working_best_alignment;
201  }
202 
203 
204  if(fixed_res_.size()==0){
205  utility_exit_with_message( "need to called set_fixed_res before calling set_alignment_res" );
206  }
207 
208  Output_boolean("filter_user_alignment_res_= ", filter_user_alignment_res_); std::cout << std::endl;
209  Output_seq_num_list("fixed_res= ", fixed_res_, 30);
210 
211 
212  for(Size n=1; n<=alignment_res_string_list.size(); n++){
213 
214  utility::vector1< std::string > alignments_res_string=Tokenize(alignment_res_string_list[n], "-");
215 
216  utility::vector1< core::Size > alignment_res;
217  utility::vector1< core::Size > working_alignment;
218 
219  for(Size ii=1; ii<=alignments_res_string.size(); ii++){
220  alignment_res.push_back( string_to_int( alignments_res_string[ii] ) );
221  }
222 
224 
225  utility::vector1< core::Size > actual_alignment_res;
226 
227  for(Size ii=1; ii<=alignment_res.size(); ii++){
228  Size seq_num=alignment_res[ii];
229  if(Contain_seq_num(seq_num, fixed_res_)) actual_alignment_res.push_back(seq_num);
230  }
231 
232  working_alignment=apply_full_to_sub_mapping(actual_alignment_res, job_parameters_);
233 
234  ObjexxFCL::FArray1D< bool > const & partition_definition = job_parameters_->partition_definition();
235  bool contain_non_root_partition_seq_num=false;
236  for(Size ii=1; ii<working_alignment.size(); ii++){
237  if( partition_definition( working_alignment[ii] ) != partition_definition( root_res ) ) contain_non_root_partition_seq_num=true;
238  }
239 
240  if(contain_non_root_partition_seq_num==true) continue;
241 
242  }else{
243  working_alignment=apply_full_to_sub_mapping(alignment_res, job_parameters_);
244  }
245 
246  //utility::vector1< core::Size > working_alignment=apply_full_to_sub_mapping(alignment_res, job_parameters_);
247 
248  if( working_alignment.size()>working_best_alignment.size() ) working_best_alignment=working_alignment;
249  }
250 
251 
252  Output_seq_num_list("best_working_align= ", apply_sub_to_full_mapping(working_best_alignment, job_parameters_), 30);
253 
254 // if(alignment_res_string_list.size()>0 && working_best_alignment.size()==0){ Not compatible with build from scratch mode! Sept 08, 2010
255 // utility_exit_with_message( "User supplied alignment_res_string_list but working_best_alignment.size()==0!!" );
256 // }
257 
258 
259  Output_title_text("");
260  return working_best_alignment;
261 
262  }
263 
264  //////////////////////////////////////////////////////////////////////////
265  //no user specified alignment, have to figure this out internally
266  void
268 
269  Output_title_text("Enter StepWiseRNA_JobParameters_Setup::figure_out_best_working_alignment. no user specified alignment, have to figure this out internally");
270 
271  core::kinematics::FoldTree const & fold_tree = job_parameters_->fold_tree();
272  utility::vector1< core::Size > working_fixed_res( job_parameters_->working_fixed_res() );
273  ObjexxFCL::FArray1D< bool > const & partition_definition = job_parameters_->partition_definition();
274  std::map< core::Size, core::Size > & full_to_sub( job_parameters_->full_to_sub() );
275  utility::vector1< core::Size > const & is_working_res( job_parameters_->is_working_res() );
276 
277  bool const root_partition = partition_definition( fold_tree.root() );
278 
279  utility::vector1< core::Size > working_alignment;
280 
281 
282  for (Size n=1; n <= working_fixed_res.size(); n++){
283  Size seq_num=working_fixed_res[n];
284  if ( partition_definition( seq_num ) == root_partition ) {
285  working_alignment.push_back(seq_num);
286  }
287  }
288 
289 
290 
291  //Special case for building loop outward
292  if(working_alignment.size()==0 ){
293 
294  //March 17, 2012: RE-comment out since that are possible cases where all the working_fixed_res resides in the 'non-root' partition.
295  //For example at the last building-step of of build-outward mode + idealized helix.
296  //if( working_fixed_res.size()!=0) utility_exit_with_message( "working_alignment.size()==0 but fixed_res_.size()!=0 !!" );
297 
298  std::cout << " special case of building loop outward...no fixed element. " << std::endl;
299 
300  //Basically include every working_res as an alignment_res.....INCLUDING THE MOVING RES!
301  //Don't worry about virtual res, this is taken care of by the function create_alignment_id_map(). Parin Apr 23, 2010
302  for(Size full_seq_num=1; full_seq_num<=is_working_res.size(); full_seq_num++){
303  if(is_working_res[full_seq_num]==false) continue;
304 
305  Size const seq_num=full_to_sub[full_seq_num];
306  working_alignment.push_back(seq_num);
307  }
308  }
309 
310  Output_seq_num_list("working_fixed_res= ", working_fixed_res, 30);
311  Output_seq_num_list("working_alignment= ", working_alignment, 30);
312  Output_seq_num_list("working_alignment= ", working_alignment, 30);
313 
314  job_parameters_->set_working_best_alignment(working_alignment);
315 
316  if( job_parameters_->working_best_alignment().size()==0){
317  utility_exit_with_message( "job_parameters_->working_best_alignment().size()==0" );
318  }
319 
320  Output_title_text("");
321 
322  }
323  /////////////////////////////////////////////////////////////////////
324  void
325  StepWiseRNA_JobParameters_Setup::figure_out_working_sequence_and_mapping(){ //working_sequence is now updated internally by JP.
326 
327  Output_title_text("Enter StepWiseRNA_JobParameters_Setup::figure_out_working_sequence_and_mapping");
328 
329  // There are up to two input poses. Need to merge their input residues and figure out chain boundaries.
330  std::string const & full_sequence=job_parameters_->full_sequence();
331 
332  Size const nres( full_sequence.size() );
333  utility::vector1< utility::vector1< Size > > const & input_res_vectors=job_parameters_->input_res_vectors();
334 
335  ///////////////////////////////////////////////////////////////////////////////////////////////
336  //A vector to indicate if res exist in the working pose and if it belong to input_pose 1 or input_pose 2 or working_res_list.
337  utility::vector1< core::Size > is_working_res(nres, 0);
338 
339  for ( Size i = 1; i <= input_res_vectors.size(); i++ ){
340  for ( Size n = 1; n <= input_res_vectors[i].size(); n++ ){
341  is_working_res[ input_res_vectors[i][ n ] ] = i; //WARNING, might not work with case of overlapping residue!
342  }
343  }
344 
345  for( Size i = 1; i <= moving_res_list_.size(); i++){
346  is_working_res[ moving_res_list_[i] ]= 999;
347  }
348 
349  job_parameters_->set_is_working_res( is_working_res );
350  ///////////////////////////////////////////////////////////////////////////////////////////////
351  std::map< core::Size, core::Size > full_to_sub;
352 
353  full_to_sub.clear();
354  Size count( 0 );
355  for ( Size i = 1; i <= full_sequence.size(); i++ ) {
356  if ( is_working_res[ i ] ) {
357  count++;
358  full_to_sub[ i ] = count;
359  }
360  }
361 
362  job_parameters_->set_full_to_sub( full_to_sub ); //res_map
363  /////////////////////////////////////////////////////////////////////////////////////////////////////
364 
365 
366  //Size const working_moving_res = full_to_sub[ moving_res_ ];
367  //job_parameters_->set_working_moving_res( working_moving_res );
368 
369  utility::vector1< core::Size > working_moving_res_list;
370  for(Size i=1; i<=moving_res_list_.size(); i++){
371  working_moving_res_list.push_back(full_to_sub[ moving_res_list_[i] ]);
372  }
373 
374  job_parameters_->set_working_moving_res_list( working_moving_res_list ); //This automatically set working_moving_res as well (Jan 15, 2011)
375  ////////////////////////////////////////////////////////////////////////////////////////////////////
376 
377  Output_title_text("");
378 
379  }
380 
381 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
382 //
383 // StepWiseRNA_JobParameters_Setup::figure_out_Is_build_pose_from_scratch(){
384 // bool const build_pose_from_scratch( job_parameters_->Is_build_pose_from_scratch() );
385 // }
386 
387 
388 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
389 
390  bool
392 
393 // Output_title_text("Enter StepWiseRNA_JobParameters_Setup::figure_out_Is_residue_prepend");
394 
395  using namespace ObjexxFCL;
396 
397  utility::vector1< core::Size > const & is_working_res( job_parameters_->is_working_res() );
398  Size const total_residues( job_parameters_->full_sequence().size() );
399  core::kinematics::FoldTree const & fold_tree = job_parameters_->fold_tree();
400  std::map< core::Size, core::Size > & full_to_sub( job_parameters_->full_to_sub() );
401  utility::vector1< core::Size > working_fixed_res( job_parameters_->working_fixed_res() );
402 
403  if(is_working_res[seq_num]==false){
404  Output_bool_list("Is_working_res= ", is_working_res, 30);
405  utility_exit_with_message( "In Is_residue_prependable function. Input seq_num: " + string_of(seq_num) + " is not a element of moving_res_list_");
406  }
407 
408  //if can prepend, then must be able to find a fix res as decrement without encounter chainbreak
409  Size cur_seq_num=seq_num;
410 
411  //Check if can prepend
412  while(true){
413  if(cur_seq_num < 1) break;
414 
415  if(seq_num == total_residues ) break; //Cannot prepend last residue
416 
417  if(is_working_res[cur_seq_num]==false) break;
418 
419  if( cur_seq_num!=seq_num && is_cutpoint_( cur_seq_num - 1 ) ) break;
420 
422  for(Size i=1; i<=jump_point_pair_list_.size(); i++){
423  if(cur_seq_num==jump_point_pair_list_[i].first) return true; //Is_prepend
424  if(cur_seq_num==jump_point_pair_list_[i].second) return true; //Is_prepend
425  }
426  }
427 
428  if(Contain_seq_num(cur_seq_num, fixed_res_) ) return true; //Is_prepend
429 
430  //For build loop outward case, in this case make every residue append except for the 1st residue in the chain..
431  //check that the fold_tree is simple..could also use the is_simple_tree() function that don't really understand how this function works
432  if(fold_tree.num_cutpoint()==0){
433 
434  //This line was commented out since it conflicted with Fang's electron density code.
435  //if( working_fixed_res.size()!=0) utility_exit_with_message( "fold_tree.num_cutpoint()==0 but fixed_res_.size()!=0 !!" );
436 
437  if(full_to_sub[cur_seq_num]==1) return true; //prepend
438 
439  }
440 
441  cur_seq_num++;
442  }
443 
444  //Check if can append
445  cur_seq_num=seq_num;
446 
447  while(true){
448  if(cur_seq_num > total_residues) break;
449 
450  if(seq_num == 1 ) break; //Cannot append first residue
451 
452  if(is_working_res[cur_seq_num]==false) break;
453 
454  if( is_cutpoint_(cur_seq_num) && cur_seq_num!=seq_num) break;
455 
457  for(Size i=1; i<=jump_point_pair_list_.size(); i++){
458  if(cur_seq_num==jump_point_pair_list_[i].first) return false; //Is_append
459  if(cur_seq_num==jump_point_pair_list_[i].second) return false; //Is_append
460  }
461  }
462 
463  if(Contain_seq_num(cur_seq_num, fixed_res_) ) return false; //Is_append
464 
465  //For build loop outward case, in this case make every residue append except for the 1st residue in the chain..
466  //check that the fold_tree is simple..could also use the is_simple_tree() function that don't really understand how this function works
467  if(fold_tree.num_cutpoint()==0){
468  if( working_fixed_res.size()!=0) utility_exit_with_message( "fold_tree.num_cutpoint()==0 but fixed_res_.size()!=0 !!" );
469 
470  if(full_to_sub[cur_seq_num]!=1) return false; //append
471 
472  }
473 
474 
475  cur_seq_num--;
476  }
477 
478  //Error, if reach this point of the function
479  std::cout << "Error: Figure_out_Is_residue_prepend, residue seq_num: " << seq_num << std::endl;
480  std::cout << "Cannot attach residue by either prepending and appending!" << std::endl;
481  exit (1);
482 
483 // Output_title_text("");
484  }
485 
486 //Choose to use vector data structure due to its ability to access an arbitrary element of a sequence in equal time (random access)
487  void
489 
490  Output_title_text("Enter StepWiseRNA_JobParameters_Setup::figure_out_Is_residue_prepend_map");
491 
492  utility::vector1< core::Size > const & rmsd_res_list= job_parameters_->rmsd_res_list();
493  Output_seq_num_list("rmsd_res_list= ", rmsd_res_list, 30);
494  std::map< core::Size, bool > Is_prepend_map;
495 
496  if(simple_append_map_){
497 
498  std::cout << "WARNING using simple_append_map!" << std::endl;
499  //Only initial Is_residue_prepend for rebuild residues;
500 
501  for(Size n=1; n<=rmsd_res_list.size(); n++){
502  Size const seq_num=rmsd_res_list[n];
503  Is_prepend_map[seq_num]=false;
504  }
505 
506  }else{
507 
508  //Only initial Is_residue_prepend for rebuild residues;
509  for(Size n=1; n<=rmsd_res_list.size(); n++){
510  Size const seq_num=rmsd_res_list[n];
511  Is_prepend_map[seq_num]=figure_out_Is_residue_prepend(seq_num);
512  }
513  }
514 
515  job_parameters_->set_Is_prepend_map( Is_prepend_map );
516 
517  Output_title_text("");
518  }
519  //////////////////////////////////////////////////////////////////////////
520 
523 
524  using namespace ObjexxFCL;
525 
526  utility::vector1< core::Size > previously_closed_cutpoint;
527 
528  utility::vector1< utility::vector1< Size > > const & input_res_vectors=job_parameters_->input_res_vectors();
529 
530  if(silent_files_in_.size()!=input_tags_.size()) utility_exit_with_message("silent_files_in.size()!=input_tags.size()");
531 
532  for(Size silent_file_num=1; silent_file_num<=silent_files_in_.size(); silent_file_num++){
533  pose::Pose import_pose;
534  import_pose_from_silent_file(import_pose, silent_files_in_[ silent_file_num ], input_tags_[silent_file_num] );
535 
536  utility::vector1< Size > const & input_to_full_res_map=input_res_vectors[silent_file_num]; //input_res is map from input_seq_num to full_pose_seq_num
537 
538  for(Size seq_num=1; seq_num<=import_pose.total_residue(); seq_num++){
539  if(import_pose.residue( seq_num ).has_variant_type( chemical::CUTPOINT_LOWER ) ){
540  if( import_pose.residue( seq_num+1 ).has_variant_type( chemical::CUTPOINT_UPPER )==false ){
541  utility_exit_with_message("seq_num " + string_of(seq_num) + " is a CUTPOINT_LOWER but seq_num " + string_of(seq_num+1) + " is not a cutpoint CUTPOINT_UPPER??" );
542  }
543 
544  previously_closed_cutpoint.push_back( input_to_full_res_map[seq_num] );
545 
546  }
547  }
548  }
549 
550  Output_seq_num_list("previously_closed_cutpoint_= ", previously_closed_cutpoint, 30);
551 
552  return previously_closed_cutpoint;
553  }
554  //////////////////////////////////////////////////////////////////////////
555 
556 
557  void
559 
560  Output_title_text("Enter StepWiseRNA_JobParameters_Setup::setup_additional_cutpoint_closed");
561  utility::vector1< core::Size > const & is_working_res( job_parameters_->is_working_res() );
562  utility::vector1< Size > const & cutpoint_closed_list = job_parameters_->cutpoint_closed_list();
563  Size const nres( job_parameters_->full_sequence().size() );
564 
565  utility::vector1< Size > new_cutpoint_closed_list =cutpoint_closed_list;
566 
567 
568  utility::vector1< core::Size > non_fixed_res;
569  added_cutpoint_closed_.clear();
570 
571 // utility::vector1< core::Size > accounted_for_non_fixed_res;
572 
573  for(Size seq_num=1; seq_num<=nres; seq_num++){
574  if( Contain_seq_num(seq_num, fixed_res_) == false){
575  non_fixed_res.push_back(seq_num);
576  }
577  }
578 
579  //0==false, 1==true
580  Output_size_list("Is_working_res= ", is_working_res, 30);
581  Output_bool_list("Is_working_res= ", is_working_res, 30);
582  Output_seq_num_list("fixed res= ", fixed_res_, 30);
583  Output_seq_num_list("non_fixed res= ", non_fixed_res, 30);
584 
585  if(new_cutpoint_closed_list.size()>0){
586  std::cout << "user_specified_cutpoint_closed= " << new_cutpoint_closed_list[1] << std::endl;
587  }
588 
589  for(Size n=1; n<=non_fixed_res.size(); n++){
590 
591  if(is_working_res[ non_fixed_res[n] ]==false) continue;
592 
593  /////////////////////////////////////////////////////////////////////////////////////
594  bool free_boundary=false;
595 
596  Size five_prime_boundary=0;
597  for(int seq_num=non_fixed_res[n]; seq_num >= 0; seq_num--){ //find the 5' base_pair_list res boundary
598  if(seq_num==0){ //no 5' fixed res boundary
599  free_boundary=true;
600  break;
601  }
602 
603  if( Contain_seq_num(seq_num, jump_point_pair_list_) && is_working_res[seq_num] ){
604  five_prime_boundary=seq_num;
605  break;
606  }
607  }
608 
609  Size three_prime_boundary=0;
610  for(Size seq_num=non_fixed_res[n]; seq_num <= nres+1; seq_num++){ //find the 3' base_pair_list res boundary
611 
612  if(seq_num==nres+1){ //no 3' fixed res boundary
613  free_boundary=true;
614  break;
615  }
616 
617  if( Contain_seq_num(seq_num, jump_point_pair_list_) && is_working_res[seq_num] ){
618  three_prime_boundary=seq_num;
619  break;
620  }
621  }
622 
623  if(free_boundary==true) continue;
624  /////////////////////////////////////////////////////////////////////////////////////
625  bool boundary_is_a_pair=false;
626  for(Size ii=1; ii<=jump_point_pair_list_.size(); ii++){
627  std::pair< core::Size, core::Size > jump_point_pair=jump_point_pair_list_[ii];
628  if(five_prime_boundary==jump_point_pair.first && three_prime_boundary==jump_point_pair.second){
629  boundary_is_a_pair=true;
630  break;
631  }
632  }
633  if(boundary_is_a_pair==false) continue;
634  /////////////////////////////////////////////////////////////////////////////////////
635 
636  bool found_cutpoint_or_moving_res_or_nonworking_res=false;
637  for(Size seq_num=five_prime_boundary; seq_num <= three_prime_boundary-1; seq_num++){
638  if(is_cutpoint_(seq_num) || seq_num==moving_res_ || (!is_working_res[ seq_num ]) ){
639  found_cutpoint_or_moving_res_or_nonworking_res=true;
640  break;
641  }
642  }
643 
644  //Aug 22, 2010...include the nonworking_res check
645  //This fix is to get the FOUR edge mode working..basically if there a non_working_res..the cutpoint will be automatically set up by itself..no need for additional cutpoint close
646 
647 
648  if(found_cutpoint_or_moving_res_or_nonworking_res==true) continue; //Actually check for moving res should be enough...
649  ///////////////////////////////////////////////////////////////////////////////////////
650 
651  //Really need to add a cutpoint to keep the fixed_base_pair fixed wrt to each other!!!
652 
653  //Preferable to put cutpoint_closed at a place where the chain is closed at a previous folding step. Sept 1, 2010
654 
655  Size cutpoint=0;
656 
658 
659  for(Size seq_num=five_prime_boundary; seq_num <= three_prime_boundary-1; seq_num++){
660 
661  if( Contain_seq_num(seq_num, previously_closed_cutpoint) && is_working_res[seq_num]){
662  cutpoint=seq_num;
663  break;
664  }
665  }
666 
667 
668 
669  if(cutpoint==0){ //OK couldn't find the a valid previously closed cutpoint..so will put arbitrary put it 2 residues from three_prime_fixed_res
670 
671  Size three_prime_fixed_res=0;
672  for(Size seq_num=non_fixed_res[n]; seq_num <= nres+1; seq_num++){ //find the 3' base_pair_list res boundary
673 
674  if(seq_num > three_prime_boundary){ //no 3' fixed res boundary
675  utility_exit_with_message( "three_prime_fixed_res > three_prime_boundary of fixed base pair ?? " );
676  }
677 
678  if( Contain_seq_num(seq_num, fixed_res_) && is_working_res[seq_num] ){
679  three_prime_fixed_res=seq_num;
680  break;
681  }
682  }
683 
684  cutpoint=three_prime_fixed_res-2; //-1 is 3' most non-fixed res, use -2 so that the chain_break torsion will be minimize
685  }
686 
687  if(is_working_res[cutpoint]==false) utility_exit_with_message( "cutpoint is not a working_res!" );
688 
689  new_cutpoint_closed_list.push_back(cutpoint);
690  added_cutpoint_closed_.push_back(cutpoint);
691  is_cutpoint_(cutpoint)=true;
692 
693  }
694 
695  std::cout << "added_cutpoint_closed_= ";
696  for(Size n=1; n<=added_cutpoint_closed_.size(); n++){
697  std::cout << " " << added_cutpoint_closed_[n];
698  }
699  std::cout << std::endl;
700 
701  Output_seq_num_list("cutpoint_closed_= ", new_cutpoint_closed_list, 30);
702  Output_title_text("");
703 
704  job_parameters_->set_cutpoint_closed_list(new_cutpoint_closed_list);
705 
706 
707  }
708 
709  ///////////////////////////////////////////////////////////////////////////////////
710 
711  void
713 
714  Output_title_text("Enter StepWiseRNA_JobParameters_Setup::figure_out_chain_boundaries");
715 
716  Size const nres( job_parameters_->full_sequence().size() );
717 
718  utility::vector1< core::Size > const & is_working_res( job_parameters_->is_working_res() );
720 
721  Size start_chain( 0 );
722  Size end_chain( 0 );
723  Size n( 0 );
724  for ( Size pos = 1; pos <= nres; pos++ ) {
725 
726  if ( !is_working_res[ pos ] ) continue;
727  n++;
728 
729  if ( n == 1 ) start_chain = pos;
730 
731  if (n > 1 && ( pos > end_chain + 1 || is_cutpoint_( end_chain ) ) ) {//pos > end_chain + 1 happen if !is_working_res[ pos ]==true. i.e a gap in the chain
732 
733  std::cout << "start_chain= " << start_chain << " end_chain= " << end_chain << std::endl;
734 
735  chain_boundaries.push_back( std::make_pair( start_chain, end_chain ) ); //The last chain...
736 
737  start_chain = pos;
738  }
739 
740  end_chain = pos;
741  }
742 
743  // For now, need to have at least one chain defined in the input!
744  if( (start_chain > 0)==false ) utility_exit_with_message( "start_chain > 0" );
745 
746  chain_boundaries.push_back( std::make_pair( start_chain, end_chain ) );
747  std::cout << "start_chain= " << start_chain << " end_chain= " << end_chain << std::endl;
748 
749 
750  job_parameters_->set_chain_boundaries( chain_boundaries );
751 
752 
753  Output_title_text("");
754  }
755 
756  ///////////////////////////////////////////////////////////////////////////////////
757  void
759 
760  Output_title_text("StepWiseRNA_JobParameters_Setup::figure_out_jump_partners");
761  Output_boolean("allow_chain_boundary_jump_partner_right_at_fixed_BP_= ", allow_chain_boundary_jump_partner_right_at_fixed_BP_ ); std::cout << std::endl;
762 
763 
764  jump_partners_.clear();
765 
766  utility::vector1< std::pair< core::Size, core::Size > > const & chain_boundaries( job_parameters_->chain_boundaries() );
767  std::map< core::Size, core::Size > & full_to_sub( job_parameters_->full_to_sub() );
768  utility::vector1< core::Size > const & is_working_res = job_parameters_->is_working_res();
769  utility::vector1< Size > const & cutpoint_closed_list = job_parameters_->cutpoint_closed_list();
770 
771  Size const num_chains( chain_boundaries.size() );
772 
773  std::cout << "num_chains= " << num_chains << std::endl;
774  for ( Size n = 1 ; n < num_chains; n++ ) {
775 
776  Size const jump_partner1 = chain_boundaries[n].second;
777  Size const jump_partner2 = chain_boundaries[n+1].first;
778 
779 
780  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
781  bool pass_consecutive_res_jump_partner_test=true;
782 
783  if ( is_working_res[ jump_partner1 ] == false || is_working_res[ jump_partner2 ] == false ){
784  pass_consecutive_res_jump_partner_test=false;
785  }
786  if (moving_res_ == jump_partner2 || moving_res_ == jump_partner1){
787  pass_consecutive_res_jump_partner_test=false;
788  }
789 
790  if(jump_partner1+1==jump_partner2 &&
791  Contain_seq_num(jump_partner1, cutpoint_closed_list)==false && //not a cutpoint closed
792  ( ( Contain_seq_num(jump_partner1, fixed_res_) && Contain_seq_num(jump_partner2, fixed_res_) ) ||
793  ( allow_chain_boundary_jump_partner_right_at_fixed_BP_ && pass_consecutive_res_jump_partner_test) ) //Nov 2010, get Square RNA to work
794  ){
795 
796  if ( is_working_res[ jump_partner1 ] == false || is_working_res[ jump_partner2 ] == false ) utility_exit_with_message( "jump_partner should be working res!" );
797 
798  if (moving_res_ == jump_partner2 || moving_res_ == jump_partner1) utility_exit_with_message( "jump_partner should not be moving_res_!" );
799 
800  std::cout << std::setw(80) << "jump_partner1+1=jump_partner2 case: jump_partner1= " << jump_partner1 << " jump_partner2= " << jump_partner2 << std::endl;
801  jump_partners_.push_back( std::make_pair( full_to_sub[ jump_partner1 ], full_to_sub[ jump_partner2 ] ) );
802  }else{
803 
804  std::pair< core::Size, core::Size > fixed_base_pair;
805 
806  bool found_jump_point_pair=false;
807  for(Size i=1; i<=jump_point_pair_list_.size(); i++){ //Try an exterior pair
808  if(jump_point_pair_list_[i].first < jump_partner1 && jump_partner2 < jump_point_pair_list_[i].second){
809  if(is_working_res[jump_point_pair_list_[i].first] && is_working_res[jump_point_pair_list_[i].second] ){
810  fixed_base_pair=jump_point_pair_list_[i];
811  found_jump_point_pair=true;
812  break;
813  }
814  }
815  }
816 
817  ///////////Nov 6, 2010...hacky mainly to get the square RNA working.../////////////
818  if(found_jump_point_pair==false){
820  for(Size i=1; i<=jump_point_pair_list_.size(); i++){ //Try an exterior pair
821  if(jump_point_pair_list_[i].first <= jump_partner1 && jump_partner2 <= jump_point_pair_list_[i].second){
822  if(is_working_res[jump_point_pair_list_[i].first] && is_working_res[jump_point_pair_list_[i].second] ){
823  fixed_base_pair=jump_point_pair_list_[i];
824  std::cout << "warning allow_chain_boundary_jump_partner_right_at_fixed_BP_=true" << std::endl;
825  std::cout << "jump_partner1(local)= " << fixed_base_pair.first << " jump_partner2(local)= " << fixed_base_pair.second << " is right at a fixed_BP " << std::endl;
826  found_jump_point_pair=true;
827  break;
828  }
829  }
830  }
831  }
832  }
833  ///////////////////////////////////////////////////////////////////////////////////
834 
835 
836  if(found_jump_point_pair==false) utility_exit_with_message( "Cannot find found_jump_point_pair!" );
837 
838  std::cout << std::setw(80) << "exterior_fixed_base_pair_case : jump_partner1= " << fixed_base_pair.first << " jump_partner2= " << fixed_base_pair.second << std::endl;
839  jump_partners_.push_back( std::make_pair( full_to_sub[ fixed_base_pair.first ], full_to_sub[ fixed_base_pair.second ] ) );
840  }
841  }
842 
843  Output_title_text("");
844  }
845 
846  ///////////////////////////////////////////////////////////////////////////////////
847  void
849 
850  cuts_.clear();
851 
852  utility::vector1< std::pair< core::Size, core::Size > > const & chain_boundaries( job_parameters_->chain_boundaries() );
853  std::map< core::Size, core::Size > & full_to_sub( job_parameters_->full_to_sub() );
854  Size const num_chains = chain_boundaries.size();
855 
856  for ( Size n = 1; n < num_chains; n++ ) {
857  cuts_.push_back( full_to_sub[ chain_boundaries[n].second ] );
858  }
859 
860  }
861 
862  ///////////////////////////////////////////////////////////////////////////////////
863  void
865 
866  Output_title_text("Enter StepWiseRNA_JobParameters_Setup::setup_fold_tree");
867 
868  std::map< core::Size, core::Size > & full_to_sub( job_parameters_->full_to_sub() );
869 
870  if( cuts_.size() != jump_partners_.size() ) utility_exit_with_message( "cuts_.size() != jump_partners_.size()" );
871 
872  std::string const working_sequence = job_parameters_->working_sequence();
873 
874  Size const nres( working_sequence.size() );
875 
876  Size const num_cuts( cuts_.size() );
877 
878  ObjexxFCL::FArray2D< int > jump_point( 2, num_cuts, 0 );
879  ObjexxFCL::FArray1D< int > cuts( num_cuts, 0 );
880 
881  for ( Size i = 1; i <= num_cuts; i++ ) {
882 
883  jump_point( 1, i ) = jump_partners_[i].first;
884  jump_point( 2, i ) = jump_partners_[i].second;
885  cuts( i ) = cuts_[ i ];
886  // std::cout << " HELLO: " << jump_point( 1, i ) << " " << jump_point( 2, i ) << " " << cuts( i ) << std::endl;
887  }
888 
889  Size const root_res = ( full_to_sub[ moving_res_ ] == 1 ) ? nres : 1;
890 
891  core::kinematics::FoldTree fold_tree( nres );
892 
893  fold_tree.tree_from_jumps_and_cuts( nres, num_cuts, jump_point, cuts, root_res ); //order of element in jump_point and cuts does not have to match. Jan 29, 2010 Parin S.
894 
895  Size num_cutpoint=fold_tree.num_cutpoint();
896 
897  for ( Size i = 1; i <= num_cutpoint; i++ ) {
898  Size const k = fold_tree.upstream_jump_residue( i );
899  Size const m = fold_tree.downstream_jump_residue( i );
900 
901  char upstream_res=working_sequence[k-1];
902  char downstream_res= working_sequence[m-1];
903 
904 
905  //Base atoms...
906  //chi_atoms(1)[4] )= C2 if URA or RCY
907  //chi_atoms(1)[4] )= C4 if RGU or RAD
908  std::string upstream_jump_atom;
909  std::string downstream_jump_atom;
910 
911  if(upstream_res=='u' || upstream_res=='c'){
912  upstream_jump_atom=" C2 ";
913  }else if(upstream_res=='a' || upstream_res=='g'){
914  upstream_jump_atom=" C4 ";
915  }else{
916  utility_exit_with_message( "Invalid upstream_res!!" );
917  }
918 
919  if(downstream_res=='u' || downstream_res=='c'){
920  downstream_jump_atom=" C2 ";
921  }else if(downstream_res=='a' || downstream_res=='g'){
922  downstream_jump_atom=" C4 ";
923  }else{
924  utility_exit_with_message( "Invalid downstream_res!!" );
925  }
926 
927  std::cout << "upstream_res= " << k << upstream_res << " upstream_jump_atom= " << upstream_jump_atom;
928  std::cout << " downstream_res= " << k << downstream_res << " downstream_jump_atom= " << downstream_jump_atom << std::endl;
929 
930  fold_tree.set_jump_atoms( i, downstream_jump_atom, upstream_jump_atom);
931 
932 // Residue const & rsd1( pose.residue( k ) );
933 // Residue const & rsd2( pose.residue( m ) );
934 // std::cout << "rsd1.name()= " << rsd1.name() << " rsd1.atom_name( rsd1.chi_atoms(1)[4] )= " << rsd1.atom_name( rsd1.chi_atoms(1)[4] );
935 // std::cout << " rsd2.name()= " << rsd2.name() << " rsd2.atom_name( rsd1.chi_atoms(1)[4] )= " << rsd2.atom_name( rsd2.chi_atoms(1)[4] ) << std::endl;
936 
937  }
938  /////////////////////////////////////////////////////////////////////////////////////////////////
939 
940  Output_fold_tree_info(fold_tree, "StepWiseRNA_JobParameters_Setup::setup_fold_tree()");
941 
942  job_parameters_->set_fold_tree( fold_tree );
943 
944  Output_title_text("");
945 
946  }
947 
948 
949  ///////////////////////////////////////////////////////////////////////////////////
950 
951  core::Size
953 
954  utility::vector1< utility::vector1< Size > > const & input_res_vectors=job_parameters_->input_res_vectors();
955 
956  if(input_res_vectors.size()!=2) utility_exit_with_message( "Is_internal case but input_res_vectors.size()!=2" );
957  std::map< core::Size, core::Size > & sub_to_full( job_parameters_->sub_to_full() );
958 
959  if( Contain_seq_num(sub_to_full[working_seq_num], input_res_vectors[1]) ) return 1;
960 
961  if( Contain_seq_num(sub_to_full[working_seq_num], input_res_vectors[2]) ) return 2;
962 
963  std::cout << "working_seq_num= " << working_seq_num << " full_seq_num= " << sub_to_full[working_seq_num] << std::endl;
964  std::cout << "ADASDasd" << std::endl;
965  utility_exit_with_message( "seq_num is not part of both input_res_vectors[1] or input_res_vectors[2]" );
966  return 0; //Just to prevent compiler warning...
967 
968  }
969 
970  ///////////////////////////////////////////////////////////////////////////////////
973 
974  // trick to figure out which residues are upstream vs. downstream of the moving suite --
975  // there's already a fold_tree function to do this, but it partitions based on a JUMP.
976  // So put in a fake jump between the moving_residue and the neighbor it is connected to.
977 
978  Size const nres( job_parameters_->working_sequence().size() );
979 
980  ObjexxFCL::FArray1D_bool partition_definition( nres, false );
981 
982  core::kinematics::FoldTree const & fold_tree = job_parameters_->fold_tree();
983 // Size const & moving_suite( job_parameters_->working_moving_suite() );
984 
985  /////////May 3, 2010/////////////////////////////////////////////////////////////////////
986 
987  utility::vector1< core::Size > const & working_moving_res_list( job_parameters_->working_moving_res_list() );
988 
989  Size const working_moving_res=working_moving_res_list[1]; //The one furthest away from the existing structure
990  Size const first_working_moving_res=working_moving_res_list[working_moving_res_list.size()]; //The one attached to the existing structure
991 
992  core::Size fake_working_moving_suite;
993  InternalWorkingResidueParameter internal_working_res_params;
994 
995  if ( working_moving_res == 1 || fold_tree.is_cutpoint( working_moving_res - 1 ) ) { //prepend
996  fake_working_moving_suite = first_working_moving_res ;
997  } else if ( fold_tree.is_cutpoint( working_moving_res ) || working_moving_res == nres){
998  fake_working_moving_suite = first_working_moving_res - 1;
999  } else { //Internal case...problematic/complicate case....
1000 
1001  bool const can_append = assert_can_append(working_moving_res_list); //[14, 13, 12]
1002  bool const can_prepend = assert_can_prepend(working_moving_res_list); //[12, 13, 14]
1003 
1004  Output_boolean("can_prepend= ", can_prepend ); Output_boolean(" can_append= ", can_append ); std::cout << std::endl;
1005 
1006  if(!can_prepend && !can_append){
1007  Output_seq_num_list("working_moving_res_list:" , working_moving_res_list);
1008  utility_exit_with_message( "Cannot prepend or append residue in working_moving_res_list" );
1009  }
1010 
1011  //Ok first find the two possible positions to put the actual_working_res.
1012 
1013  Size possible_working_res_1=0;
1014  Size possible_working_res_2=0;
1015  Size found_possible_working_res=0;
1016 
1017  if(working_moving_res_list.size()==1){
1018 
1019  if( working_moving_res+1<=nres ){
1020  if( input_struct_definition( working_moving_res) != input_struct_definition( working_moving_res+1 ) ) {
1021  possible_working_res_1=working_moving_res;
1022  possible_working_res_2=working_moving_res+1;
1023  found_possible_working_res++;
1024  }
1025  }
1026 
1027  if(working_moving_res-1>=1 ){
1028  if( input_struct_definition( working_moving_res) != input_struct_definition( working_moving_res-1 ) ) {
1029  possible_working_res_1=working_moving_res-1;
1030  possible_working_res_2=working_moving_res;
1031  found_possible_working_res++;
1032  }
1033  }
1034 
1035  }else{
1036 
1037  if(can_prepend){ //[11,12,13]
1038  possible_working_res_1=working_moving_res;
1039  possible_working_res_2=working_moving_res_list[working_moving_res_list.size()]+1;
1040  found_possible_working_res++;
1041  }
1042  if(can_append){ //[13,12,11]
1043  possible_working_res_1=working_moving_res_list[working_moving_res_list.size()]-1;
1044  possible_working_res_2=working_moving_res;
1045  found_possible_working_res++;
1046  }
1047  }
1048 
1049  if(found_possible_working_res!=1){
1050  std::cout << "found_possible_working_res= " << found_possible_working_res << std::endl;
1051  utility_exit_with_message( "found_possible_working_res!=1" );
1052  }
1053 
1054  // RHIJU is disabling this temporarily for swa monte carlo stuff -- need to cleanup this entire
1055  // script soon with Parin. 8 July, 2012
1056  if( !skip_complicated_stuff_ && input_struct_definition( possible_working_res_1) == input_struct_definition( possible_working_res_2) ){
1057  utility_exit_with_message( "input_struct_definition( possible_working_res_1) == input_struct_definition( possible_working_res_2)" );
1058  }
1059 
1060  fake_working_moving_suite = possible_working_res_1; //This is kinda adhoc...can choose any res between possible_working_res_1 and (possible_working_res_2-1)
1061 
1062  // rhiju -- found boundary case -- this whole setup stuff needs to be cleaned up.
1063  std::cout << "POSSIBLE_WORKING_RES1 " << possible_working_res_1 << " POSSIBLE_WORKING_RES2 " << possible_working_res_2 << std::endl;
1064  while ( fold_tree.is_cutpoint( fake_working_moving_suite ) && fake_working_moving_suite < possible_working_res_2 ) fake_working_moving_suite++;
1065 
1066 
1067  internal_working_res_params.possible_working_res_1=possible_working_res_1;
1068  internal_working_res_params.possible_working_res_2=possible_working_res_2;
1069  }
1070 
1071  internal_working_res_params.fake_working_moving_suite=fake_working_moving_suite;
1072  ///////////////////////////////////////////////////////////////////////////////
1073 
1074  core::kinematics::FoldTree fold_tree_with_cut_at_moving_suite = fold_tree;
1075 
1076  std::cout << "FAKE_WORKING_MOVING_SUITE " << fake_working_moving_suite << std::endl;
1077 
1078  Size const jump_at_moving_suite = make_cut_at_moving_suite( fold_tree_with_cut_at_moving_suite, fake_working_moving_suite );
1079 
1080  fold_tree_with_cut_at_moving_suite.partition_by_jump( jump_at_moving_suite, partition_definition );
1081 
1082  job_parameters_->set_partition_definition( partition_definition ); //this is a useful decomposition.
1083 
1084 
1085  return internal_working_res_params;
1086  }
1087 
1088  ////////////////////////////////////////////////////////////////////////////////////////////////////
1089  ////////////////////////////////////////////////////////////////////////////////////////////////////
1090 
1091  // Apparently can only reroot the tree at a "vertex", i.e. beginning or end of an "edge".
1092  bool
1094  if ( n == 1 ) return true;
1095  if ( n == f.nres() ) return true;
1096  if ( f.is_cutpoint( n ) ) return true;
1097  if ( f.is_cutpoint( n-1 ) ) return true;
1098  return false;
1099  }
1100 
1101  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1102  // Figure out a good root residue -- ideally in a fixed segment!
1103  core::Size
1105 
1106  core::kinematics::FoldTree const & fold_tree = job_parameters_->fold_tree();
1107 
1108  utility::vector1< core::Size > working_fixed_res( job_parameters_->working_fixed_res() );
1109 
1110  for ( Size i = 1; i <= working_fixed_res.size(); i++ ){
1111  Size const n = working_fixed_res[i];
1112  if ( possible_root( fold_tree, n ) ){
1113  core::kinematics::FoldTree rerooted_fold_tree = fold_tree;
1114  bool reorder_went_OK = rerooted_fold_tree.reorder( n );
1115  if ( reorder_went_OK ) {
1116  job_parameters_->set_fold_tree( rerooted_fold_tree );
1117  return n;
1118  }
1119  }
1120  }
1121 
1122  return 1;
1123  }
1124 
1125  // Figure out a good root residue -- which partition of the pose has the fewest residues to move around?
1126  core::Size
1128 
1129  Output_title_text("Enter StepWiseRNA_JobParameters_Setup::reroot_fold_tree");
1130 
1131  ObjexxFCL::FArray1D< bool > const & partition_definition = job_parameters_->partition_definition();
1132  core::kinematics::FoldTree const & fold_tree = job_parameters_->fold_tree();
1133  Size const nres = job_parameters_->working_sequence().size();
1134 
1135  std::map< core::Size, core::Size > & sub_to_full( job_parameters_->sub_to_full() );
1136 
1137  Size num_partition_0( 0 ), num_partition_1( 0 );
1138  Size possible_new_root_residue_in_partition_0( 0 ), possible_new_root_residue_in_partition_1( 0 ), root_res( 0 );
1139 
1140  for ( Size n = 1; n <= nres; n++ ) {
1141  if( partition_definition( n ) ) {
1142  num_partition_1 += 1;
1143  if ( possible_root( fold_tree, n ) ) possible_new_root_residue_in_partition_1 = n;
1144  } else {
1145  num_partition_0 += 1;
1146  if ( possible_root( fold_tree, n ) ) possible_new_root_residue_in_partition_0 = n;
1147  }
1148  }
1149 
1150  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1151  //If moving_res=1 or nres, try putting root at fix res (second best choice)
1152  utility::vector1< core::Size > working_fixed_res( job_parameters_->working_fixed_res() );
1153 
1154  for(Size i=1; i<=working_fixed_res.size(); i++){
1155  Size const seq_num = working_fixed_res[i];
1156  if(partition_definition( seq_num ) && possible_root( fold_tree, seq_num ) ){
1157  possible_new_root_residue_in_partition_1= seq_num;
1158  break;
1159  }
1160  }
1161 
1162  for(Size i=1; i<=working_fixed_res.size(); i++){
1163  Size const seq_num = working_fixed_res[i];
1164  if(!partition_definition( seq_num ) && possible_root( fold_tree, seq_num ) ){
1165  possible_new_root_residue_in_partition_0= seq_num;
1166  break;
1167  }
1168  }
1169 
1170  //If moving_res=1 or nres, try putting root at terminus res (best choice)
1171  utility::vector1< core::Size > working_terminal_res( job_parameters_->working_terminal_res() );
1172 
1173  for(Size i=1; i<=working_terminal_res.size(); i++){
1174  Size const seq_num = working_terminal_res[i];
1175  if(partition_definition( seq_num ) && possible_root( fold_tree, seq_num ) ){
1176  possible_new_root_residue_in_partition_1= seq_num;
1177  break;
1178  }
1179  }
1180 
1181  for(Size i=1; i<=working_terminal_res.size(); i++){
1182  Size const seq_num = working_terminal_res[i];
1183  if(!partition_definition( seq_num ) && possible_root( fold_tree, seq_num ) ){
1184  possible_new_root_residue_in_partition_0= seq_num;
1185  break;
1186  }
1187  }
1188  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1189 
1190  if( (num_partition_0 > 0)==false ) utility_exit_with_message( "num_partition_0 > 0" );
1191  if( (num_partition_1 > 0)==false ) utility_exit_with_message( "num_partition_1 > 0" );
1192 
1193  Size const moving_res( job_parameters_->working_moving_res() );
1194 
1195 
1196  if( num_partition_1 == num_partition_0 ){
1197  if(partition_definition( moving_res )==0){ //put root_res in partition 1 away from the moving_res.
1198  if ( partition_definition( 1 ) && partition_definition( nres ) ) {
1199  root_res = 1;
1200  } else {
1201  root_res = possible_new_root_residue_in_partition_1;
1202  }
1203  }else{ //put root_res in partition 0 away from the moving_res.
1204  if ( !partition_definition( 1 ) && !partition_definition( nres )) {
1205  root_res = 1;
1206  } else {
1207  root_res = possible_new_root_residue_in_partition_0;
1208  }
1209  }
1210  }else if ( num_partition_1 > num_partition_0 ){
1211  // best to put the root in partition 1 -- it is bigger, and will stay anchored.
1212  if ( partition_definition( 1 ) && partition_definition( nres ) ) {
1213  root_res = 1;
1214  } else {
1215  root_res = possible_new_root_residue_in_partition_1;
1216  }
1217  } else {
1218  if ( !partition_definition( 1 ) && !partition_definition( nres )) {
1219  root_res = 1;
1220  } else {
1221  root_res = possible_new_root_residue_in_partition_0;
1222  }
1223  }
1224 
1225  std::cout << "Num. res in partition 0: " << num_partition_0 << ". Num. res in partition 1: " << num_partition_1 << std::endl;
1226  std::cout << "Moving_res full seq_num = " << sub_to_full[moving_res] << ", partition " << partition_definition( moving_res ) << std::endl;
1227  std::cout << "fake_working_moving_suite = " << sub_to_full[fake_working_moving_suite ] << ", partition " << partition_definition( fake_working_moving_suite ) << std::endl;
1228  std::cout << "New root res full seq_num = " << sub_to_full[root_res] << ", partition " << partition_definition( root_res ) << std::endl;
1229 
1230 
1231  if( (root_res > 0)==false ) utility_exit_with_message( "(root_res > 0)==false" );
1232 
1233 
1234  core::kinematics::FoldTree rerooted_fold_tree = fold_tree;
1235  bool reorder_went_OK = rerooted_fold_tree.reorder( root_res );
1236 
1237  if( !reorder_went_OK) utility_exit_with_message( "!reorder_went_OK" );
1238 
1239 
1240  // moving positions
1241  utility::vector1< Size > working_moving_partition_pos;
1242  bool const root_partition = partition_definition( rerooted_fold_tree.root() );
1243 
1244  for (Size seq_num=1; seq_num<=nres; seq_num++){
1245  if ( partition_definition( seq_num ) != root_partition ) working_moving_partition_pos.push_back( seq_num );
1246  }
1247 
1248  job_parameters_->set_working_moving_partition_pos( working_moving_partition_pos );
1249  job_parameters_->set_fold_tree( rerooted_fold_tree );
1250 
1251  Output_fold_tree_info(fold_tree, "StepWiseRNA_JobParameters_Setup::reroot_fold_tree()");
1252 
1253  Output_title_text("");
1254 
1255  return root_res;
1256  }
1257 
1258  ///////////////////////////////////////////////////////////////////////////////////
1259  void
1261 
1262  utility::vector1< std::pair< core::Size, core::Size > > const & chain_boundaries( job_parameters_->chain_boundaries() );
1263 
1264  Size gap_size = 999; // junk value... totally "free" end.
1265  job_parameters_->set_gap_size( gap_size /*DUMMY*/ );
1266  job_parameters_->set_five_prime_chain_break_res( 0 );
1267 
1268  /////////////////////////////////////////////////////////////////////////////////////////////
1269  // Need to look for a chainbreak whose ends actually will move relative to each other if
1270  // we change degrees of freedom in the "moving residues".
1271  ObjexxFCL::FArray1D< bool > const & partition_definition = job_parameters_->partition_definition();
1272 
1273  /////////////////////////////////////////////////////////////////////////////////////////////
1274  std::map< core::Size, core::Size > & full_to_sub( job_parameters_->full_to_sub() );
1275  Size found_moving_gap( 0 );
1276  Size const num_chains = chain_boundaries.size();
1277  for ( Size n = 1; n < num_chains; n++ ) {
1278  Size chain_end = chain_boundaries[ n ].second;
1279  Size next_chain_start = chain_boundaries[ n+1 ].first;
1280  if ( partition_definition( full_to_sub[ chain_end ] ) !=
1281  partition_definition( full_to_sub[ next_chain_start ] ) ){
1282 
1283  bool found_cutpoint_open( false );
1284  for (Size i = 1; i <= cutpoint_open_.size(); i++ ){
1285  if ( cutpoint_open_[i] >= chain_end && cutpoint_open_[i] < next_chain_start ) {
1286  found_cutpoint_open = true;
1287  break;
1288  }
1289  }
1290  if ( found_cutpoint_open ) continue;
1291 
1292  bool found_added_cutpoint_closed_( false );
1293  for (Size i = 1; i <= added_cutpoint_closed_.size(); i++ ){
1294  if ( added_cutpoint_closed_[i] >= chain_end && added_cutpoint_closed_[i] < next_chain_start ) {
1295  found_added_cutpoint_closed_ = true;
1296  break;
1297  }
1298  }
1299  if ( found_added_cutpoint_closed_ ) continue;
1300 
1301  job_parameters_->set_gap_size( next_chain_start - chain_end - 1 );
1302  job_parameters_->set_five_prime_chain_break_res( full_to_sub[ chain_end ] );
1303  found_moving_gap++;
1304 
1305  }
1306  }
1307 
1308  if ( found_moving_gap > 1 ){
1309  utility_exit_with_message( "Had trouble figure out which gap corresponds to the user specified cutpoint_closed! Try to renumber input poses sequentially.");
1310  }
1311 
1312  }
1313  ///////////////////////////////////////////////////////////////////////////////////////////////////
1315  return job_parameters_;
1316  }
1317 
1318  /////////////////////////////////////////////////////////////////
1319  void
1321 
1322  Output_title_text("Enter StepWiseRNA_JobParameters_Setup::figure_out_Prepend_Internal");
1323  std::map< core::Size, core::Size > & sub_to_full( job_parameters_->sub_to_full() );
1324 
1325  ObjexxFCL::FArray1D< bool > const & partition_definition = job_parameters_->partition_definition();
1326  Size const working_moving_res( job_parameters_->working_moving_res() ); //hard copy, since this is set later in the function
1327  utility::vector1< core::Size > const working_moving_res_list( job_parameters_->working_moving_res_list() ); //hard copy, since this is set later in the function
1328  core::kinematics::FoldTree const & fold_tree = job_parameters_->fold_tree();
1329  Size const nres = job_parameters_->working_sequence().size();
1330  Size const fake_working_moving_suite=internal_params.fake_working_moving_suite;
1331 
1332  bool Is_prepend( true ), Is_internal( false );
1333 
1334  // some defaults
1335  job_parameters_->set_Is_prepend( Is_prepend );
1336  job_parameters_->set_Is_internal( Is_internal );
1337  if (skip_complicated_stuff_) return;
1338 
1339  if ( working_moving_res == 1 || fold_tree.is_cutpoint( working_moving_res - 1 ) ) {
1340  Is_prepend = true;
1341  Is_internal = false;
1342  } else if ( fold_tree.is_cutpoint( working_moving_res ) || working_moving_res == nres){ //Are we sure that the 3' res of the chain will always be a cutpoint?
1343  Is_prepend = false;
1344  Is_internal = false;
1345  } else { //The problematic internal case....this case is quite complicated....
1346 
1347  std::cout << "Is_internal case " << std::endl;
1348 
1349  Is_internal = true;
1350 
1351  bool const can_append=assert_can_append(working_moving_res_list); //[14, 13, 12]
1352  bool const can_prepend=assert_can_prepend(working_moving_res_list); //[12, 13, 14]
1353 
1354  Size const possible_working_res_1=internal_params.possible_working_res_1; //lower
1355  Size const possible_working_res_2=internal_params.possible_working_res_2; //upper
1356 
1357  Size found_actual_working_res=0;
1358  utility::vector1< core::Size > actual_working_moving_res_list;
1359  core::Size actual_working_moving_res;
1360 
1361  //OK have to put moving_res AWAY from the root res...
1362  if( partition_definition( possible_working_res_1 ) != partition_definition( root_res ) ){
1363  found_actual_working_res++;
1364  actual_working_moving_res=possible_working_res_1;
1365  Is_prepend=true;
1366 
1367  if(working_moving_res_list.size()==1){
1368  actual_working_moving_res_list.push_back(actual_working_moving_res);
1369  }else{
1370  if(can_prepend){
1371  actual_working_moving_res_list=working_moving_res_list;
1372  }else{
1373  //Ok should prepend base on partition definition, but user input an append working_moving_res_list...need to convert to prepend
1374  for(Size n=working_moving_res_list.size(); n>=1; n--){ //Convert [14,13,12] to [11,12,13]
1375  actual_working_moving_res_list.push_back(working_moving_res_list[n]-1);
1376  }
1377 
1378  if(assert_can_prepend(actual_working_moving_res_list)==false){
1379  Output_seq_num_list("actual_working_moving_res_list= ", actual_working_moving_res_list, 40);
1380  utility_exit_with_message( "actual_working_moving_res_list fails can_prepend assertion");
1381  }
1382  }
1383  }
1384  }
1385 
1386  //OK have to put moving_res AWAY from the root res...
1387  if( partition_definition( possible_working_res_2 ) != partition_definition( root_res ) ){
1388  found_actual_working_res++;
1389  actual_working_moving_res=possible_working_res_2;
1390  Is_prepend=false;
1391 
1392  if(working_moving_res_list.size()==1){
1393  actual_working_moving_res_list.push_back(actual_working_moving_res);
1394  }else{
1395  if(can_append){
1396  actual_working_moving_res_list=working_moving_res_list;
1397  }else{
1398  //Ok should append base on partition definition, but user input an prepend working_moving_res_list...need to convert to append
1399  for(Size n=working_moving_res_list.size(); n>=1; n--){ //Convert [11,12,13] to [14,13,12]
1400  actual_working_moving_res_list.push_back(working_moving_res_list[n]+1);
1401  }
1402 
1403  if(assert_can_append(actual_working_moving_res_list)==false){
1404  Output_seq_num_list("actual_working_moving_res_list= ", actual_working_moving_res_list, 40);
1405  utility_exit_with_message( "actual_working_moving_res_list fails can_append assertion");
1406  }
1407  }
1408  }
1409  }
1410  if(actual_working_moving_res_list[1]!=actual_working_moving_res){
1411  std::cout << "actual_working_moving_res= " << actual_working_moving_res << std::endl;
1412  Output_seq_num_list("actual_working_moving_res_list= ", actual_working_moving_res_list, 40);
1413  utility_exit_with_message( "actual_working_moving_res_list[1]!=actual_working_moving_res" );
1414  }
1415 
1416  if(found_actual_working_res!=1){
1417  std::cout << "found_actual_working_res= " << found_actual_working_res << std::endl;
1418  utility_exit_with_message( "found_actual_working_res!=1" );
1419  }
1420 //////////////////////////////////////////////////////////////
1421 
1422  Output_seq_num_list("actual_working_moving_res_list= ", actual_working_moving_res_list, 40);
1423  Output_seq_num_list("user_input_working_moving_res_list= ", working_moving_res_list, 40);
1424 
1425  std::cout << "User input moving_res full seq_num= " << sub_to_full[working_moving_res] << ", partition " << partition_definition( working_moving_res ) << std::endl;
1426  std::cout << "Actual moving_res full seq_num= " << sub_to_full[actual_working_moving_res_list[1]] << ", partition " << partition_definition( actual_working_moving_res_list[1] ) << std::endl;
1427  std::cout << "New root res full seq_num= " << sub_to_full[root_res] << ", partition " << partition_definition( root_res ) << std::endl;
1428 
1429  //reset working_moving_res and working_moving_res_list
1430  //job_parameters_->set_working_moving_res( actual_working_moving_res);
1431  job_parameters_->set_working_moving_res_list( actual_working_moving_res_list ); //This update working_move_res as well
1432 
1433  //final check!
1434  if(partition_definition( root_res )==partition_definition( actual_working_moving_res_list[1] ) ){
1435  utility_exit_with_message( "partition_definition( root_res )==partition_definition( actual_working_moving_res_list[1]!!" );
1436  }
1437 
1438  }
1439 
1440 
1441  job_parameters_->set_Is_prepend( Is_prepend );
1442  job_parameters_->set_Is_internal( Is_internal );
1443 
1444  //Check...
1445  if( !job_parameters_->Is_internal() ){
1446  bool const should_be_prepend = ( partition_definition( fake_working_moving_suite ) != partition_definition( root_res ) );
1447  if ( should_be_prepend != job_parameters_->Is_prepend() ) {
1448  std::cout << "sub_to_full[fake_working_moving_suite]= " << sub_to_full[fake_working_moving_suite];
1449  std::cout << " partition_definition( fake_working_moving_suite )= " << partition_definition( fake_working_moving_suite );
1450  std::cout << " sub_to_full[root_res]= " << sub_to_full[root_res];
1451  std::cout << " partition_definition( root_res )= " << partition_definition( root_res ) << std::endl;
1452  Output_boolean("should_be_prepend= ", should_be_prepend); Output_boolean(" job_parameters_->Is_prepend() = ", job_parameters_->Is_prepend() ); std::cout << std::endl;
1453  utility_exit_with_message( "Possible problem with prepend/append assignment!!" );
1454  }
1455  }
1456  }
1457 
1458 
1459 /*
1460  if(Is_prepend){
1461  if(can_prepend){
1462  actual_working_moving_res_list=working_moving_res_list;
1463  }else{
1464  //Ok should prepend base on partition definition, but user input an append working_moving_res_list...need to convert to prepend
1465  for(Size n=working_moving_res_list.size(); n>=1; n--){ //Convert [14,13,12] to [11,12,13]
1466  actual_working_moving_res_list.push_back(working_moving_res_list[n]-1);
1467  }
1468 
1469  if(assert_can_prepend(actual_working_moving_res_list)==false){
1470  Output_seq_num_list("actual_working_moving_res_list= ", actual_working_moving_res_list, 40);
1471  utility_exit_with_message( "actual_working_moving_res_list fails can_prepend assertion");
1472  }
1473  }
1474  }else{
1475  if(can_append){
1476  actual_working_moving_res_list=working_moving_res_list;
1477  }else{
1478  //Ok should append base on partition definition, but user input an prepend working_moving_res_list...need to convert to append
1479  for(Size n=working_moving_res_list.size(); n>=1; n--){ //Convert [11,12,13] to [14,13,12]
1480  actual_working_moving_res_list.push_back(working_moving_res_list[n]+1);
1481  }
1482 
1483  if(assert_can_append(actual_working_moving_res_list)==false){
1484  Output_seq_num_list("actual_working_moving_res_list= ", actual_working_moving_res_list, 40);
1485  utility_exit_with_message( "actual_working_moving_res_list fails can_append assertion");
1486  }
1487  }
1488  }
1489 */
1490  //////////////////////////////////////////////////////////////////////////
1491 
1492 
1493 
1494 
1495  //////////////////////////////////////////////////////////////////////////
1496  void
1498 
1499  Output_title_text("Enter StepWiseRNA_JobParameters_Setup::set_fixed_res");
1500 
1501  fixed_res_ = fixed_res;
1502 
1503  using namespace ObjexxFCL;
1504 
1505 
1506 
1507  Output_seq_num_list("moving_res_list= ", moving_res_list_, 30);
1508 
1509  Output_boolean("allow_fixed_res_at_moving_res_= ", allow_fixed_res_at_moving_res_ ); std::cout << std::endl;
1510 
1511 
1512  if(allow_fixed_res_at_moving_res_==false){ //Nov 15, 2010 (the outer if statement)
1513  for(Size n=1; n<=moving_res_list_.size(); n++){
1515  utility_exit_with_message( "moving_res " + string_of(moving_res_list_[n]) + " should not be in fixed_res_list!");
1516  }
1517  }
1518  }
1519 
1521 
1522  Output_title_text("");
1523 
1524  }
1525 
1526  //////////////////////////////////////////////////////////////////////////
1527  void
1529 
1530 
1531  job_parameters_->set_working_terminal_res( apply_full_to_sub_mapping( terminal_res , StepWiseRNA_JobParametersCOP(job_parameters_) ) );
1532 
1533 
1534 // Output_seq_num_list("working_terminal_res= ", job_parameters_->working_terminal_res(), 30);
1535 
1536  }
1537 
1538  //////////////////////////////////////////////////////////////////////////
1539 
1540  void
1542 
1543  utility::vector1< core::Size > const & is_working_res( job_parameters_->is_working_res() );
1544  utility::vector1< core::Size > actual_rmsd_res_list;
1545 
1546  for(Size n=1; n<=input_rmsd_res_list.size(); n++){
1547  Size seq_num=input_rmsd_res_list[n];
1548  if( !is_working_res[seq_num] ) continue;
1549  actual_rmsd_res_list.push_back(seq_num);
1550  }
1551 
1552  job_parameters_->set_rmsd_res_list( actual_rmsd_res_list );
1553 
1554  }
1555 
1556  //////////////////////////////////////////////////////////////////////////
1557  //example input: "1-2-3-4-5-6-7-8-9-10-11-12-25-26 19-20"
1558 
1559 
1560  void
1562 
1563  jump_point_pair_list_.clear();
1564 
1565  if(jump_point_pairs_string.size()==0) return;
1566 
1567  if(fixed_res_.size()==0) utility_exit_with_message( "need to called set_fixed_res before calling set_jump_point_pair_list" );
1568 
1569  bool assert_in_fixed_res=true;
1570 
1571  for(Size n=1; n<=jump_point_pairs_string.size(); n++){
1572 
1573 
1574  if( (n==1) && (jump_point_pairs_string[n]=="NOT_ASSERT_IN_FIXED_RES") ){ //Feb 09, 2012: FIXED BUG. Used to be "and" instead of "&&"
1575 
1576  assert_in_fixed_res=false;
1577  continue;
1578  }
1579 
1580  utility::vector1< std::string > JP_pair_string=Tokenize(jump_point_pairs_string[n], "-");
1581  if(JP_pair_string.size()!=2) utility_exit_with_message( "Each jump_point_pair need to have two elements! (e.g. 1-10)");
1582 
1583  std::pair< core::Size, core::Size > jump_point_pair=std::make_pair(string_to_int(JP_pair_string[1]), string_to_int(JP_pair_string[2]) );
1584 
1585  if(jump_point_pair.first >= jump_point_pair.second ){
1586  output_pair_size(jump_point_pair);
1587  utility_exit_with_message( "jump_point_pair.first >= jump_point_pair.second!");
1588  }
1589 
1590  jump_point_pair_list_.push_back( jump_point_pair );
1591  }
1592 
1593 
1594  Sort_pair_list(jump_point_pair_list_); //sort the BP list by the 1st element
1595 
1596  output_pair_size_vector(jump_point_pair_list_, "jump_point_pair_list: ");
1597 
1598  Output_boolean("assert_in_fixed_res= ", assert_in_fixed_res);
1599 
1600  //Ensure that every seq_num in jump_point_pair_list_ is a fixed_res
1601  if(assert_in_fixed_res==true){
1602  for(Size n=1; n<=jump_point_pair_list_.size(); n++){
1603 
1604  if(Contain_seq_num(jump_point_pair_list_[n].first, fixed_res_) ==false){
1605  utility_exit_with_message( "seq_num ("+ ObjexxFCL::string_of(jump_point_pair_list_[n].first) +") is in jump_point_pair_list_ but is not a fixed res!");
1606  }
1607 
1608  if(Contain_seq_num(jump_point_pair_list_[n].second, fixed_res_)==false){
1609  utility_exit_with_message( "seq_num ("+ ObjexxFCL::string_of(jump_point_pair_list_[n].second) +") is in jump_point_pair_list_ but is not a fixed res!");
1610  }
1611 
1612  }
1613  }
1614  }
1615 
1616  //////////////////////////////////////////////////////////////////////////
1617 
1618  void
1620 
1621  utility::vector1< Size > const native_alignment = setting;
1622 
1623  job_parameters_->set_native_alignment( native_alignment );
1624  job_parameters_->set_working_native_alignment( apply_full_to_sub_mapping( native_alignment, StepWiseRNA_JobParametersCOP(job_parameters_) ) );
1625 
1626  Output_title_text("StepWiseRNA_JobParameters_Setup::set_native_alignment_res");
1627  Output_seq_num_list("native_alignment= ", job_parameters_->native_alignment() );
1628  Output_seq_num_list("working_native_alignment= ", job_parameters_->working_native_alignment() );
1629  Output_title_text("");
1630 
1631  }
1632  //////////////////////////////////////////////////////////////////////////
1633 
1634  void
1636 
1637  utility::vector1< Size > const global_sample_res_list = setting;
1638  job_parameters_->set_global_sample_res_list( global_sample_res_list );
1639 
1640  }
1641 
1642  //////////////////////////////////////////////////////////////////////////
1643 
1644  void
1646 
1647  utility::vector1< Size > const force_syn_chi_res_list = setting;
1648  job_parameters_->set_force_syn_chi_res_list( force_syn_chi_res_list );
1649 
1650  }
1651 
1652  //////////////////////////////////////////////////////////////////////////
1653 
1654  void
1656 
1657  utility::vector1 < core::Size > const force_north_ribose_list=setting;
1658  job_parameters_->set_force_north_ribose_list( force_north_ribose_list );
1659 
1660  }
1661 
1662  //////////////////////////////////////////////////////////////////////////
1663 
1664  void
1666 
1667  utility::vector1 < core::Size > const force_south_ribose_list=setting;
1668  job_parameters_->set_force_south_ribose_list( force_south_ribose_list );
1669 
1670  }
1671 
1672  //////////////////////////////////////////////////////////////////////////
1673 
1674  void
1676 
1677  utility::vector1 < core::Size > const protonated_H1_adenosine_list=setting;
1678  job_parameters_->set_protonated_H1_adenosine_list( protonated_H1_adenosine_list );
1679 
1680  }
1681 
1682 
1683  //////////////////////////////////////////////////////////////////////////
1684  void
1686 
1687  job_parameters_->set_output_extra_RMSDs( setting);
1688 
1689  }
1690  //////////////////////////////////////////////////////////////////////////
1691  void
1693 
1694  job_parameters_->set_add_virt_res_as_root(setting );
1695 
1696  }
1697  //////////////////////////////////////////////////////////////////////////
1698 }
1699 }
1700 }