Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GreedyOptMutationMover.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 sw=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 /// @author Chris King (chrisk1@uw.edu)
11 //#include <algorithm >
17 #include <core/pose/PDBInfo.hh>
18 #include <fstream>
19 // AUTO-REMOVED #include <utility/file/FileName.hh>
20 #include <iostream>
21 // AUTO-REMOVED #include <basic/options/keys/in.OptionKeys.gen.hh>
22 // AUTO-REMOVED #include <basic/options/option_macros.hh>
23 #include <numeric/random/random.hh>
24 #include <numeric/random/random_permutation.hh>
26 #include <core/pose/Pose.hh>
29 #include <utility/tag/Tag.hh>
31 // AUTO-REMOVED #include <protocols/moves/DataMap.hh>
32 #include <basic/Tracer.hh>
38 // AUTO-REMOVED #include <core/pack/task/operation/TaskOperations.hh>
40 #include <utility/vector1.hh>
41 #include <protocols/moves/Mover.hh>
42 #include <protocols/jd2/util.hh>
43 #include <boost/foreach.hpp>
44 #define foreach BOOST_FOREACH
49 #include <protocols/jd2/Job.hh>
50 #include <utility/vector0.hh>
53 #include <utility/string_util.hh>
54 #include <utility/io/ozstream.hh>
55 
56 //Auto Headers
57 #include <utility/excn/Exceptions.hh>
58 #include <basic/options/keys/OptionKeys.hh>
59 
60 namespace protocols {
61 namespace design_opt {
62 
63 static basic::Tracer TR( "protocols.design_opt.GreedyOptMutationMover" );
64 static numeric::random::RandomGenerator RG( 27188 );
65 using namespace core;
66 using namespace chemical;
67 using utility::vector1;
68 using std::pair;
69 
70 ///@brief default ctor
72  Mover( GreedyOptMutationMoverCreator::mover_name() ),
73  task_factory_( NULL ),
74 // filters_( NULL ), /* how set default vecgtor of NULLs? */
75 // sample_type_( "low" ),
76  scorefxn_( NULL ),
77  relax_mover_( NULL ),
78  dump_pdb_( false ),
79  dump_table_( false ),
80  parallel_( false ),
81  stopping_condition_( NULL ),
82  stop_before_condition_( false ),
83  skip_best_check_( false ),
84  rtmin_( false ),
85  shuffle_order_( false ),
86  nstruct_iter_( 1 )
87 {}
88 
89 //full ctor
93  protocols::moves::MoverOP relax_mover,
95  vector1< std::string > sample_types,
96  vector1< core::Real > filter_deltas,
97  bool dump_pdb,
98  bool dump_table,
99  bool parallel,
100  bool stop_before_condition,
101  bool skip_best_check,
102  bool rtmin,
103  bool shuffle_order,
104  protocols::filters::FilterOP stopping_condition
105 ) :
106  Mover( GreedyOptMutationMoverCreator::mover_name() )
107 {
109  filters_ = filters;
118  rtmin_ = rtmin;
121  nstruct_iter_ = 1;
122 }
123 
124 //destruction!
126 
127 //creators
130  return new GreedyOptMutationMover;
131 }
132 
135  return new GreedyOptMutationMover( *this );
136 }
137 
138 //name getters
141 {
143 }
144 
147 {
148  return "GreedyOptMutationMover";
149 }
150 
154 }
155 
156 // setter - getter pairs
157 void
159  relax_mover_ = mover;
161 }
162 
165  return relax_mover_;
166 }
167 
168 void
170  filters_ = filters;
172 }
173 
175  return filters_;
176 }
177 
178 void
180 {
183 }
184 
187 {
188  return task_factory_;
189 }
190 
191 void
195 }
196 
197 bool
199  return dump_pdb_;
200 }
201 
202 void
203 GreedyOptMutationMover::dump_table( bool const dump_table ){
206 }
207 
208 bool
210  return dump_table_;
211 }
212 
213 void
214 GreedyOptMutationMover::stop_before_condition( bool const stop_before_condition ){
216 }
217 
218 bool
220  return stop_before_condition_;
221 }
222 
223 void
224 GreedyOptMutationMover::skip_best_check( bool const skip_best_check ){
226 }
227 
228 bool
230  return skip_best_check_;
231 }
232 
233 void
235  rtmin_ = b;
236 }
237 
238 bool
240 
241 void
243  shuffle_order_ = b;
244 }
245 
246 bool
248 
251  return reset_delta_filters_;
252 }
253 
254 void
257 }
258 
259 void
263 }
264 
267  return sample_types_;
268 }
269 
270 void
274 }
275 
278  return filter_deltas_;
279 }
280 
281 void
285 }
286 
289  return scorefxn_;
290 }
291 
292 void
293 GreedyOptMutationMover::parallel( bool const parallel ){
295 }
296 
297 bool
299  return parallel_;
300 }
301 
302 //utility funxns for comparing values in sort
303 bool
305  pair< Size, Real > const pair1,
306  pair< Size, Real > const pair2 )
307 {
308  return pair1.second < pair2.second;
309 }
310 
311 bool
313  pair< AA, vector1< Real > > const pair1,
314  pair< AA, vector1< Real > > const pair2 )
315 {
316  return pair1.second[ 1 ] < pair2.second[ 1 ];
317 }
318 
319 bool
321  pair< Size, vector1< pair< AA, vector1< Real > > > > const pair1,
322  pair< Size, vector1< pair< AA, vector1< Real > > > > const pair2 )
323 {
324  return pair1.second[ 1 ].second[ 1 ] < pair2.second[ 1 ].second[ 1 ];
325 }
326 
327 void
329  seqpos_aa_vals_vec_.clear();
330  pfront_poses_.clear();
333  ref_pose_.clear();
334 }
335 
336 //TODO: this should also compare fold trees
337 bool
339  core::pose::Pose const & pose1,
340  core::pose::Pose const & pose2
341 ){
342  //first check for all restype match, also checks same number res
343  if( !pose1.conformation().sequence_matches( pose2.conformation() ) ) return false;
344  //then check for all coords identical
345  for ( Size i = 1; i <= pose1.total_residue(); ++i ) {
346  core::conformation::Residue const & rsd1( pose1.residue( i ) );
347  core::conformation::Residue const & rsd2( pose2.residue( i ) );
348  //check same n atoms
349  if( rsd1.natoms() != rsd2.natoms() ) return false;
350  //and coords
351  for( Size ii = 1; ii <= rsd1.natoms(); ++ii ) {
352  if( rsd1.xyz( ii ).x() != rsd2.xyz( ii ).x() ) return false;
353  if( rsd1.xyz( ii ).y() != rsd2.xyz( ii ).y() ) return false;
354  if( rsd1.xyz( ii ).z() != rsd2.xyz( ii ).z() ) return false;
355  }
356  }
357  return true;
358 }
359 
360 void
362  //(re)init ranks w/ bogus zero data
364  vector1< Size >( pfront_poses_filter_vals_[ 1 ].size(), Size( 0 ) ) );
365  //for each filter type
366  for( Size ifilt = 1; ifilt <= pfront_poses_filter_vals_[ 1 ].size(); ++ifilt ){
367  //copy all this filter vals into a vector of pair< index, val >
368  vector1< pair< Size, Real > > filter_index_vals;
369  for( Size ipose = 1; ipose <= pfront_poses_filter_vals_.size(); ++ipose ){
370  filter_index_vals.push_back( pair< Size, Real >( ipose, pfront_poses_filter_vals_[ ipose ][ ifilt ] ) );
371  }
372  //and sort by value
373  std::sort( filter_index_vals.begin(), filter_index_vals.end(), cmp_pair_by_second );
374  //now can get rank and index
375  for( Size rank = 1; rank <= filter_index_vals.size(); ++rank ){
376  Size ipose( filter_index_vals[ rank ].first );
377  pfront_poses_filter_ranks_[ ipose ][ ifilt ] = rank;
378  }
379  }
380 }
381 
382 //Yes, I'm aware this is the slowest and simplest implementation of pareto front
383 // identification, but this needs to be finished 2 days ago
384 // and this calc is hardly the rate limiting step with a bunch of repacking and filter evals
385 //calc_single_pos_pareto_front
386 //takes a set (vec1) of coords
387 //populates boolean vector w/ is_pareto?
388 void
390  vector1< vector1< Real > > const & coords,
391  vector1< bool > & is_pfront
392 ){
393  assert( coords.size() == is_pfront.size() );
394  //n coords, d dimensions
395  Size n( coords.size() );
396  Size d( coords[ 1 ].size() );
397  //for each point
398  for( Size i = 1; i <= n; ++i ){
399  bool is_dom( false );
400  //check if strictly dominated by another point
401  for( Size j = 1; j <= n; ++j ){
402  if( j == i ) continue;
403  is_dom = true;
404  bool is_equal = true;
405  for( Size k = 1; k <= d; ++k ){
406  //check for same coords
407  is_equal = is_equal && ( coords[ i ][ k ] == coords[ j ][ k ] );
408  //i not dominated by j if less in any dimension
409  if( coords[ i ][ k ] < coords[ j ][ k ] ){
410  is_dom = false;
411  break;
412  }
413  }
414  if( is_equal ) is_dom = false;
415  if( is_dom ) break;
416  }
417  if( is_dom ) is_pfront[ i ] = false;
418  else is_pfront[ i ] = true;
419  }
420 }
421 
422 //removes seqpos aa/vals from set that are not pareto optimal
423 //TODO: keep nonpareto points that are within filter_delta of nearest pareto point
424 void
426  for( Size iseq = 1; iseq <= seqpos_aa_vals_vec_.size(); ++iseq ){
427  vector1< bool > is_pfront( seqpos_aa_vals_vec_[ iseq ].second.size(), false );
429  //get a vec of vecs from the data
430  for( Size i = 1; i <= seqpos_aa_vals_vec_[ iseq ].second.size(); ++i ){
431  vals.push_back( seqpos_aa_vals_vec_[ iseq ].second[ i ].second );
432  }
433  //get is_pareto bool vec
434  calc_pareto_front( vals, is_pfront );
435  //find points within filter_delta of pareto points
436 
437  vector1< bool > is_pfront_nbr( seqpos_aa_vals_vec_[ iseq ].second.size(), false );
438  //replace aa/vals vector with pareto opt only
439  vector1< pair< AA, vector1< Real > > > pfront_aa_vals;
440  for( Size iaa = 1; iaa <= seqpos_aa_vals_vec_[ iseq ].second.size(); ++iaa ){
441  if( is_pfront[ iaa ] ) pfront_aa_vals.push_back( seqpos_aa_vals_vec_[ iseq ].second[ iaa ] );
442  }
443  seqpos_aa_vals_vec_[ iseq ].second = pfront_aa_vals;
444  }
445 }
446 
447 //filters a pose vec for pareto opt only
448 void
450  vector1< pose::Pose > & poses,
451  vector1< vector1< Real > > & vals
452 ){
453  //get is_pareto bool vec
454  vector1< bool > is_pfront( poses.size(), false );
455  calc_pareto_front( vals, is_pfront );
456  //remove entries that are not pareto
457  vector1< pose::Pose > pfront_poses;
458  vector1< vector1< Real > > pfront_vals;
459  for( Size ipose = 1; ipose <= poses.size(); ++ipose ){
460  if( is_pfront[ ipose ] ){
461  pfront_poses.push_back( poses[ ipose ] );
462  pfront_vals.push_back( vals[ ipose ] );
463  }
464  }
465  poses = pfront_poses;
466  vals = pfront_vals;
467 }
468 
469 //this should be in PointMutCalc
470 void
472  utility::io::ozstream outtable(filename, std::ios::out | std::ios::app ); // Append if logfile already exists.
473  if( outtable ){
474  for( core::Size ii(1); ii <= seqpos_aa_vals_vec_.size(); ++ii) {
475  core::Size pos( seqpos_aa_vals_vec_[ii].first );
477  outtable << pos ;
478  if( ref_pose.pdb_info() ) {
479  outtable << " (" << ref_pose.pdb_info()->pose2pdb(pos) << ")";
480  }
481  outtable << '\t';
482  for( core::Size jj(1); jj <= aa_pairs.size(); ++jj ) {
483  outtable << aa_pairs[jj].first << ((ref_pose.aa(pos) == aa_pairs[jj].first)?"*:":":");
484  for( core::Size kk( 1 ); kk <= aa_pairs[ jj ].second.size(); ++kk ){
485  outtable << aa_pairs[jj].second[ kk ] << ":";
486  }
487  outtable << " ";
488  }
489  outtable << std::endl;
490  }
491  outtable << std::endl; // Blank line at end to seperate.
492  } else {
493  TR.Warning << "WARNING: Unable to open file " << filename << " for writing GreedyOptMutationMover table output." << std::endl;
494  }
495  outtable.close();
496 }
497 
498 
499 void
501 {
502  using namespace core::pack::task;
503  using namespace core::pack::task::operation;
504  using namespace core::chemical;
505 
506  //store input pose
507  core::pose::Pose start_pose( pose );
509  task_factory(), scorefxn(), relax_mover(), filters(), sample_types(), dump_pdb(), false, parallel() ) );
510 
511  //create vec of pairs of seqpos, vector of AA/val pairs that pass input filter
512  //then combine them into a pareto opt pose set
513  //only calc the ptmut data and pareto set once per pose, not at every nstruct iteration
514  //but how will we know if that data is still valid? what if the pose has chnged?
515  //the best answer is to store the pose passed to apply in a private variable (ref_pose_)
516  //and only calc if ref_pose_ is still undef or doesnt match apply pose
517  //also recalc if pareto pose set is empty
518  if( pfront_poses_.empty() || ref_pose_.empty() || !pose_coords_are_same( start_pose, ref_pose_ ) ){
519  //reset our private data
521  //and (re)set ref_pose_ to this pose
522  ref_pose_ = start_pose;
523 
524  //get the point mut values
525  ptmut_calc->calc_point_mut_filters( start_pose, seqpos_aa_vals_vec_ );
526  if( seqpos_aa_vals_vec_.size() < 1 ){
527  utility_exit_with_message( "ERROR: No acceptable mutations found. All possible mutations failed at least one filter!" );
528  }
529  //this part sorts the seqpos/aa/val data so that we init with something good (1st)
530  //first over each seqpos by aa val, then over all seqpos by best aa val
531  for( Size ivec = 1; ivec <= seqpos_aa_vals_vec_.size(); ++ivec ){
532  //skip if aa/vals vector is empty
533  if( seqpos_aa_vals_vec_[ ivec ].second.empty() ) continue;
534  //sort aa/vals in incr val order
535  std::sort( seqpos_aa_vals_vec_[ ivec ].second.begin(),
536  seqpos_aa_vals_vec_[ ivec ].second.end(), cmp_pair_by_first_vec_val );
537  }
538  //now sort seqpos_aa_vals_vec_ by *first* (lowest) val in each seqpos vector, low to high
539  //uses cmp_pair_vec_by_first_vec_val to sort based on second val in
540  //first pair element of vector in pair( size, vec( pair ) )
542 
543  //finally, dump table to file, if requested.
544  if( dump_table() ){
545  std::string fname( "GreedyOptTable" );
546  if( protocols::jd2::jd2_used() ){
547  fname += "_" + protocols::jd2::current_output_name();
548  }
549  fname += ".tab";
550  dump_scoring_table( fname, start_pose );
551  }
552 
553  //this part gets rid of ptmuts that are not pareto opt
555 
556  //now randomize the sequence position order?
557  if( shuffle_order() ){
558  numeric::random::random_permutation( seqpos_aa_vals_vec_.begin(), seqpos_aa_vals_vec_.end(), RG );
559  TR<<"Combining shuffled mutations… " << std::endl;
560  }
561  else TR<<"Combining sorted mutations… " << std::endl;
562 
563  //init pareto opt poses with first mutations for now
564  //TODO: is there a better way to init?
565  Size iseq_init( 1 );
566  //the resi index is the first part of the pair
567  Size resi_init( seqpos_aa_vals_vec_[ iseq_init ].first );
568  for( Size iaa = 1; iaa <= seqpos_aa_vals_vec_[ iseq_init ].second.size(); ++iaa ){
569  AA target_aa( seqpos_aa_vals_vec_[ iseq_init ].second[ iaa ].first );
570  pose::Pose new_pose( start_pose );
571  ptmut_calc->mutate_and_relax( new_pose, resi_init, target_aa );
572  //dont need to eval filters because we already know they passed because are in the table
573  pfront_poses_.push_back( new_pose );
574  }
575 
576  //now try to combine pareto opt mutations
577  for( Size iseq = 2; iseq <= seqpos_aa_vals_vec_.size(); ++iseq ){
578  //create new pose vec to hold all combinations
579  vector1< pose::Pose > new_poses;
580  vector1< vector1< Real > > new_poses_filter_vals;
581  //the resi index is the first part of the pair
582  Size seqpos( seqpos_aa_vals_vec_[ iseq ].first );
583  TR << "Combining " << pfront_poses_.size() << " structures with mutations at residue " << seqpos << std::endl;
584  //over each current pfront pose
585  //pfront_poses_ contains all the current poses
586  for( Size ipose = 1; ipose <= pfront_poses_.size(); ++ipose ){
587  //over all aa's at seqpos
588  for( Size iaa = 1; iaa <= seqpos_aa_vals_vec_[ iseq ].second.size(); ++iaa ){
589  //inside this double loop, all pfront_poses_ are combined with all muts at this position
590  AA target_aa( seqpos_aa_vals_vec_[ iseq ].second[ iaa ].first );
591  pose::Pose new_pose( pfront_poses_[ ipose ] );
592 
593  bool filter_pass;
594  vector1< Real > vals;
595  ptmut_calc->mutate_and_relax( new_pose, seqpos, target_aa );
596  ptmut_calc->eval_filters( new_pose, filter_pass, vals );
597  //only check this guy for pareto if passes
598  if( !filter_pass ) continue;
599 
600  new_poses.push_back( new_pose );
601  new_poses_filter_vals.push_back( vals );
602  }
603  }
604 // TR << "Generated " << new_poses.size() << " new poses from mutations at residue "
605 // << seqpos << ". Filtering... " << std::endl;
606 
607  //only update pfront poses if we found any new ones, else just skip this position,
608  // because we know our current pose does pass all the filters
609  if( new_poses.size() < 1 ){
610  TR << "Unable to generate any new poses that pass all filters at position " << iseq << std::endl;
611  continue;
612  }
613 
614  //end optimization if *any* of the new pareto poses trips the stopping_condition
615  bool stop( false );
616  for( Size ipose = 1; ipose <= new_poses.size(); ++ipose ){
617  pose::Pose new_pose( new_poses[ ipose ] );
618  if( stopping_condition() && stopping_condition()->apply( new_pose ) ){
619  stop = true;
620  if( !stop_before_condition() ) TR<<"Stopping condition evaluates to true. Stopping early and acceptingn the last mutation: "<<
621  start_pose.residue( seqpos ).name1() << seqpos << new_pose.residue( seqpos ).name1() << std::endl;
622  else TR<<"Stopping condition evaluates to true. Stopping early and rejecting the last mutation."
623  << start_pose.residue( seqpos ).name1() << seqpos << new_pose.residue( seqpos ).name1() << std::endl;
624  break;
625  }
626  }
627 
628  if( stop && stop_before_condition() ) break;
629  //if forcing new mutations, then reset pose cache and filter just the new guys
630  if( skip_best_check() ){
631  pfront_poses_ = new_poses;
632  pfront_poses_filter_vals_ = new_poses_filter_vals;
633  } else{
634  //default: add the new poses to the pose cache then pareto filter
635  for( Size ipose = 1; ipose <= new_poses.size(); ++ipose ){
636  pfront_poses_.push_back( new_poses[ ipose ] );
637  pfront_poses_filter_vals_.push_back( new_poses_filter_vals[ ipose ] );
638  }
639  }
640 
641  //filter new_poses for the pareto opt set
643 
644  //break out if we've reached our stopping condition
645  if( stop ) break;
646 
647  //Optionally reset baseline for Delta Filters (useful so that the mutations are still evaluated on an individual basis, in the context of the current best pose).
648  foreach( protocols::simple_filters::DeltaFilterOP const delta_filter, reset_delta_filters_ ){
649  std::string const fname( delta_filter->get_user_defined_name() );
650  core::Real const fbaseline( delta_filter->filter()->report_sm( pose ) );
651  delta_filter->baseline( fbaseline );
652  delta_filter->ref_baseline( fbaseline );
653  TR<<"Reset baseline for DeltaFilter "<<fname<<" to "<<fbaseline<<std::endl;
654  }
655  }
656  TR << "Generated " << pfront_poses_.size() << " final structures" << std::endl;
658  }
659  //assign the apply pose to the next pfront_pose
660  Size pfront_pose_iter( ( nstruct_iter_ - 1 ) % pfront_poses_.size() + 1 );
661  pose = pfront_poses_[ pfront_pose_iter ];
662  //print out filter vals for this pose
663  TR << "Structure " << nstruct_iter_ << " filter values: ";
664  for( Size ival = 1; ival <= pfront_poses_filter_vals_[ pfront_pose_iter ].size(); ++ival ){
665  TR << " " << filters()[ ival ]->get_user_defined_name() << ": "
666  << pfront_poses_filter_vals_[ pfront_pose_iter ][ ival ];
667  }
668  TR << std::endl;
669  TR << "Structure " << nstruct_iter_ << " filter ranks: ";
670  for( Size ival = 1; ival <= pfront_poses_filter_ranks_[ pfront_pose_iter ].size(); ++ival ){
671  TR << " " << filters()[ ival ]->get_user_defined_name() << ": "
672  << pfront_poses_filter_ranks_[ pfront_pose_iter ][ ival ];
673  }
674  TR << std::endl;
675  TR.flush();
676 
677  //increment pose iterator to get new pfront_pose at nstruct+1
678  nstruct_iter_ += 1;
679 }
680 
681 
682 void
684 {
685  //filter_delta should always be a scalar!
686  if( filter_delta < Real( 0. ) ) filter_delta = -1 * filter_delta;
687  filters_.push_back( filter );
688  sample_types_.push_back( sample_type );
689  filter_deltas_.push_back( filter_delta );
690 }
691 
692 //parse rosetta scripts tags
693 void
697  protocols::moves::Movers_map const & movers,
698  core::pose::Pose const & )
699 {
700  TR << "GreedyOptMutationMover"<<std::endl;
702  //load relax mover
703  std::string const relax_mover_name( tag->getOption< std::string >( "relax_mover", "null" ) );
704  protocols::moves::Movers_map::const_iterator mover_it( movers.find( relax_mover_name ) );
705  if( mover_it == movers.end() )
706  throw utility::excn::EXCN_RosettaScriptsOption( "Relax mover "+relax_mover_name+" not found" );
707  relax_mover( mover_it->second );
708  //load scorefxn
710  //load dump_pdb
711  dump_pdb( tag->getOption< bool >( "dump_pdb", false ) );
712  //load dump_table
713  dump_table( tag->getOption< bool >( "dump_table", false ) );
714  parallel( tag->getOption< bool >( "parallel", false ) );
715  if( tag->hasOption( "stopping_condition" ) ){
716  std::string const stopping_filter_name( tag->getOption< std::string >( "stopping_condition" ) );
717  stopping_condition( protocols::rosetta_scripts::parse_filter( stopping_filter_name, filters ) );
718  TR<<"Defined stopping condition "<<stopping_filter_name<<std::endl;
719  }
720 
721  //load multiple filters from branch tags
722  utility::vector1< utility::tag::TagPtr > const branch_tags( tag->getTags() );
723  foreach( utility::tag::TagPtr const btag, branch_tags ){
724  if( btag->getName() == "Filters" ){
725  utility::vector1< utility::tag::TagPtr > const filters_tags( btag->getTags() );
726  foreach( utility::tag::TagPtr const ftag, filters_tags ){
727  std::string const filter_name( ftag->getOption< std::string >( "filter_name" ) );
728  Filters_map::const_iterator find_filt( filters.find( filter_name ));
729  if( find_filt == filters.end() ) {
730  TR.Error << "Error !! filter not found in map: \n" << tag << std::endl;
731  runtime_assert( find_filt != filters.end() );
732  }
733  std::string const samp_type( ftag->getOption< std::string >( "sample_type", "low" ));
734  core::Real filter_delta( tag->getOption< core::Real >( "filter_delta", core::Real( 0. ) ) );
735  add_filter( find_filt->second->clone(), samp_type, filter_delta );
736  } //foreach ftag
737  }// fi Filters
738  else
739  throw utility::excn::EXCN_RosettaScriptsOption( "tag name " + btag->getName() + " unrecognized." );
740  }//foreach btag
741  //load single filter
742  {
743  std::string const filter_name( tag->getOption< std::string >( "filter", "true_filter" ) );
744  if( filter_name != "true_filter" || filters_.size() < 1 ){
745  protocols::filters::Filters_map::const_iterator find_filt( filters.find( filter_name ) );
746  if( find_filt == filters.end() )
747  throw utility::excn::EXCN_RosettaScriptsOption( "Filter "+filter_name+" not found" );
748  std::string const samp_type( tag->getOption< std::string >( "sample_type", "low" ) );
749  core::Real filter_delta( tag->getOption< core::Real >( "filter_delta", core::Real( 0. ) ) );
750  //only add the default dummy filter if we dont have any others, allows user to define filters in branch tags only
751  add_filter( find_filt->second->clone(), samp_type, filter_delta );
752  }
753  }
754 
755  //get filters to reset each time a mutation is accepted. For instance, reset the baseline value of delta filters to be the best pose.
756  utility::vector1< std::string > delta_filter_names;
757  delta_filter_names.clear();
758  if( tag->hasOption( "reset_delta_filters" ) ){
759  delta_filter_names = utility::string_split( tag->getOption< std::string >( "reset_delta_filters" ), ',' );
760  foreach( std::string const fname, delta_filter_names ){
761  reset_delta_filters_.push_back( dynamic_cast< protocols::simple_filters::DeltaFilter * >( protocols::rosetta_scripts::parse_filter( fname, filters )() ) );
762  TR<<"The baseline for Delta Filter "<<fname<<" will be reset upon each accepted mutation"<<std::endl;
763  }
764  }
765  //should mutations be allowed around the tested/introduced point mutation, if so, what shell radius
766  design_shell_ = tag->getOption< core::Real >( "design_shell", -1.0 );
767  //repack which radius after mutating
768  repack_shell_ = tag->getOption< core::Real >( "repack_shell", 8.0 );
769  //stop mover once the stopping_condition is reached and do not accept the last mutation (ie, reject the mutation that set the stopping_condition to true)
770  stop_before_condition( tag->getOption< bool >( "stop_before_condition", false ) );
771  //accept mutations during the combining stage as long as they pass the filter(s), regardless of whether or not the value is the best so far.
772  skip_best_check( tag->getOption< bool >( "skip_best_check", false ) );
773  rtmin( tag->getOption< bool >( "rtmin", false ) );
774  //load shuffle_order
775  shuffle_order( tag->getOption< bool >( "shuffle_order", false ) );
776 
777 
778 }
779 
780 
781 } // moves
782 } // protocols