34 #include <basic/options/option.hh>
35 #include <basic/options/keys/in.OptionKeys.gen.hh>
36 #include <basic/options/keys/out.OptionKeys.gen.hh>
37 #include <basic/options/keys/docking.OptionKeys.gen.hh>
38 #include <basic/options/keys/loops.OptionKeys.gen.hh>
39 #include <basic/options/keys/packing.OptionKeys.gen.hh>
61 #include <basic/prof.hh>
62 #include <basic/Tracer.hh>
64 #include <numeric/angle.functions.hh>
85 #include <utility/file/FileName.hh>
86 #include <utility/tag/Tag.hh>
87 #include <numeric/random/random.fwd.hh>
88 #include <ObjexxFCL/FArray1D.hh>
95 #include <utility/vector0.hh>
96 #include <utility/vector1.hh>
97 #include <utility/excn/Exceptions.hh>
98 #include <utility/keys/Key3Vector.hh>
103 using basic::Warning;
105 static basic::Tracer
TR(
"FlexPepDockingProtocol");
106 using namespace core;
107 using namespace ObjexxFCL;
109 namespace protocols {
110 namespace flexpep_docking {
113 FlexPepDockingProtocol::FlexPepDockingProtocol(
Size const rb_jump_in)
115 rb_jump_(rb_jump_in),
118 fpdock_metrics_(flags_.
clone())
120 Mover::type(
"FlexPepDockingProtocol" );
126 Size const rb_jump_in,
131 rb_jump_(rb_jump_in),
133 fpdock_metrics_(flags_.
clone())
135 Mover::type(
"FlexPepDockingProtocol" );
151 clonedObj->scorefxn_ =
scorefxn_->clone();
152 clonedObj->flags_ =
flags_;
162 using namespace basic::options;
163 using namespace core::scoring;
164 using namespace core::pack;
165 using namespace core::pack::task;
167 fullatom_ = option[ OptionKeys::out::file::fullatom ]();
168 view_ = option[ OptionKeys::docking::view ]();
184 unboundrot_oper->initialize_from_command_line();
194 if( option[OptionKeys::packing::resfile].user() )
220 if( option[ OptionKeys::loops::frag_files ].user() ) {
241 ObjexxFCL::FArray1D_int cuts(1000,0);
242 ObjexxFCL::FArray2D_int jumps(2,1000,0);
245 const int JUMP_FROM = 1;
246 const int JUMP_TO = 2;
248 int receptor_ncuts = 0;
254 std::map<int,int>::const_iterator iter;
255 for(iter = peptide_cuts.begin(); iter != peptide_cuts.end(); iter++) {
256 cuts( iter->first + receptor_ncuts ) = iter->second;
259 int num_jumps = 0;
int max_jump = 0;
260 for(iter = peptide_anchors.begin(); iter != peptide_anchors.end(); iter++) {
261 int pep_anchor_num = iter->first;
262 int residue = iter->second;
263 int cur_jump = pep_anchor_num + receptor_ncuts - 1;
264 if( cur_jump >= 1 ) {
265 jumps(JUMP_TO, cur_jump) = residue;
268 jumps(JUMP_FROM, cur_jump + 1) = residue;
271 #if (defined WIN32) && (defined WIN_PYROSETTA)
272 max_jump = max( max_jump, cur_jump );
274 max_jump = std::max( max_jump, cur_jump );
277 runtime_assert_msg(max_jump == num_jumps,
278 "invalid anchor indexing in FlexPepDock parameter file (or in default FlexPepDock parameters)");
288 char currChain = pdbinfo->chain(resi);
289 int ligand_jump = ++max_jump;
291 jumps(JUMP_TO, ligand_jump) = resi;
293 cuts(num_jumps+1) = resi;
294 while (resi <= pose.
total_residue() && pdbinfo->chain(resi) == currChain) {
304 f.tree_from_jumps_and_cuts
306 TR.Debug <<
"old fold tree: " << pose.
fold_tree() << std::endl;
308 TR.Debug <<
"new fold tree: " << pose.
fold_tree() << std::endl;
319 using namespace core::scoring::constraints;
320 using namespace core::chemical;
321 using namespace core::conformation;
322 using namespace core::id;
323 using namespace core::scoring;
333 cst_set->add_constraint
335 ( CAi, CAi, conformation.xyz( CAi ), spring )
355 using namespace basic::options;
377 if( option[OptionKeys::in::file::movemap].user() ) {
378 movemap_->init_from_file( option[OptionKeys::in::file::movemap] );
394 const float min_func_tol
398 minimizer.
apply(pose);
420 pose::Pose & pose,
bool ppk_receptor,
bool ppk_peptide
423 using namespace moves;
424 using namespace basic::options;
426 using namespace core::pack;
432 core::Size pack_start = (ppk_receptor) ? 1 : receptor_nres+1;
434 for (
core::Size i = pack_start; i <= pack_end; ++i) {
435 mm_protein->set_chi(i,
true);
439 task = pack::task::TaskFactory::create_packer_task( pose );
440 task->initialize_from_command_line().restrict_to_repacking();
442 noRepackDisulf.
apply(pose, *task);
444 for(
core::Size resid = 1; resid < pack_start; resid++)
445 {task->nonconst_residue_task(resid).prevent_repacking();}
447 {task->nonconst_residue_task(resid).prevent_repacking();}
451 unboundrot_oper->initialize_from_command_line();
452 task->append_rotamerset_operation( unboundrot_oper );
459 Real trans_magnitude = 1000;
461 translate_away->step_size( trans_magnitude );
463 translate_back->step_size( trans_magnitude );
464 translate_back->trans_axis().negate();
468 min_mover->apply(pose);
469 TR.Debug <<
"Initial score: " << (*scorefxn_)(orig_pose) << endl;
470 TR.Debug <<
"minimized score = " << (*scorefxn_)(pose) << endl;
475 translate_away->apply(pose);
476 prepack_protein->apply(pose);
477 min_mover->movemap(mm_protein);
478 min_mover->apply(pose);
480 translate_back->apply(pose);
494 using namespace numeric;
500 double phi_offset = numeric::random::uniform()*(pertSize)*2 - pertSize;
501 double psi_offset = numeric::random::uniform()*(pertSize)*2 - pertSize;
502 double new_phi = principal_angle_degrees( pose.
phi(i) + phi_offset );
503 double new_psi = principal_angle_degrees( pose.
psi(i) + psi_offset );
520 using namespace numeric;
537 using namespace moves;
539 float current_score = (*scorefxn_)( pose );
549 rb_mover->apply(tmpPose);
550 new_score = (*scorefxn_)( tmpPose );
551 }
while ((new_score-current_score) > 3000);
565 using namespace core::pose;
566 using namespace protocols;
570 small_mover->apply(pose);
584 using namespace core::pose;
585 using namespace protocols;
589 shear_mover->apply(pose);
603 using namespace core::pose;
604 using namespace protocols;
611 backrubmover.set_input_pose(&pose);
617 resnums.push_back(i);
622 TR <<
"backrub: added mainchain segments" << endl;
624 backrubmover.apply(pose);
625 TR <<
"backrub: applied" << endl;
638 using namespace core::pose;
639 using namespace protocols;
640 using namespace core::conformation;
641 using namespace core::chemical;
645 ResidueType const & restype( residue_set->name_map(
"ALA" ) );
686 using namespace core::kinematics;
687 using namespace numeric;
705 const float minimization_threshold,
706 const float min_func_tol
710 using namespace core::pose;
711 using namespace core::kinematics;
712 using namespace moves;
715 const float temperature ( 0.8 );
718 const float rt_energycut = 0.05;
725 for(
int i=1; i<=cycles; ++i ) {
733 if ( i % 8 == 0 || i == cycles) {
737 rottrial_ecut.
apply(pose);
739 const float current_score = (*scorefxn_)( pose );
740 const float lowest_score = mc->lowest_score();
741 if ( current_score - lowest_score < minimization_threshold ) {
742 minimizer.
apply(pose);
744 const bool accepted = mc->boltzmann( pose );
749 TR.Debug <<
"torsion-MCM --" << n_accepted <<
" out of " << cycles
750 <<
" monte carlo cycles accepted" << endl;
751 pose = mc->lowest_score_pose();
774 const float trans_magnitude,
775 const float rot_magnitude,
776 const float minimization_threshold,
777 const float min_func_tol
781 using namespace core::pose;
782 using namespace core::kinematics;
783 using namespace moves;
786 const float temperature ( 0.8 );
789 const float rt_energycut = 0.05;
792 rb_jump_, rot_magnitude, trans_magnitude );
800 for(
int i=1; i<=cycles; ++i ) {
801 rb_mover.
apply(pose);
802 if ( i % 8 == 0 || i == cycles) {
806 rottrial_ecut.
apply(pose);
808 const float current_score = (*scorefxn_)( pose );
809 const float lowest_score = mc->lowest_score();
810 if ( current_score - lowest_score < minimization_threshold ) {
811 minimizer.
apply(pose);
813 const bool accepted = mc->boltzmann( pose );
818 TR.Debug <<
"rigid-body-MCM --" << n_accepted <<
" out of " << cycles
819 <<
" monte carlo cycles accepted" << endl;
820 pose = mc->lowest_score_pose();
844 loops->add_loop(first_res, last_res);
845 for(
Size i = first_res; i <= last_res ; i++)
846 runtime_assert(
movemap_->get_bb(i) );
862 using namespace core::scoring;
863 using namespace moves;
869 float rb_trans_mag = 0.2;
870 float rb_rot_mag = 7 ;
876 float rep_ramp_step = ( origw_fa_rep - 0.02 ) /
float(rep_ramp_cycles-1) ;
877 float rama_ramp_step = (origw_rama - 0.01) / float(rep_ramp_cycles-1) ;
893 TR <<
"Disabling receptor design" << endl;
899 for (
int i = 1; i <= rep_ramp_cycles; i++ )
904 (
fa_atr, origw_fa_atr*(1 + 0.25*(rep_ramp_cycles-i) ) );
907 float rep_weight = (0.02 + rep_ramp_step * float(i-1));
912 float rama_weight = (0.01 + rama_ramp_step * float(i-1));
916 TR.Debug <<
"Sequence - Before design: " << pose.
sequence() << endl;
918 TR.Debug <<
"Designing " << i << endl;
920 TR.Debug <<
"Sequence - After design: " << pose.
sequence() << endl;
926 rb_trans_mag, rb_rot_mag,
932 "dfpmin_armijo_atol", 15.0,
943 minimizer.
apply(pose);
980 using namespace scoring;
981 using namespace viewer;
984 TR <<
"apply" << std::endl;
988 TR.Warning <<
"WARNING: No native supplied by used - using starting structure as reference for statistics" << std::endl;
1009 start_pose_4stats = pose;
1030 TR <<
"doing backrub! " << std::endl;
1044 bool passed_filter =
false;
1046 while (!passed_filter) {
1050 abinitioDocking.
apply(pose);
1051 pose_after_lowres = pose;
1056 lowresDocking.
apply(pose);
1059 pose_after_lowres = pose;
1074 if (!passed_filter) {
1075 pose = current_pose;
1076 TR <<
"Failed filters - trying again" << std::endl;
1088 return "FlexPepDockingProtocol";
1102 ( ObjexxFCL::FArray1D_bool& superpos_partner,
1103 ObjexxFCL::FArray1D_bool& native_interface_residues)
const
1113 native_interface->distance(8);
1115 native_interface->calculate( native_pose );
1121 superpos_partner(i)=
true;
1123 native_interface_residues(i) =
true;
1125 else if (native_interface->is_interface(i))
1128 <<
" in interface" << std::endl;
1129 native_interface_residues(i)=
true;
1139 using namespace scoring;
1144 TR.Warning <<
"WARNING: missing '-native' flag, skipping statistics on RMSD to native" << std::endl;
1154 pose::Pose pose_after_lowres_CEN = pose_after_lowres;
1156 if(start_pose_CEN.is_fullatom()) {
1157 to_centroid_mover.
apply(start_pose_CEN);
1159 if(pose_after_lowres_CEN.is_fullatom()) {
1160 to_centroid_mover.
apply(pose_after_lowres_CEN);
1162 if(native_CEN.is_fullatom()) {
1163 to_centroid_mover.
apply(native_CEN);
1166 cur_job->add_string_real_pair(
"score_lowres_start",
1168 cur_job->add_string_real_pair(
"score_lowres_opt",
1171 FArray1D_bool superpos_partner ( native_CEN.total_residue(), false );
1172 FArray1D_bool native_interface_residues ( native_CEN.total_residue(), false );
1178 cur_job->add_string_real_pair(
"rmsCA_lowres",
1180 cur_job->add_string_real_pair(
"rmsBB_lowres",
1183 cur_job->add_string_real_pair(
"rmsCA_intrf_lowres",
1185 cur_job->add_string_real_pair(
"rmsBB_intrf_lowres",
1204 using namespace scoring;
1212 cur_job->add_string_real_pair(
"I_sc",
if_metrics_.find(
"I_sc")->second );
1213 cur_job->add_string_real_pair(
"I_bsa",
if_metrics_.find(
"I_bsa")->second );
1214 cur_job->add_string_real_pair(
"I_hb",
if_metrics_.find(
"I_hb")->second );
1215 cur_job->add_string_real_pair(
"I_pack",
if_metrics_.find(
"I_pack")->second );
1216 cur_job->add_string_real_pair(
"I_unsat",
if_metrics_.find(
"I_unsat")->second );
1220 Real pepScore, pepScore_noref, totalScore;
1221 totalScore = (*scorefxn_)(final_pose);
1223 cur_job->add_string_real_pair(
"pep_sc", pepScore );
1224 cur_job->add_string_real_pair(
"pep_sc_noref", pepScore_noref );
1227 cur_job->add_string_real_pair(
"reweighted_sc", totalScore + pepScore +
if_metrics_.find(
"I_sc")->second );
1231 TR.Warning <<
"WARNING: missing '-native' flag, skipping statistics on RMSD to native" << std::endl;
1236 FArray1D_bool superpos_partner ( native_pose.
total_residue(), false );
1237 FArray1D_bool native_interface_residues ( native_pose.
total_residue(), false );
1247 cur_job->add_string_real_pair(
"startRMSca",
1249 cur_job->add_string_real_pair(
"startRMSbb",
1251 cur_job->add_string_real_pair(
"startRMSall",
1253 cur_job->add_string_real_pair(
"startRMSallif",
1257 cur_job->add_string_real_pair(
"rmsCA",
1259 cur_job->add_string_real_pair(
"rmsBB",
1262 cur_job->add_string_real_pair(
"rmsALL",
1266 cur_job->add_string_real_pair(
"rmsALL", -1.0 );
1269 cur_job->add_string_real_pair(
"rmsCA_if",
1271 cur_job->add_string_real_pair(
"rmsBB_if",
1274 cur_job->add_string_real_pair(
"rmsALL_if",
1278 cur_job->add_string_real_pair(
"rmsALL_if", -1.0 );
1285 cur_job->add_string_real_pair(
"fnat5",
1287 cur_job->add_string_real_pair(
"fnat3.5",
1291 cur_job->add_string_real_pair(
"startRMSphipsi",
1293 cur_job->add_string_real_pair(
"startRMSphipsi_if",
1295 cur_job->add_string_real_pair(
"rmsPHIPSI",
1297 cur_job->add_string_real_pair(
"rmsPHIPSI_if",
1304 native_interface_residues,
1309 native_interface_residues,
1314 native_interface_residues,
1319 native_interface_residues,
1321 cur_job->add_string_real_pair(
"frac_iatoms_less_1A", frac1 );
1322 cur_job->add_string_real_pair(
"frac_iatoms_less_1A_bb", frac1_bb );
1323 cur_job->add_string_real_pair(
"frac_iatoms_less_1.5A", frac1_5 );
1324 cur_job->add_string_real_pair(
"frac_iatoms_less_2A", frac2 );
1325 std::map<core::Size,core::Real> subsetRMS;
1330 std::ostringstream oss;
1331 oss <<
"bestRMS_" << k <<
"mer_all";
1333 cur_job->add_string_real_pair( s, subsetRMS[k] );
1354 if(tag->hasOption(
"scorefxn_lowres"))
1357 if ( ! data.
has(
"scorefxns", scorefxn_lowres_key ) ) {
1358 throw utility::excn::EXCN_RosettaScriptsOption(
"ScoreFunction " + scorefxn_lowres_key +
" not found in DataMap.");
1371 if(tag->hasOption(
"rb_trans_size" ) || tag->hasOption(
"rb_rot_size" ))
1407 if ( tag->hasOption(
"receptor_chain") )
1410 ( tag->getOption<
std::string>(
"receptor_chain" ).at(0) );
1412 if ( tag->hasOption(
"peptide_chain" ) )
1415 ( tag->getOption<
std::string>(
"peptide_chain" ).at(0) );
1422 if ( tag->hasOption(
"native" ) ) {
1425 bool centroid_input = tag->getOption<
bool>(
"centroid_input", false );
1426 if ( centroid_input) {
1446 return "FlexPepDock";