33 #include <basic/options/keys/enzdes.OptionKeys.gen.hh>
34 #include <basic/options/keys/packing.OptionKeys.gen.hh>
35 #include <basic/options/keys/remodel.OptionKeys.gen.hh>
36 #include <basic/options/keys/constraints.OptionKeys.gen.hh>
37 #include <basic/options/keys/run.OptionKeys.gen.hh>
38 #include <basic/options/keys/out.OptionKeys.gen.hh>
44 #include <basic/options/keys/symmetry.OptionKeys.gen.hh>
71 #include <basic/MetricValue.hh>
72 #include <basic/Tracer.hh>
98 #include <utility/tag/Tag.hh>
111 #include <utility/vector0.hh>
112 #include <utility/vector1.hh>
118 namespace protocols {
123 static basic::Tracer
TR(
"protocols.forge.remodel.RemodelMover" );
140 return "RemodelMover";
146 Super(
"RemodelMover" ),
149 max_linear_chainbreak_( basic::options::option[basic::options::OptionKeys::remodel::
RemodelLoopMover::max_linear_chainbreak]),
152 centroid_loop_mover_str_(
"RemodelLoopMover" ),
153 redesign_loop_neighborhood_( false ),
154 dr_cycles_( basic::options::option[basic::options::OptionKeys::remodel::dr_cycles] ),
155 centroid_sfx_( core::scoring::
ScoreFunctionFactory::create_score_function( basic::options::option[basic::options::OptionKeys::remodel::cen_sfxn] )),
159 if (basic::options::option[basic::options::OptionKeys::packing::soft_rep_design]){
160 TR <<
"SWITCHING FULLATOM FUNCITON TO SOFT_REP_DESIGN" << std::endl;
168 using namespace basic::options;
169 using namespace core::scoring;
192 if ( option[OptionKeys::remodel::hb_lrbb].user() ){
194 TR <<
"USER OVERWRITE HB_LRBB: " << option[OptionKeys::remodel::hb_lrbb] << std::endl;
197 if ( option[OptionKeys::remodel::hb_srbb].user() ){
199 TR <<
"USER OVERWRITE HB_SRBB: " << option[OptionKeys::remodel::hb_srbb] << std::endl;
235 if ( rval.
vlb_.get() ) {
340 using basic::MetricValue;
347 using namespace core::scoring;
348 using namespace protocols::simple_filters;
349 using namespace basic::options;
350 using namespace core::scoring::constraints;
352 #if defined GL_GRAPHICS
370 blueprint_ = option[basic::options::OptionKeys::remodel::blueprint]();
374 remodel_data.getLoopsToBuildFromFile(
blueprint_);
378 dssp.dssp_reduced(dsspSS);
379 TR <<
"input PDB dssp assignment:" << std::endl;
386 remodel_data.updateWithDsspAssignment( dsspSS );
387 dssp.insert_ss_into_pose( pose );
391 if (option[OptionKeys::remodel::domainFusion::insert_segment_from_pdb].user()){
392 TR <<
"INSERT SEGMENT FROM PDB" << std::endl;
393 remodel_data.collectInsertionPose();
400 working_model.workingSetGen( pose, remodel_data );
407 if ( option[ OptionKeys::run::show_simulation_in_pymol ].user() &&
408 option[ OptionKeys::run::show_simulation_in_pymol ]() ==
true ){
426 if (basic::options::option[basic::options::OptionKeys::remodel::repeat_structure].user()) {
433 if (pose.
total_residue() < 2*remodel_data.sequence.length()){
436 for (
Size i = 1; i<= len_diff; ++i){
450 if (working_model.manager.size()!= 0){
451 if (!basic::options::option[basic::options::OptionKeys::remodel::bypass_fragments]){
452 working_model.manager.modify(pose);
471 if (basic::options::option[basic::options::OptionKeys::remodel::repeat_structure].user()) {
480 for (
Size i = 1; i<= len_diff; ++i){
520 if ( option[ OptionKeys::symmetry::symmetry_definition ].user() ) {
522 pre_mover.
apply( pose );
525 for (
Size i=1; i<= pdb_info->nres(); ++i ){
526 pdb_info->chain(i,
' ');
531 Size i = basic::options::option[basic::options::OptionKeys::remodel::num_trajectory]();
533 Size prev_checkpoint = 0;
537 if (option[OptionKeys::remodel::checkpoint]){
539 if (prev_checkpoint >= i){
542 i = i - prev_checkpoint;
545 if (working_model.manager.size() != 0){
548 CalculatorFactory::Instance().register_calculator(
564 if (basic::options::option[ OptionKeys::remodel::repeat_structure].user()){
585 Size repeat_number = basic::options::option[ OptionKeys::remodel::repeat_structure];
587 if (option[ OptionKeys::remodel::repeat_structure].user() && pose.
total_residue() == remodel_data.blueprint.size()*repeat_number) {
589 f.
reorder(working_model.safe_root_);
591 TR <<
"rerooting tree: " << pose.
fold_tree() << std::endl;
597 Pose cached_modified_pose( pose );
600 TR <<
"BUILD CYCLE REMAINING " << i << std::endl;
602 TR <<
"ORIGINAL TREE: " << pose.
fold_tree() << std::endl;
603 if (working_model.manager.size() != 0){
612 if (option[ OptionKeys::remodel::repeat_structure].user()) {
614 for (
Size res = 1; res <= cached_modified_pose.
n_residue(); res++){
615 cached_modified_pose.
set_phi(res, pose.
phi(res));
616 cached_modified_pose.
set_psi(res, pose.
psi(res));
646 if ( basic::options::option[basic::options::OptionKeys::enzdes::cstfile].user() ){
660 cstOP->use_all_blocks();
666 if (basic::options::option[ OptionKeys::constraints::cst_file ].user()){
671 constraint->apply( pose );
680 if (basic::options::option[OptionKeys::remodel::build_disulf].user()){
682 bool disulfPass =
false;
684 if (disulfPass !=
true){
689 for (
utility::vector1<std::pair<Size,Size> >::iterator itr = disulf_partners.begin(); itr != disulf_partners.end(); itr++){
690 Pose disulf_copy_pose = pose;
692 single_disulf.push_back(*itr);
699 designMover.
make_disulfide(disulf_copy_pose, single_disulf, combined_mm);
700 designMover.
apply(disulf_copy_pose);
704 if ( basic::options::option[basic::options::OptionKeys::enzdes::cstfile].user() ||
705 basic::options::option[ OptionKeys::constraints::cst_file ].user()
709 bool CScore(pose_constraint.
apply( disulf_copy_pose ));
714 accumulator.
apply(disulf_copy_pose);
717 accumulator.
apply(disulf_copy_pose);
723 if (option[ OptionKeys::remodel::cen_minimize]) {
736 std::cout <<
"bb at " << i <<
" " << cmmop->get_bb(i) << std::endl;
745 if (cmmop->get_bb(i) == 1){
755 TR <<
"centroid minimizing" << std::endl;
756 Pose archived_pose = pose;
763 if (basic::options::option[ OptionKeys::remodel::repeat_structure].user()){
766 Size repeat_number = basic::options::option[ OptionKeys::remodel::repeat_structure];
770 for (
Size rep = 1; rep < repeat_number-1; rep++){
771 std::stringstream templateRangeSS;
772 templateRangeSS <<
"2-" << segment_length+1;
773 std::stringstream targetSS;
774 targetSS << 1+(segment_length*rep)+1 <<
"-" << segment_length + (segment_length*rep)+1;
775 TR <<
"NCS " << templateRangeSS.str() <<
" " << targetSS.str() << std::endl;
776 setup_ncs.
add_group(templateRangeSS.str(), targetSS.str());
779 for (
Size rep = 1; rep < repeat_number-1; rep++){
780 std::stringstream templateRangeSS;
781 templateRangeSS <<
"3-" << segment_length+2;
782 std::stringstream targetSS;
783 targetSS << 1+(segment_length*rep)+2 <<
"-" << segment_length + (segment_length*rep)+2;
784 TR <<
"NCS " << templateRangeSS.str() <<
" " << targetSS.str() << std::endl;
785 setup_ncs.
add_group(templateRangeSS.str(), targetSS.str());
789 std::stringstream templateRangeSS;
791 templateRangeSS <<
"2-" << segment_length-1;
792 std::stringstream targetSS;
793 targetSS << 1+(segment_length*(repeat_number-1))+1 <<
"-" << segment_length + (segment_length*(repeat_number-1))-1;
794 TR <<
"NCS " << templateRangeSS.str() <<
" " << targetSS.str() << std::endl;
795 setup_ncs.
add_group(templateRangeSS.str(), targetSS.str());
796 setup_ncs.
apply(pose);
823 TR <<
"cen_minimize pose foldtree: " << pose.
fold_tree() << std::endl;
824 minMover->apply(pose);
840 designMover.
apply(pose);
842 if ( basic::options::option[basic::options::OptionKeys::enzdes::cstfile].user() ||
843 basic::options::option[ OptionKeys::constraints::cst_file ].user()
846 bool CScore(pose_constraint.
apply( pose ));
851 accumulator.
apply(pose);
854 accumulator.
apply(pose);
858 if (option[OptionKeys::remodel::checkpoint]){
860 TR <<
"writing chkpnt at step " << num_traj-i+prev_checkpoint << std::endl;
864 if (option[ OptionKeys::remodel::repeat_structure].user()) {
866 pose = cached_modified_pose;
880 std::vector<core::pose::PoseOP> results;
893 TR <<
"clustered poses count: " << results.size() << std::endl;
894 for(std::vector<core::pose::PoseOP>::iterator it = results.begin(),
end= results.end(); it!=
end; it++){
895 bool bypass_refinement = basic::options::option[basic::options::OptionKeys::remodel::quick_and_dirty].user();
896 if (working_model.manager.size() == 0 ) bypass_refinement =
true;
897 if ( !bypass_refinement ){
903 TR <<
"aggressively refine" << std::endl;
904 if (basic::options::option[basic::options::OptionKeys::remodel::use_pose_relax]){
906 TR <<
"WARNING: DESIGN REFINE SEQ RELAX FAILED!! (one should never see this)" << std::endl;
911 TR <<
"WARNING: DESIGN REFINE FAILED TO CLOSE STRUCTURE!!" << std::endl;
918 designMover.
apply(*(*it));
922 if ( basic::options::option[basic::options::OptionKeys::remodel::run_confirmation].user()){
924 TR <<
"WARNING: STRUCTURE DID NOT PASS KIC CONFIRMATION!!" << std::endl;
929 std::stringstream SS;
930 std::string prefix = basic::options::option[basic::options::OptionKeys::out::prefix];
931 if (!prefix.empty()){
932 SS << prefix <<
"_" << filecount <<
".pdb";
935 SS << filecount <<
".pdb";
941 (*(*it)).dump_scored_pdb(SS.str(), *scorefxn);
945 if (score <= current_score) {
946 current_score = score ;
959 CalculatorFactory::Instance().register_calculator(
985 CalculatorFactory::Instance().register_calculator(
987 new BuriedUnsatisfiedPolarsCalculator(
994 MetricValue< std::set< Size > > loops_neighborhood;
996 CalculatorFactory::Instance().register_calculator(
998 new BuriedUnsatisfiedPolarsCalculator(
1001 loops_neighborhood.value()
1008 return "RemodelMover";
1016 if (basic::options::option[basic::options::OptionKeys::remodel::bypass_fragments]){
1017 TR <<
"-=BYPASSING FRAGMENT BUILD (REFINE ONLY) =-" << std::endl;
1041 using namespace basic::options;
1047 using namespace protocols::forge::components;
1053 Pose archive_pose = pose;
1054 Pose modified_archive_pose = archive_pose;
1059 bool mod_ap_is_full_atom =
true;
1060 for (
Size i = 1, ie = modified_archive_pose.n_residue(); mod_ap_is_full_atom && i != ie; ++i ) {
1064 if ( !mod_ap_is_full_atom ) {
1082 if ( !
vlb_.get() ) {
1091 abego_vec.push_back(buffer);
1093 vlb_->set_abego(abego_vec);
1098 vlb_->use_fullmer( option[OptionKeys::remodel::use_same_length_fragments] );
1101 vlb_->restart_mode(
true);
1103 if ( option[OptionKeys::remodel::use_blueprint_sequence] ) {
1104 if (option[ OptionKeys::remodel::repeat_structure].user()) {
1105 Size copies = option[ OptionKeys::remodel::repeat_structure];
1111 vlb_->new_sequence_override( rep_seq );
1117 vlb_->apply( pose );
1127 if (option[ OptionKeys::remodel::repeat_structure].user()) {
1133 if (modified_archive_pose.total_residue() == pose.
total_residue()){
1136 using namespace protocols::loops;
1142 Pose bufferPose(modified_archive_pose);
1159 (*fullatom_sfx_)( pose );
1161 if (option[ OptionKeys::remodel::repeat_structure].user()) {
1163 modified_archive_pose = archive_pose;
1170 pose = archive_pose;
1190 using namespace protocols::loops;
1195 using namespace core::scoring::constraints;
1196 using namespace basic::options;
1213 if (basic::options::option[ OptionKeys::remodel::repeat_structure].user()){
1235 if (basic::options::option[ OptionKeys::remodel::repeat_structure].user()){
1243 if (basic::options::option[ OptionKeys::remodel::repeat_structure].user()){
1246 Size repeat_number = basic::options::option[ OptionKeys::remodel::repeat_structure];
1250 for (
Size rep = 1; rep < repeat_number-1; rep++){
1251 std::stringstream templateRangeSS;
1252 templateRangeSS <<
"2-" << segment_length+1;
1253 std::stringstream targetSS;
1254 targetSS << 1+(segment_length*rep)+1 <<
"-" << segment_length + (segment_length*rep)+1;
1255 TR <<
"NCS " << templateRangeSS.str() <<
" " << targetSS.str() << std::endl;
1256 setup_ncs.add_group(templateRangeSS.str(), targetSS.str());
1259 for (
Size rep = 1; rep < repeat_number-1; rep++){
1260 std::stringstream templateRangeSS;
1261 templateRangeSS <<
"3-" << segment_length+2;
1262 std::stringstream targetSS;
1263 targetSS << 1+(segment_length*rep)+2 <<
"-" << segment_length + (segment_length*rep)+2;
1264 TR <<
"NCS " << templateRangeSS.str() <<
" " << targetSS.str() << std::endl;
1265 setup_ncs.add_group(templateRangeSS.str(), targetSS.str());
1269 std::stringstream templateRangeSS;
1271 templateRangeSS <<
"2-" << segment_length-1;
1272 std::stringstream targetSS;
1273 targetSS << 1+(segment_length*(repeat_number-1))+1 <<
"-" << segment_length + (segment_length*(repeat_number-1))-1;
1274 TR <<
"NCS " << templateRangeSS.str() <<
" " << targetSS.str() << std::endl;
1275 setup_ncs.add_group(templateRangeSS.str(), targetSS.str());
1284 designMover.
apply(pose);
1287 if (basic::options::option[ OptionKeys::remodel::repeat_structure].user()){
1288 setup_ncs.apply(pose);
1292 if (option[OptionKeys::remodel::RemodelLoopMover::cyclic_peptide].user()){
1296 sfx->show(
TR, pose);
1300 relaxMover.
apply(pose);
1304 sfx->show(
TR, pose);
1333 using namespace core::pack::task::operation;
1334 using namespace protocols::toolbox::task_operations;
1340 using namespace protocols::loops;
1366 FoldTree original_ft = pose.
fold_tree();
1393 designMover.
apply(pose);
1398 if (!basic::options::option[basic::options::OptionKeys::remodel::swap_refine_confirm_protocols].user()){
1400 LoopMover_Refine_CCD refine( loops, sfx );
1407 TR <<
"NATRO movemap setup: turning off DNA bb and chi move for refinement stage" << std::endl;
1421 natroPositions.push_back(i);
1425 natroRes->residue_indices( natroPositions );
1427 refine_tf->push_back( natroRes );
1429 refine.false_movemap( combined_mm );
1430 refine.set_task_factory( refine_tf );
1431 refine.apply( pose );
1459 bool cbreaks_pass =
true;
1461 if ( l->cut() > 0 ) {
1463 TR <<
"design_refine: final chainbreak = " << c <<
" at " << l->cut() << std::endl;
1470 return cbreaks_pass;
1476 using namespace protocols::loops;
1477 using namespace protocols::forge::methods;
1493 TR <<
"confirmation loops tree" << loop_ft << std::endl;
1496 FoldTree original_ft = pose.
fold_tree();
1502 TR <<
"fold tree entering confirmation: " << pose.
fold_tree() << std::endl;
1506 if (basic::options::option[basic::options::OptionKeys::remodel::swap_refine_confirm_protocols].user()){
1507 TR <<
"REFINE USING CCD" << std::endl;
1525 TR <<
"NATRO movemap setup: turning off DNA bb and chi move for refinement stage" << std::endl;
1537 refine.
apply( pose );
1540 TR <<
"REFINE USING KIC" << std::endl;
1557 for (
Loops::iterator it = confirmation_loops->v_begin(),
end = confirmation_loops->v_end(); it!=
end; it++) {
1558 for (
core::Size i = it->start(); i <= it->stop(); ++i){
1559 core::Real dist_squared = (pose.
residue(i).
xyz(
"CA" ) - archive_pose.residue(i).xyz(
"CA" ) ).length_squared();
1562 sum_sd = sum_sd + dist_squared;
1563 sum_sd_native = sum_sd_native + dist_squared_native;
1564 sum_sd_archive2native = sum_sd_archive2native + dist_squared_archive2native;
1567 std::cout <<
" Backbone atom= " <<
"CA res: " << i <<
" dist_squared= " << dist_squared << std::endl;
1568 std::cout <<
" Backbone atom= " <<
"CA res: " << i <<
" dist_squared_native= " << dist_squared_native << std::endl;
1569 std::cout <<
" Backbone atom= " <<
"CA res: " << i <<
" dist_squared_archive2native= " << dist_squared_archive2native << std::endl;
1573 sum_sd = sum_sd/atom_count;
1574 sum_sd_native = sum_sd_native/atom_count;
1575 sum_sd_archive2native = sum_sd_archive2native/atom_count;
1578 core::Real rmsd_native = sqrt(sum_sd_native);
1579 core::Real rmsd_archive2native = sqrt(sum_sd_archive2native);
1584 remark.
value =
"KIC confirmation RMSD: " + utility::to_string(rmsd) +
" to native RMSD: " + utility::to_string(rmsd_native) ;
1585 temp_pdbinfo->remarks().push_back( remark );
1587 remark.value =
" ARCHIVE2NATIVE RMSD: " + utility::to_string(rmsd_archive2native);
1589 temp_pdbinfo->remarks().push_back( remark );
1593 TR <<
"RMSD of KIC confirmation: " << rmsd << std::endl;
1594 TR <<
"RMSD of KIC confirmation to native: " << rmsd_native << std::endl;
1595 TR <<
"RMSD of ARCHIVE to NATIVE: " << rmsd_archive2native << std::endl;
1624 if (!basic::options::option[basic::options::OptionKeys::remodel::design::allow_rare_aro_chi].user()){
1642 Interval const & original_interval,
1643 String const & design_str,
1652 Size const offset = original2modified_interval_endpoints.find( original_interval.
left )->second;
1653 for (
Size i = 0, ie = design_str.length(); i < ie; ++i ) {
1656 switch ( design_str.at( i ) ) {
1675 Interval const & original_interval,
1676 String const & design_str,
1689 char const insert_char = SegmentInsert::insertion_char();
1693 original2modified_interval_endpoints.find( original_interval.
left )->second,
1694 original2modified_interval_endpoints.find( original_interval.
right )->second
1697 Size const insert_char_idx = design_str.find( insert_char );
1698 Size const left_nres = insert_char_idx;
1699 Size const right_nres = design_str.size() - left_nres - 1;
1700 Size const insert_nres = interval.
length() - left_nres - right_nres;
1706 aa.replace( insert_char_idx, 1, insert_nres, insert_char );
1711 Size const left_offset = interval.left;
1712 for (
Size i = 0, ie = aa.size(); i < ie; ++i ) {
1715 if ( aa.at( i ) == insert_char ) {
1716 repack_op->include_residue( i + left_offset );
1718 }
else if ( aa.at( i ) ==
's' ) {
1720 }
else if ( aa.at( i ) ==
'.' ) {
1729 design_tf->push_back( repack_op );
1738 static String surface_aa =
"ADEGHIKLMNPQRSTV";
1741 for (
Size i = 0, ie = surface_aa.length(); i < ie; ++i ) {
1757 if( tag->hasOption(
"blueprint") ) {