Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SymDockProtocol.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 // This file is part of the Rosetta software suite and is made available under license.
5 // The Rosetta software is developed by the contributing members of the Rosetta Commons consortium.
6 // (C) 199x-2009 Rosetta Commons participating institutions and developers.
7 // For more information, see http://www.rosettacommons.org/.
8 
9 /// @file protocols/symmetric_docking/SymDockProtocol.cc
10 ///
11 /// @brief
12 /// @author Ingemar Andre
13 
14 
17 
18 ////////////
20 #include <basic/options/option.hh>
21 
22 #include <core/pose/Pose.hh>
23 #include <basic/datacache/BasicDataCache.hh>
25 // AUTO-REMOVED #include <core/io/pdb/pose_io.hh>
26 
27 #include <core/scoring/Energies.hh>
28 #include <core/scoring/rms_util.hh>
32 
33 #include <basic/datacache/DiagnosticData.hh>
34 
35 #include <core/types.hh>
36 
39 
43 
49 #include <protocols/relax/util.hh>
50 
52 #include <basic/options/keys/filters.OptionKeys.gen.hh>
53 #include <core/pose/util.hh>
54 #include <basic/options/keys/score.OptionKeys.gen.hh>
55 
62 #include <core/pack/task/operation/ResLvlTaskOperations.hh> // PreventRepackingRLT
63 #include <core/pack/task/operation/ResFilters.hh> // ResidueLacksProperty
65 
69 
71 //for resfile reading
72 #include <basic/options/keys/packing.OptionKeys.gen.hh>
73 #include <basic/options/keys/in.OptionKeys.gen.hh>
74 #include <basic/options/keys/out.OptionKeys.gen.hh>
75 #include <basic/options/keys/constraints.OptionKeys.gen.hh>
76 #include <basic/options/keys/cluster.OptionKeys.gen.hh>
77 #include <basic/options/keys/edensity.OptionKeys.gen.hh>
78 #include <basic/options/keys/symmetry.OptionKeys.gen.hh>
79 
80 #include <utility/file/FileName.hh>
81 
82 #include <ObjexxFCL/FArray1D.hh>
83 
85 // AUTO-REMOVED #include <core/conformation/symmetry/util.hh>
86 
87 #include <basic/Tracer.hh>
89 
91 // AUTO-REMOVED #include <core/scoring/constraints/util.hh>
92 
94 #include <protocols/jd2/Job.hh>
97 #include <utility/vector0.hh>
98 #include <utility/vector1.hh>
99 #include <basic/options/keys/docking.OptionKeys.gen.hh>
100 #include <basic/prof.hh>
101 
102 namespace protocols {
103 namespace symmetric_docking {
104 
105 using namespace core;
106 using namespace ObjexxFCL;
107 
108 static basic::Tracer TR("protocols.symmetric_docking.SymDockProtocol");
109 
110 void SymDock_main() {
111  using namespace protocols::simple_moves::symmetry;
113  SymDockProtocolOP dock_mover = new SymDockProtocol;
115  seq_mover->add_mover( setup_mover );
116  seq_mover->add_mover( dock_mover );
118 }
119 
120 
122  Mover()
123 {
124  Mover::type( "SymDockProtocol" );
125 
126  set_default();
128 
129 }
130 
132  bool const fullatom,
133  bool const local_refine,
134  bool const view
135  ) : Mover()
136 {
137  Mover::type( "SymDockProtocol" );
138  set_default();
139  set_fullatom(fullatom);
140  set_local_refine(local_refine);
141  set_view(view);
143 }
144 
146  bool const fullatom,
147  bool const local_refine,
148  bool const view,
149  core::scoring::ScoreFunctionOP docking_score_low,
150  core::scoring::ScoreFunctionOP docking_score_high
151 ) : Mover()
152 {
153  Mover::type( "SymDockProtocol" );
154  set_default();
156  set_fullatom(fullatom);
157  set_local_refine(local_refine);
158  set_view(view);
159 
160  docking_score_low_ = docking_score_low;
161  docking_score_high_ = docking_score_high;
162  docking_score_high_min_ = docking_score_high;
163  docking_score_pack_ = docking_score_high;
164 }
165 
167 
168 //clone
172  }
173 
174 //set functions
175 void SymDockProtocol::set_dock_rtmin( bool dock_rtmin_in ) { rtmin_=dock_rtmin_in; }
176 void SymDockProtocol::set_sc_min( bool sc_min_in ) { sc_min_=sc_min_in; }
177 void SymDockProtocol::set_max_repeats( Size const max_repeats_in ) { max_repeats_=max_repeats_in; }
178 void SymDockProtocol::set_dock_ppk( bool dock_ppk_in ) { dock_ppk_=dock_ppk_in; }
179 void SymDockProtocol::set_view( bool view_in ) { view_=view_in; }
180 
181 void SymDockProtocol::set_fullatom( bool const fullatom_in )
182 {
183  fullatom_ = fullatom_in;
184  if (!fullatom_) passed_highres_filter_ = true;
185 }
186 
187 void SymDockProtocol::set_local_refine( bool const local_refine_in )
188 {
189  local_refine_ = local_refine_in;
190  if (local_refine_){
191  set_fullatom(true);
192  passed_lowres_filter_ = true;
193  }
194 }
195 
197 {
198  docking_score_low_ = docking_score_low_in;
199  docking_low_ = 0;
200 }
201 
203 {
204  docking_score_high_ = docking_score_high_in;
205  docking_score_high_min_ = docking_score_high_in;
206  docking_high_ = 0;
207 }
208 
210  core::scoring::ScoreFunctionOP docking_score_high_in,
211  core::scoring::ScoreFunctionOP docking_score_pack_in )
212 {
213  docking_score_high_ = docking_score_high_in;
214  docking_score_high_min_ = docking_score_high_in;
215  docking_score_pack_ = docking_score_pack_in;
216 }
217 
218 void
220 {
221 
222  using namespace basic::options;
223  using namespace core::scoring;
224 
225  passed_lowres_filter_ = true; // both default true. filter methods can set false
226  passed_highres_filter_ = true;
227 
228  if ( option[ OptionKeys::docking::low_patch ].user() ) {
229  docking_score_low_ = ScoreFunctionFactory::create_score_function( "interchain_cen", option[ OptionKeys::docking::low_patch ] );
230  } else {
232  }
233 
234  if ( option[ OptionKeys::docking::high_patch ].user() ) {
235  docking_score_high_ = ScoreFunctionFactory::create_score_function( "docking", option[ OptionKeys::docking::high_patch ] );
236  } else {
238  }
239 
240  if ( option[ OptionKeys::docking::high_min_patch ].user() ) {
241  docking_score_high_min_ = ScoreFunctionFactory::create_score_function( "docking", option[ OptionKeys::docking::high_min_patch ] );
242  } else {
244  }
245 
246  if ( option[ OptionKeys::docking::pack_patch ].user() ) {
247  docking_score_pack_ = ScoreFunctionFactory::create_score_function( "standard", option[ OptionKeys::docking::pack_patch ] );
248  } else {
250  }
251 
252  // score function setup
253  /* docking_score_low_ = ScoreFunctionFactory::create_score_function( "interchain_cen" ) ;
254  docking_score_high_ = ScoreFunctionFactory::create_score_function( "docking" );
255  docking_score_high_min_ = ScoreFunctionFactory::create_score_function( "docking", "docking_min" ) ;
256  docking_score_pack_ = core::scoring::ScoreFunctionFactory::create_score_function( "standard") ;*/
257  design(false); //??
258 
259  if ( dock_ppk_ ) set_local_refine(true);
260  hurry( false );
261 
262  // score function setup
263 // docking_score_low_ = ScoreFunctionFactory::create_score_function( "interchain_cen" ) ;
264 // docking_score_high_ = ScoreFunctionFactory::create_score_function( STANDARD_WTS, DOCK_PATCH ) ;
265 /* fullatom_ = option[ OptionKeys::out::file::fullatom ]();
266  local_refine_ = option[ OptionKeys::docking::docking_local_refine ]();
267 
268  if (local_refine_) fullatom_=true;
269  view_ = option[ OptionKeys::docking::view ]();
270 
271  // options
272  protocol_ = "standard";
273  docking_low_ = new protocols::symmetric_docking::SymDockingLowRes( scorefxn_lowres_ );
274  docking_high_ = new protocols::symmetric_docking::SymDockingHiRes( scorefxn_hires_ );
275 */
276  // add density if necessary
277 
278 
279 
280 
281  if ( option[ OptionKeys::edensity::mapfile ].user() ) {
286  }
287 
288 
289 }
290 
291 void
293 {
294  using namespace basic::options;
295 
296  set_fullatom(option[ OptionKeys::out::file::fullatom ]());
297  set_local_refine(option[ OptionKeys::docking::docking_local_refine ]());
298 
299  set_dock_rtmin(option[ OptionKeys::docking::dock_rtmin ]());
300 
301  set_sc_min(option[ OptionKeys::docking::sc_min ]());
302  set_max_repeats(option[ OptionKeys::docking::max_repeats ]());
303  set_dock_ppk(option[ OptionKeys::docking::dock_ppk ]());
304 
305  //set native pose
306  if( basic::options::option[basic::options::OptionKeys::in::file::native].user() ){
307  core::pose::PoseOP native_pose = new core::pose::Pose();
308  core::import_pose::pose_from_pdb( *native_pose, basic::options::option[basic::options::OptionKeys::in::file::native].value() );
309  this->set_native_pose( native_pose );
310  }
311 
312 }
313 
314 // this is the docking protocol. Includes a low and high resolution stage. Very similar to heterodimeric docking protocol.
315 void
317 {
318  using namespace scoring;
319  using namespace basic::options;
320  using namespace moves;
321  //using core::pose::datacache::CacheableDataType::SCORE_MAP;
323 
324  using namespace viewer;
325  add_conformation_viewer( pose.conformation(), "start_pose", 450, 450 );
326 
327 
328  //initialize docking protocol movers
331 
332  // make sure the input pose has the right size
333  core::pose::PoseOP input_pose = new core::pose::Pose();
334  *input_pose = pose;
335  docking_low_->set_input_pose( input_pose );
336  docking_high_->set_input_pose( input_pose );
337  set_input_pose( input_pose );
338 
339 
340  if( init_task_factory_ ) {
341  TR << "Setting non-default TaskFactory." << std::endl;
342  docking_high_->task_factory( init_task_factory_ );
343  }
344  if( design_ ) {
345  TR << "Setting design to " << design_ << std::endl;
346  docking_high_->design( design_ );
347  }
348 
349  // Residue movers
353 
354  core::scoring::ScoreFunctionOP docking_scorefxn;
355 
356  basic::prof_reset();
357 
358  core::pose::Pose starting_pose = pose;
360 
361  if ( option[ OptionKeys::constraints::cst_file ].user() || option[ OptionKeys::constraints::cst_fa_file ].user() ){
362  core::scoring::symmetry::SymmetricScoreFunctionOP docking_scorefxn_cst, docking_highres_cst;
364  docking_scorefxn_cst->set_weight(core::scoring::atom_pair_constraint, 1.0);
365  set_lowres_scorefxn(docking_scorefxn_cst);
366 
368  docking_highres_cst->set_weight(core::scoring::atom_pair_constraint, 1.0);
369  set_highres_scorefxn( docking_highres_cst, docking_score_pack_ ); // sets csts for mc and minimization, but not packing
370 
371  docking_low_ = new SymDockingLowRes( docking_scorefxn_cst ); // resetting scorefxn nulled out mover
372  docking_high_ = new SymDockingHiRes( docking_highres_cst, docking_score_pack_ ); // resetting scorefxn nulled out mover
373  }
374 
375  if ( option[ OptionKeys::run::score_only ]() ) {
376  score_only( pose );
377  return;
378  }
379 
380  core::Size const max_repeats( option[ OptionKeys::docking::max_repeats ]() );
381 
382  //start loop of decoy creation until filters are all passed
383  for (Size r = 1; r <= max_repeats; r++){
384  pose = starting_pose;
385 
386  //MonteCarloOP mc;
387  if ( !local_refine_ ) {
389 
390  // first convert to centroid mode
391  to_centroid.apply( pose );
392  if ( option[ OptionKeys::constraints::cst_file ].user() || option[ OptionKeys::constraints::cst_fa_file ].user() ){
394  }
395 
396  // make starting perturbations based on command-line flags over each movable jump (takes care of dock_pert and randomize)
397  simple_moves::symmetry::SymDockingInitialPerturbation initial( true /*slide into contact*/ );
398  initial.apply( pose );
399 
400  TR << "finished initial perturbation" << std::endl;
401 
402  if( !hurry_ && get_native_pose() ){
403  Real st_rmsd = calc_rms( pose );
404  score_map_["st_rmsd"] = st_rmsd;//jd1
405  job->add_string_real_pair("st_rmsd", st_rmsd);
406  }
407 
408  // low resolution docking
409 
410  TR.Debug << "DockingLowRes object created" << std::endl;
411  docking_low_->apply( pose );
412 
413  //check low res filter to see if it should repeat low res or not
415 
416  // add scores to map for output
417  if( !hurry_ ) protocols::jd2::ScoreMap::nonzero_energies( score_map_, docking_scorefxn, pose );
418  if( !hurry_ && get_native_pose() ){
419  Real cen_rms = calc_rms( pose );
420  score_map_["cen_rms"] = cen_rms; //jd1
421  job->add_string_real_pair("cen_rms", cen_rms);
422  }
423 
424  }
425 
426  // only do this is full atom is true
427  if ( fullatom_ && passed_lowres_filter_ ) {
428 
430 
431  if (!local_refine_ || !pose.is_fullatom()){
432  to_all_atom.apply( pose );
433  if ( option[ OptionKeys::constraints::cst_file ].user() || option[ OptionKeys::constraints::cst_fa_file ].user() ){
435  }
436  recover_sidechains.apply( pose );
437  // recover_sidechains( pose, *get_input_pose());
438  }
439 
440  // run high resolution docking
441  TR.Debug << "DockingHighRes object created" << std::endl;
442  docking_high_->apply( pose );
443 
444  if( !hurry_ ) {
445  Real interface_score = calc_interaction_energy( pose );
446  // add scores to map for output
447  protocols::jd2::ScoreMap::nonzero_energies( score_map_, docking_scorefxn, pose );//jd1
448  score_map_["I_sc"] = interface_score; //jd1
449  job->add_string_real_pair("I_sc", interface_score);
450  // check highres docking filter
451  if ( !option[ OptionKeys::docking::dock_ppk ]() ) {
453  }
454  }
455  if(option[ OptionKeys::docking::kick_relax ].user())
456  {
458  }
459 
460  }
461 
462  if ( passed_lowres_filter_ && passed_highres_filter_ ) break; // defaults true. filter methods can set false
463  else TR<<"REPEAT STRUCTURE "<< r <<std::endl;
464  }//end of repeat decoy creation
465 
466  if( !hurry_ ) {
467  // calculate and store the rms no matter which mode was used
468  if ( get_native_pose() ) {
469  Real rms = calc_rms( pose );
470  score_map_["rms"] = rms; //jd1
471  job->add_string_real_pair("rms", rms);
472  }
473 
474  if ( pose.is_fullatom() ){
475  Real interface_score_ = calc_interaction_energy( pose );
476  score_map_["I_sc"] = interface_score_; //jd1
477  job->add_string_real_pair("I_sc", interface_score_);
478  if ( get_native_pose() ){
479  //Real Irms = calc_rms(pose, *get_native_pose(), docking_score_high_, movable_jumps_ );
480  //score_map_["Irms"] = Irms; //jd1
481  //job->add_string_real_pair("Irms", Irms);
482  //job->add_string_real_pair("Fnat", Fnat);
483  }
484  }else{
485  score_map_["I_sc"] = calc_interaction_energy( pose );
486  }
487  }
488 
489  if ( option[ OptionKeys::run::debug ]() ) basic::prof_show();
490 
491  // cache the score map to the pose
492  if( !hurry_ ) pose.data().set(core::pose::datacache::CacheableDataType::SCORE_MAP, new basic::datacache::DiagnosticData(score_map_));
493 }
494 
495 bool
497 
498  using namespace core;
499  using namespace core::scoring;
500  using namespace basic::options;
501 
502  bool passed_filter = true;
503 
504  //criterion for failure
505  Real interchain_contact_cutoff = 10.0;
506  Real interchain_vdw_cutoff = 1.0;
507  Real distance_constraint_cutoff = 1.0; //distance constraint is soft for now
508 
509  if( option[ OptionKeys::docking::dock_lowres_filter ].user() ) {
510  utility::vector1< Real > dock_filters = option[ OptionKeys::docking::dock_lowres_filter ]();
511  interchain_contact_cutoff = dock_filters[1];
512  interchain_vdw_cutoff = dock_filters[2];
513  if (dock_filters.size() > 2) {
514  distance_constraint_cutoff = dock_filters[3];
515  }
516  }
517 
518  if (pose.energies().total_energies()[ interchain_contact ] >= interchain_contact_cutoff ) passed_filter = false;
519  if (pose.energies().total_energies()[ interchain_vdw ] >= interchain_vdw_cutoff ) passed_filter = false;
520 
521  if ( option[ OptionKeys::constraints::cst_file ].user() ){
522  if (pose.energies().total_energies()[ atom_pair_constraint ] >= distance_constraint_cutoff ) passed_filter = false;
523  }
524 
525 
526  if( ( option[basic::options::OptionKeys::filters::set_saxs_filter ].user() ) &&
528 
530  if( ! saxs_filter->apply(pose) )
531  passed_filter = false;
532  core::pose::setPoseExtraScores( pose, "saxs_score", saxs_filter->recent_score());
533  }
534 
535 
536  if (!passed_filter) {
537  TR << "STRUCTURE FAILED LOW-RES FILTER" << std::endl;
538  TR << " scores: " << pose.energies().total_energies()[ interchain_contact ] << " " << pose.energies().total_energies()[ interchain_vdw ]
539  << " " << pose.energies().total_energies()[ atom_pair_constraint ] << std::endl;
540  TR << " cutoffs: " << interchain_contact_cutoff << " " << interchain_vdw_cutoff << " " << distance_constraint_cutoff << std::endl;
541  }
542 
543  return passed_filter;
544 }
545 
546 bool
548 
549  using namespace core;
550  using namespace core::scoring;
551  using namespace basic::options;
552 
553  bool passed_filter = true;
554  if ( option[ OptionKeys::docking::dock_ppk ]() ) return passed_filter;
555 
556  Real score_cutoff = option[ OptionKeys::cluster::output_score_filter ]();
557  //criterion for failure
558  if (pose.energies().total_energy() >= score_cutoff) passed_filter = false;
559  if (score_map_["I_sc"] >= 0.0) passed_filter = false;
560 
561  if (!passed_filter) TR << "STRUCTURE FAILED HIGH-RES FILTER" << std::endl;
562 
563  return passed_filter;
564 }
565 
566 void
568 {
570  recover_sidechains.apply( pose );
571 
572  TR << "Doing initial repack of sidechains" << std::endl;
573 
574  // Do initial pack over all residues within 1000A of the interface.
575 
576  using namespace moves;
577  using namespace core::pack::task;
578  using namespace core::pack::task::operation;
579  using namespace protocols::toolbox::task_operations;
580 
581  // pack over each movable interface
582  TaskFactoryOP tf = new TaskFactory;
584  tf->push_back( new InitializeFromCommandline );
585  tf->push_back( new IncludeCurrent );
586  tf->push_back( new RestrictToRepacking );
587  tf->push_back( new NoRepackDisulfides );
588  if( basic::options::option[basic::options::OptionKeys::packing::resfile].user() ) tf->push_back( new ReadResfile );
589  //tf->push_back( new SymRestrictTaskForDocking( docking_score_pack_, true, 1000 ) );
590  tf->push_back( new RestrictToInterface( 1 ) );
591 
593  dock_pack->task_factory( tf );
594  dock_pack->apply( pose );
595 
596  if (rtmin_){
597  // protocols::simple_moves::RotamerTrialsMinMoverOP rtmin_trial = new protocols::simple_moves::RotamerTrialsMinMover( docking_score_pack_, tf);
598  // rtmin_trial->apply( pose );
599  }
600  if (basic::options::option[ basic::options::OptionKeys::docking::sc_min ]()){
602  scmin_mover->apply(pose);
603  }
604 }
605 
606 /*
607 void
608 SymDockProtocol::apply( pose::Pose & pose )
609 {
610  using namespace scoring;
611  using namespace basic::options;
612  using namespace moves;
613  using namespace viewer;
614  using namespace core::pack::task;
615  using namespace core::pack::task::operation;
616  //using core::pose::datacache::CacheableDataType::SCORE_MAP;
617  using utility::file::FileName;
618 
619  assert( core::pose::symmetry::is_symmetric( pose ));
620 
621  // are we calculating symmetric rms
622  //bool symmetric_rms ( option[ OptionKeys::symmetry::symmetric_rmsd ].user() );
623  FArray1D_bool superpos_partner ( pose.total_residue(), true );
624 
625  core::pose::PoseOP input_pose = new core::pose::Pose();
626  *input_pose = pose;
627  docking_low_->set_input_pose( input_pose );
628  docking_high_->set_input_pose( input_pose );
629  set_input_pose( input_pose );
630 
631  // add constraints
632  if ( option[ OptionKeys::constraints::cst_weight ].user() ) {
633  scoring::constraints::add_constraints_from_cmdline(pose, *scorefxn_lowres_ );
634  }
635 
636  if ( option[ OptionKeys::constraints::cst_fa_weight ].user() ) {
637  scoring::constraints::add_fa_constraints_from_cmdline(pose, *scorefxn_hires_ );
638  }
639 
640  // Residue movers
641  simple_moves::SwitchResidueTypeSetMover to_centroid( core::chemical::CENTROID );
642  simple_moves::SwitchResidueTypeSetMover to_all_atom( core::chemical::FA_STANDARD );
643 
644  core::scoring::ScoreFunctionOP docking_scorefxn;
645 
646  basic::prof_reset();
647 
648  if ( option[ OptionKeys::run::score_only ]() ) {
649  if ( fullatom_ ) {
650  core::scoring::ScoreFunctionOP high_score = new core::scoring::symmetry::SymmetricScoreFunction( *scorefxn_hires_ );
651  ScoreMover score_and_exit( high_score ) ;
652 // core::Real rms = symmetric_rms ? calc_symmetric_rms( pose ) : rmsd_no_super_subset( *get_native_pose(), pose, superpos_partner, is_protein_CA );
653  core::Real rms = calc_rms( pose );
654  score_and_exit.insert_rms( rms );
655  score_and_exit.apply( pose );
656  } else {
657  to_centroid.apply( pose );
658  core::scoring::ScoreFunctionOP low_score = new core::scoring::symmetry::SymmetricScoreFunction( *scorefxn_lowres_ );
659  ScoreMover score_and_exit( low_score );
660 // core::Real rms = symmetric_rms ? calc_symmetric_rms( pose ) : rmsd_no_super_subset( *get_native_pose(), pose, superpos_partner, is_protein_CA );
661  core::Real rms = calc_rms( pose );
662  score_and_exit.insert_rms( rms );
663  score_and_exit.apply( pose );
664  }
665  return;
666  }
667 
668  if ( view_ ) add_conformation_viewer( pose.conformation(), "start_pose", 450, 450 );
669 
670  // TODO
671  // some set up functions from pose_docking_standard_protocol
672  // nominimize1, nominimize2, chainbreaks, bb_move
673  //
674 
675  //temporary fix for docking filters
676  bool passed_filters = false;
677  Size max_repeats = 1000;
678 
679  core::pose::Pose starting_pose = pose;
680 
681  //start loop of decoy creation until filters are all passed
682  for (Size r = 1; r <= max_repeats; r++){
683  pose = starting_pose;
684 
685  MonteCarloOP mc;
686  if ( !local_refine_ ) {
687  docking_scorefxn = new core::scoring::symmetry::SymmetricScoreFunction( *scorefxn_lowres_ ) ;
688  // first convert to centroid mode
689 
690  to_centroid.apply( pose );
691  // make starting perturbations based on command-line flags
692  SymDockingInitialPerturbation initial( true );
693  initial.apply( pose );
694  TR << "finished initial perturbation" << std::endl;
695 
696 // core::Real st_rmsd = symmetric_rms ? calc_symmetric_rms( pose ) : rmsd_no_super_subset( *get_native_pose(), pose, superpos_partner, is_protein_CA );
697  core::Real st_rmsd = calc_rms( pose );
698  score_map_["st_rmsd"] = st_rmsd;
699 
700  // low resolution docking
701  docking_low_->set_default_mc( pose );
702  if ( view_ ) {
703  /// uses conformation_viewer instead of monte_carlo_viewer so that each step (accepted or rejected)
704  /// can be seen. Also pauses every move....only use for debugging!
705  if ( option[ OptionKeys::run::debug ]() ) {
706  add_conformation_viewer( pose.conformation(), "start_pose", 450, 450, true );
707  }
708  mc_ = docking_low_->get_mc();
709  //add_monte_carlo_viewer( *mc_, "", 450, 450 );
710  add_monte_carlo_silent_viewer( *mc_, "", false );
711 
712  }
713  TR.Debug << "SymDockingLowRes object created" << std::endl;
714 
715  docking_low_->apply( pose );
716 
717  //check low res filter to see if it should repeat low res or not
718  passed_filters = docking_lowres_filter( pose );
719 
720  // add scores to map for output
721  ScoreMap::nonzero_energies( score_map_, docking_scorefxn, pose );
722 // core::Real cen_rms = symmetric_rms ? calc_symmetric_rms( pose ) : rmsd_no_super_subset( *get_native_pose(), pose, superpos_partner, is_protein_CA );
723  core::Real cen_rms = calc_rms( pose );
724  score_map_["cen_rms"] = cen_rms;
725  } else {
726  passed_filters = true;
727  }
728 
729  // only do this is full atom is true
730  if ( fullatom_ && passed_filters ) {
731 
732  //(*scorefxn_lowres_)(pose);
733 
734  docking_scorefxn = new core::scoring::symmetry::SymmetricScoreFunction( *scorefxn_hires_ ) ;
735  if (!pose.is_fullatom()) to_all_atom.apply( pose );
736  // to_all_atom.apply( pose );
737 
738  //recover sidechains from starting structures
739  protocols::simple_moves::ReturnSidechainMover recover_sidechains( *get_input_pose() );
740  recover_sidechains.apply( pose );
741 
742  (*docking_scorefxn)( pose );
743  docking_high_->set_default_mc( pose );
744 
745  if ( view_ ) {
746  mc_ = docking_high_->get_mc();
747  //add_monte_carlo_viewer( *mc_, "", 450, 450 );
748  add_monte_carlo_silent_viewer( *mc_, "", true );
749  }
750 
751  TR.Debug << "DockingHighRes object created" << std::endl;
752 
753  // TODO Add rtmin!!! Need to check if this has been incorporated into the packer
754  TR << "Doing initial repack of sidechains" << std::endl;
755  (*docking_scorefxn)( pose );
756  /// Now handled automatically. docking_scorefxn->accumulate_residue_total_energies( pose );
757 
758  // Do initial pack over all residues within 1000A of the interface.
759  // Equates to repacking all residues, but doing so without RestrictTaskForDocking invalidates -norepack1 and -norepack2 flags
760  TaskFactoryOP tf = new TaskFactory;
761 
762  tf->push_back( new OperateOnCertainResidues( new PreventRepackingRLT, new ResidueLacksProperty("PROTEIN") ) );
763  tf->push_back( new InitializeFromCommandline );
764  tf->push_back( new IncludeCurrent );
765  tf->push_back( new RestrictToRepacking );
766  tf->push_back( new NoRepackDisulfides );
767  tf->push_back( new SymRestrictTaskForDocking( docking_scorefxn, true, 1000 ) );
768 
769  if( option[OptionKeys::packing::resfile].user() ) tf->push_back( new ReadResfile );
770 
771  simple_moves::symmetry::SymPackRotamersMover pack( docking_scorefxn );
772  pack.task_factory( tf );
773  pack.apply( pose );
774  // run high resolution docking
775  docking_high_->apply( pose );
776 
777  // add scores to map for output
778  ScoreMap::nonzero_energies( score_map_, docking_scorefxn, pose );
779  calc_interaction_energy( pose );
780 
781  // check highres docking filter
782  passed_filters = docking_highres_filter( pose );
783  }
784 
785  if ( passed_filters ) break;
786  if (!passed_filters) TR<<"REPEAT STRUCTURE "<< r <<std::endl;
787 
788  }//end of repeat decoy creation
789 
790  // calculate and store the rms no matter which mode was used
791  //score_map_["rms"] = rmsd_no_super_subset( *get_native_pose(), pose, superpos_partner, is_protein_CA );
792 // core::Real rms = symmetric_rms ? calc_symmetric_rms( pose ) : rmsd_no_super_subset( *get_native_pose(), pose, superpos_partner, is_protein_CA );
793  core::Real rms = calc_rms( pose );
794  score_map_["rms"] = rms;
795  calc_interaction_energy( pose );
796 
797  if ( option[ OptionKeys::run::debug ]() ) basic::prof_show();
798 
799  // cache the score map to the pose
800  pose.data().set(SCORE_MAP, new basic::datacache::DiagnosticData(score_map_));
801 }
802 */
805  return "SymDockProtocol";
806 }
807 
808 /*
809 bool
810 SymDockProtocol::docking_lowres_filter( core::pose::Pose & pose){
811 
812  using namespace scoring;
813  using namespace basic::options;
814 
815  bool passed_filter = true;
816  if ( !option[ OptionKeys::docking::fake_native ]() ){
817  //criterion for failure
818  Real interchain_contact_cutoff = 10.0;
819  Real interchain_vdw_cutoff = 1.0;
820 
821  if( option[ OptionKeys::docking::dock_lowres_filter ].user() ) {
822  utility::vector1< Real > dock_filters = option[ OptionKeys::docking::dock_lowres_filter ]();
823  interchain_contact_cutoff = dock_filters[1];
824  interchain_vdw_cutoff = dock_filters[2];
825  }
826 
827  if (pose.energies().total_energies()[ interchain_contact ] >= interchain_contact_cutoff ) passed_filter = false;
828  if (pose.energies().total_energies()[ interchain_vdw ] >= interchain_vdw_cutoff ) passed_filter = false;
829  }
830 
831  return passed_filter;
832 }
833 
834 bool
835 SymDockProtocol::docking_highres_filter( core::pose::Pose & pose){
836 
837  using namespace scoring;
838  using namespace basic::options;
839 
840  bool passed_filter = true;
841  if ( option[ OptionKeys::docking::dock_ppk ]() ) return passed_filter;
842 
843  Real score_cutoff = option[ OptionKeys::cluster::output_score_filter ]();
844  //criterion for failure
845  if (pose.energies().total_energy() >= score_cutoff) passed_filter = false;
846  if (score_map_["I_sc"] >= 0.0) passed_filter = false;
847 
848  return passed_filter;
849 }
850 */
853  using namespace scoring;
854  using namespace core::conformation::symmetry;
855 
856  core::scoring::ScoreFunctionOP docking_scorefxn;
857  core::pose::Pose complex_pose = pose;
858 
859  Real trans_magnitude = 1000;
860 
861  assert( core::pose::symmetry::is_symmetric( pose ) );
862  SymmetricConformation & symm_conf (
863  dynamic_cast<SymmetricConformation & > ( pose.conformation()) );
864 
865  std::map< Size, SymDof > dofs ( symm_conf.Symmetry_Info()->get_dofs() );
867  translate_away->step_size( trans_magnitude );
868 
869  if ( fullatom_ ){
871  } else {
873  }
874 
875  Real bound_energy = (*docking_scorefxn)( complex_pose );
876  translate_away->apply( complex_pose );
877 
878  Real unbound_energy = (*docking_scorefxn)( complex_pose );
879 
880  return bound_energy - unbound_energy;
881 
882 }
883 
886 
887  using namespace core::conformation::symmetry;
888  using namespace basic::options;
889 
890  assert( core::pose::symmetry::is_symmetric( pose ) );
891  SymmetricConformation & SymmConf (
892  dynamic_cast<SymmetricConformation &> ( pose.conformation()) );
893  SymmetryInfoCOP symm_info( SymmConf.Symmetry_Info() );
894 
895  FArray1D_bool superpos ( pose.total_residue(), false );
896  for (Size res=1; res <= symm_info->num_total_residues_without_pseudo(); ++res )
897  {
898  superpos(res) = true;
899  }
900  if ( get_native_pose() ) {
901  if ( option[ OptionKeys::symmetry::symmetric_rmsd ]() ) {
903  } else {
905  }
906  }
907  return -1;
908 }
909 
910 // turn on design of partner2 during docking. Not thoroughly tested!
911 void SymDockProtocol::design( bool const des ) { design_ = des; }
912 bool SymDockProtocol::design() const { return design_; }
913 
914 
915 void SymDockProtocol::hurry( bool const hurry ) { hurry_ = hurry; }
916 
917 void
919 {
920  init_task_factory_ = task;
921 }
922 
925 {
926  return( init_task_factory_ );
927 }
928 
931 {
932  return( init_task_factory_ );
933 }
934 
935 
936 void
938 {
939  using namespace scoring;
940  using namespace moves;
941  if ( fullatom_ ) {
943  simple_moves::ScoreMover score_and_exit( high_score ) ;
944  score_and_exit.insert_rms( calc_rms( pose) );
945  score_and_exit.apply( pose );
946  } else {
948  to_centroid.apply( pose );
950  simple_moves::ScoreMover score_and_exit( low_score );
951  score_and_exit.insert_rms( calc_rms( pose ) );
952  score_and_exit.apply( pose );
953  }
954 }
955 
956 } // symmetric_docking
957 } // protocols