52 #include <basic/options/option.hh>
54 #include <basic/Tracer.hh>
56 #include <utility/tag/Tag.hh>
57 #include <utility/pointer/access_ptr.hh>
62 #include <utility/string_util.hh>
65 #include <basic/options/keys/packing.OptionKeys.gen.hh>
66 #include <basic/options/keys/enzdes.OptionKeys.gen.hh>
72 #include <utility/vector0.hh>
73 #include <utility/vector1.hh>
79 static basic::Tracer
tr(
"protocols.enzdes.EnzdesTaskOperations");
82 fix_catalytic_aa_(basic::options::option[basic::options::OptionKeys::enzdes::fix_catalytic_aa]),
83 behavior_non_catalytic_(
"")
104 if( !enz_obs)
return;
106 if( !cst_cache )
return;
108 std::string catinfo(
"SetCatalyticResPackBehavior task operation touched the following catalytic residues: ");
115 if( also_touch_noncatalytic ){
122 if( cst_cache->contains_position( i ) ){
123 catinfo = catinfo + utility::to_string( i ) +
", ";
130 if( cstio->is_backbone_only_cst( pose, i ) ){
133 for(
core::Size j =1; j <= allowed_name3.size(); ++j){
142 if( basic::options::option[basic::options::OptionKeys::enzdes::ex_catalytic_rot].user() &&
145 core::pack::task::ExtraRotSample cat_rot_sample( static_cast<core::pack::task::ExtraRotSample>(basic::options::option[basic::options::OptionKeys::enzdes::ex_catalytic_rot].value() ) );
166 else if( also_touch_noncatalytic ) resf_command->residue_action(task, i );
168 tr << catinfo << std::endl;
174 if( tag->hasOption(
"fix_catalytic_aa") )
fix_catalytic_aa_ = tag->getOption<
bool>(
"fix_catalytic_aa", 1);
204 detect_design_interface_(true), catalytic_res_part_of_interface_(false), design_(true),
205 repack_only_(false), score_only_(false),
207 add_observer_cache_segs_to_interface_(false),
208 no_design_cys_(true),
210 use_cstid_list_(false),
230 arg_sweep_interface_ = basic::options::option[basic::options::OptionKeys::enzdes::arg_sweep_interface];
231 arg_sweep_cutoff_ = basic::options::option[basic::options::OptionKeys::enzdes::arg_sweep_cutoff];
232 score_only_ = basic::options::option[basic::options::OptionKeys::enzdes::enz_score];
233 repack_only_ = basic::options::option[basic::options::OptionKeys::enzdes::enz_repack];
234 cut1_ = basic::options::option[basic::options::OptionKeys::enzdes::cut1];
235 cut2_ = basic::options::option[basic::options::OptionKeys::enzdes::cut2];
236 cut3_ = basic::options::option[basic::options::OptionKeys::enzdes::cut3];
237 cut4_ = basic::options::option[basic::options::OptionKeys::enzdes::cut4];
238 if ( basic::options::option[basic::options::OptionKeys::packing::resfile].user() ) {
239 resfilename_ = basic::options::option[basic::options::OptionKeys::packing::resfile].value().at(1);
248 if( tag->hasOption(
"repack_only") )
repack_only_ = tag->getOption<
bool >(
"repack_only",
false );
254 design_ = tag->getOption<
bool >(
"design", 1 );
256 no_design_cys_ = ! ( tag->getOption<
bool >(
"design_to_cys", 0 ) );
260 if( tag->hasOption(
"arg_sweep_interface") )
arg_sweep_interface_ = tag->getOption<
bool >(
"arg_sweep_interface",
true );
261 if( tag->hasOption(
"catres_only_interface"))
catres_only_ = tag->getOption<
bool >(
"catres_only_interface",
true );
262 if( tag->hasOption(
"target_cstids")) {
279 tr.Info <<
"Reading resfile input from: " <<
resfilename_ << std::endl;
281 resfile_read.
apply( pose, task );
296 if ( cut1 < 0.0 || cut2 < cut1 || cut3 < cut2 || cut4 < cut3 ) {
297 if (cut1 < 0.0) { cut1 = 0.0; }
298 if (cut2 < cut1) { cut2 = cut1; }
299 if (cut3 < cut2) { cut3 = cut2; }
300 if (cut4 < cut3) { cut4 = cut3; }
301 tr.Warning <<
"WARNING: detect design interface cutpoints should be in ascending order. Was " <<
cut1_ <<
" " <<
cut2_ <<
" " <<
cut3_ <<
" " <<
cut4_ <<
"; Reset to " << cut1 <<
" " << cut2 <<
" " << cut3 <<
" " << cut4 << std::endl;
314 std::unique( trg_res.begin(), trg_res.end() );
315 std::set< core::Size > trg_set( trg_res.begin(), trg_res.end() );
316 interface_target_res = trg_set;
338 tr.Info <<
"Choosing the following residues as targets for detecting interface: ";
339 for( std::set< core::Size >::const_iterator targ_it( interface_target_res.begin()),targ_end(interface_target_res.end());targ_it != targ_end; ++targ_it ){
340 tr.Info << *targ_it <<
"+";
342 tr.Info << std::endl;
348 detect_res[i] =
true;
351 detect_res[i] =
false;
357 detect_res[i] =
true;
372 if (detect_res[i] ==
true){
373 if( design_res[i] ==
true) {
381 }
else if( repack_res[i] ==
true ){
411 tr.Info <<
"Final Design Shell Residues: ";
414 tr.Info << i <<
", ";
417 tr.Info << std::endl <<
"Final Repack Shell Residues: ";
420 tr.Info << i <<
", ";
423 tr.Info << std::endl;
432 std::set< core::Size >
const & interface_target_res,
447 for( std::set< core::Size >::const_iterator targ_it( interface_target_res.begin()),targ_end(interface_target_res.end());
448 targ_it != targ_end; ++targ_it ){
450 repack_res[ *targ_it ] =
true;
455 design_res[ *targ_it ] =
true;
456 repack_res[ *targ_it ] =
false;
461 if( design_res[i] )
continue;
462 if( interface_target_res.find( i ) != interface_target_res.end() )
continue;
466 if( prot_rsd.
has(
"CB") ) prot_cb = prot_rsd.
xyz(
"CB");
467 if( prot_rsd.
has(
"CA") ) prot_ca = prot_rsd.
xyz(
"CA");
468 core::Real ca_dist2 = targ_rsd.
xyz(k).distance_squared( prot_ca );
469 if( ca_dist2 <= cut4_sq ) {
470 if( ca_dist2 <= cut3_sq ) {
471 if( ca_dist2 <= cut2_sq ) {
472 if( ca_dist2 <= cut1_sq) {
473 design_res[i] =
true;
474 repack_res[i] =
false;
477 else if( prot_rsd.
has(
"CB") ) {
478 core::Real cb_dist2 = targ_rsd.
xyz(k).distance_squared( prot_cb );
480 if( cb_dist2 < ca_dist2 ) {
481 design_res[i] =
true;
482 repack_res[i] =
false;
486 repack_res[i] =
true;
489 else if ( prot_rsd.
has(
"2HA") ) {
491 prot_cb = prot_rsd.
xyz(
"2HA");
492 core::Real cb_dist2 = targ_rsd.
xyz(k).distance_squared( prot_cb );
493 if( cb_dist2 < ca_dist2 ) {
494 design_res[i] =
true;
495 repack_res[i] =
false;
499 repack_res[i] =
true;
503 tr.Info <<
"Weird residue without CB or 2HA. Watch out! Residue:" << i << std::endl;
504 design_res[i] =
false;
505 repack_res[i] =
true;
510 repack_res[i] =
true;
514 else if( prot_rsd.
has(
"CB") ) {
515 core::Real cb_dist2 = targ_rsd.
xyz(k).distance_squared( prot_cb );
516 if( cb_dist2 < ca_dist2 ) {
517 repack_res[i] =
true;
525 std::string repackres_string(
""), designres_string;
530 repackres_string = repackres_string + utility::to_string( i ) +
"+";
534 designres_string = designres_string + utility::to_string( i ) +
"+";
536 if( ( repack_res[i] ==
true) && ( design_res[i] ==
true ) ) {
tr.Info <<
"Huh? this should not happen. " << std::endl; }
539 tr.Info <<
"Design Interface: detected " << num_design <<
" design-shell residues and " << num_repack <<
" repack-shell residues, shell sizes cut1-4 used were " << cut1 <<
" " << cut2 <<
" " << cut3 <<
" " << cut4 << std::endl <<
"Design-shell Residues(pose-numbering): " << designres_string;
540 tr.Info << std::endl <<
"Repack-shell Residues(pose-numbering): " << repackres_string << std::endl;
547 std::set< core::Size >
const & interface_target_res,
562 for( std::set< core::Size >::const_iterator targ_it( interface_target_res.begin()),targ_end(interface_target_res.end());
563 targ_it != targ_end; ++targ_it ){
565 repack_res[ *targ_it ] =
true;
570 design_res[ *targ_it ] =
true;
571 repack_res[ *targ_it ] =
false;
577 if( design_res[i] )
continue;
578 if( interface_target_res.find( i ) != interface_target_res.end() )
continue;
581 core::Real contact_threshold_ = arg_sweep_cutoff * arg_sweep_cutoff ;
583 bool base_only_ =
false;
589 if( dis2 <= contact_threshold_ ) {
590 design_res[i] =
true;
591 repack_res[i] =
false;
599 if( prot_rsd.
has(
"CB") ) prot_cb = prot_rsd.
xyz(
"CB");
600 if( prot_rsd.
has(
"CA") ) prot_ca = prot_rsd.
xyz(
"CA");
601 core::Real ca_dist2 = targ_rsd.
xyz(k).distance_squared( prot_ca );
602 if( ca_dist2 <= cut4_sq ) {
603 if( ca_dist2 <= cut3_sq ) {
604 if( ca_dist2 <= cut2_sq ) {
605 if( ca_dist2 <= cut1_sq) {
606 design_res[i] =
false;
607 repack_res[i] =
true;
610 else if( prot_rsd.
has(
"CB") ) {
611 core::Real cb_dist2 = targ_rsd.
xyz(k).distance_squared( prot_cb );
613 if( cb_dist2 < ca_dist2 ) {
614 design_res[i] =
false;
615 repack_res[i] =
true;
619 repack_res[i] =
true;
622 else if ( prot_rsd.
has(
"2HA") ) {
624 prot_cb = prot_rsd.
xyz(
"2HA");
625 core::Real cb_dist2 = targ_rsd.
xyz(k).distance_squared( prot_cb );
626 if( cb_dist2 < ca_dist2 ) {
627 design_res[i] =
false;
628 repack_res[i] =
true;
632 repack_res[i] =
true;
636 tr.Info <<
"Weird residue without CB or 2HA. Watch out! Residue:" << i << std::endl;
637 design_res[i] =
false;
638 repack_res[i] =
true;
643 repack_res[i] =
true;
647 else if( prot_rsd.
has(
"CB") ) {
648 core::Real cb_dist2 = targ_rsd.
xyz(k).distance_squared( prot_cb );
649 if( cb_dist2 < ca_dist2 ) {
650 repack_res[i] =
true;
658 std::string repackres_string(
""), designres_string;
663 repackres_string = repackres_string + utility::to_string( i ) +
"+";
667 designres_string = designres_string + utility::to_string( i ) +
"+";
669 if( ( repack_res[i] ==
true) && ( design_res[i] ==
true ) ) {
tr.Info <<
"Huh? this should not happen. " << std::endl; }
672 tr.Info <<
"Design Interface: detected " << num_design <<
" design-shell residues and " << num_repack <<
" repack-shell residues, shell sizes cut1-4 used were " << cut1 <<
" " << cut2 <<
" " << cut3 <<
" " << cut4 << std::endl <<
"Design-shell Residues(pose-numbering): " << designres_string;
673 tr.Info << std::endl <<
"Repack-shell Residues(pose-numbering): " << repackres_string << std::endl;
681 using namespace basic::options;
682 using namespace basic::options::OptionKeys;
684 option.add_relevant( OptionKeys::packing::resfile );
689 option.add_relevant( OptionKeys::enzdes::detect_design_interface );
690 option.add_relevant( OptionKeys::enzdes::cut1 );
691 option.add_relevant( OptionKeys::enzdes::cut2 );
692 option.add_relevant( OptionKeys::enzdes::cut3 );
693 option.add_relevant( OptionKeys::enzdes::cut4 );
694 option.add_relevant( OptionKeys::enzdes::enz_score );
695 option.add_relevant( OptionKeys::enzdes::enz_repack );
702 std::set< core::Size > & set
705 using namespace basic::datacache;
706 using namespace core::pose::datacache;
711 for(
core::Size i = 1; i <= segments.size(); ++i ){
712 for(
core::Size j = segments[i].first; j < segments[i].second; ++j ) set.insert( j );
721 catres_packer_weight_=1.0;
736 lig_packer_weight_ = basic::options::option[basic::options::OptionKeys::enzdes::lig_packer_weight];
742 if( tag->hasOption(
"interface_weight") ) lig_packer_weight_ = tag->getOption<
core::Real >(
"interface_weight", 1.0 );
743 if( tag->hasOption(
"catres_interface_weight") ) catres_packer_weight_ = tag->getOption<
core::Real >(
"catres_interface_weight", 1.0 );
753 if( lig_packer_weight_ != 1.0 ){
756 IGreweight->add_reweighter( lig_up );
758 tr.Info <<
"Packer Energies between ligand and design residues are upweighted by factor " << lig_packer_weight_ <<
"." << std::endl;
761 if (catres_packer_weight_ !=1.0){
766 else if (task.
design_residue( ii )) design_residues.push_back( ii );
772 tr.Info <<
"Packer Energies between catalytic residues and design residues are upweighted by factor " << catres_packer_weight_ <<
"." << std::endl;
780 basic::options::option.add_relevant( basic::options::OptionKeys::enzdes::lig_packer_weight );
817 if( !enz_obs )
return;
820 std::map< core::Size, utility::vector1< core::conformation::ResidueCOP > >
const & rb_map = enz_obs->lig_rigid_body_confs();
825 if( lig_it->second.size() == 0 )
continue;
826 runtime_assert( pose.
residue_type( lig_it->first ).
name3() == lig_it->second[1]->type().name3() );
829 rb_rotsetop->set_rigid_body_confs( lig_it->second );
840 basic::options::option.add_relevant( basic::options::OptionKeys::enzdes::run_ligand_motifs );
878 motif_search->run( pose, task );