25 #include <basic/Tracer.hh>
26 #include <basic/MetricValue.hh>
38 #include <basic/options/option.hh>
39 #include <basic/options/keys/remodel.OptionKeys.gen.hh>
49 #include <numeric/random/random.hh>
51 #include <utility/vector0.hh>
52 #include <utility/vector1.hh>
66 static basic::Tracer
TR(
"protocols.forge.remodel.RemodelDesignMover" );
69 static numeric::random::RandomGenerator
RG( 2342342 );
81 using namespace basic::options;
91 CalculatorFactory::Instance().remove_calculator(
"neighborhood_calc" );
93 std::set< core:: Size > und_pos;
97 if (option[ OptionKeys::remodel::repeat_structure].user()){
98 Size repeatCount = option[ OptionKeys::remodel::repeat_structure];
99 for (
Size rep = 0; rep < repeatCount ; rep++){
100 for (std::set< core::Size >::iterator it = uup.begin(); it != uup.end(); ++it){
105 if ( !(*it+remodel_data.
blueprint.size()*rep > (remodel_data.
blueprint.size()*repeatCount)) ){
106 und_pos.insert(*it + remodel_data.
blueprint.size()*rep);
116 CalculatorFactory::Instance().register_calculator(
118 new NeighborhoodByDistanceCalculator( und_pos )
140 using namespace basic::options;
141 if ( basic::options::option[basic::options::OptionKeys::remodel::design::no_design].user() ){
142 TR <<
"bypassing design due to invokation of -no_design" << std::endl;
150 bool design = basic::options::option[basic::options::OptionKeys::remodel::design::design_neighbors].user();
153 basic::Error() <<
"check_state failed, has to set_state first " << std::endl;
178 if (option[ OptionKeys::remodel::repeat_structure].user()){
189 if (!strcmp(
state_.c_str(),
"stage")){
195 if (!basic::options::option[basic::options::OptionKeys::remodel::design::skip_partial].user()){
203 else if (!strcmp(
state_.c_str(),
"finish")){
234 return "RemodelDesignMover";
240 TR <<
"state tag not set " << std::endl;
242 TR <<
"Design Mover State: " <<
state_ << std::endl;
259 utility::vector1_bool & residues )
264 typedef std::set< core::Size > SizeSet;
265 basic::MetricValue< SizeSet > mv_sizeset;
266 pose.
metric(calculator, calculation, mv_sizeset);
267 SizeSet
const & sizeset(mv_sizeset.value());
270 for(SizeSet::const_iterator it(sizeset.begin()),
end(sizeset.end()) ; it !=
end; ++it){
272 residues[*it] =
true; }
280 using namespace basic::options;
289 CalculatorFactory::Instance().remove_calculator(
"reducetask_calc" );
292 std::set<Size> positionList;
295 positionList.insert(i);
299 CalculatorFactory::Instance().register_calculator(
301 new NeighborhoodByDistanceCalculator( positionList )
310 Size CORE_CUTOFF = option[ OptionKeys::remodel::core_cutoff ];
311 Size BOUNDARY_CUTOFF = option[ OptionKeys::remodel::boundary_cutoff ];
314 basic::MetricValue< std::map< core::Size, core::Size > >nbr_map;
315 pose.
metric(
"reducetask_calc",
"num_neighbors_map", nbr_map);
316 std::map< core::Size, core::Size > sizemap=nbr_map.value();
318 TR.Debug <<
"sizemap content " << sizemap.size() << std::endl;
320 for (std::map< core::Size, core::Size>::iterator it= sizemap.begin(); it!=sizemap.end(); it++){
321 TR.Debug <<
"neighborlist " << (*it).first <<
" " << (*it).second << std::endl;
324 if (option[ OptionKeys::remodel::repeat_structure].user()){
328 for (
Size i = 1; i<= resclass.size(); i++){
337 int boundaryCount = 0;
340 for (
unsigned jj = 1; jj <= copies.size(); ++jj){
342 visited[ copies[jj] ] =
true;
344 TR.Debug <<
"sizemap in repeat decision " << copies[jj] <<
" " << sizemap[ copies[jj] ] << std::endl;
347 if ( sizemap[ copies[jj] ] >= CORE_CUTOFF){
349 }
else if ( sizemap[ copies[jj] ] < CORE_CUTOFF && sizemap[ copies[jj] ] >= BOUNDARY_CUTOFF ){
351 }
else if ( sizemap[ copies[jj] ] < BOUNDARY_CUTOFF){
354 TR <<
"RESCLASS ERROR" << sizemap[i] << std::endl;
361 for (
unsigned jj = 1; jj <= copies.size(); ++jj){
362 corePos.push_back(copies[jj]);
367 else if (coreCount == 0 && boundaryCount > 0){
369 for (
unsigned jj = 1; jj <= copies.size(); ++jj){
370 boundaryPos.push_back(copies[jj]);
375 else if (coreCount == 0 && boundaryCount == 0){
377 for (
unsigned jj = 1; jj <= copies.size(); ++jj){
378 surfPos.push_back(copies[jj]);
384 TR <<
"no idea what kind of scenario this would be" << std::endl;
390 for (
Size i = 1; i<= resclass.size(); i++){
391 if (task->nonconst_residue_task(i).being_packed() && sizemap[i]){
392 TR <<
"touch position " << i << std::endl;
393 if (sizemap[i] >= CORE_CUTOFF){
394 corePos.push_back(i);
395 }
else if ( sizemap[i] < CORE_CUTOFF && sizemap[i] >= BOUNDARY_CUTOFF){
396 boundaryPos.push_back(i);
397 }
else if ( sizemap[i] < BOUNDARY_CUTOFF){
398 surfPos.push_back(i);
400 TR <<
"RESCLASS ERROR" << sizemap[i] << std::endl;
430 decoy.push_back(
"APOLAR");
432 TR <<
"APOLAR " << resid << std::endl;
434 command->initialize_from_tokens(decoy, whichtoken, resid );
435 command->residue_action(*task, resid);
441 decoy.push_back(
"NATRO");
443 TR <<
"NATRO " <<
"(" << pose.
residue(resid).
name() <<
")"<< std::endl;
445 command->initialize_from_tokens(decoy, whichtoken, resid );
446 command->residue_action(*task, resid);
454 decoy.push_back(
"ALLAAxc");
456 TR <<
"ALLAAxc " << resid << std::endl;
458 command->initialize_from_tokens( decoy, whichtoken, resid);
459 command->residue_action(*task, resid);
465 decoy.push_back(
"NATRO");
467 TR <<
"NATRO " << resid <<
"(" << pose.
residue(resid).
name() <<
")" << std::endl;
469 command->initialize_from_tokens( decoy, whichtoken, resid);
470 command->residue_action( *task, resid);
479 decoy.push_back(
"POLAR");
481 TR <<
"POLAR " << resid << std::endl;
483 command->initialize_from_tokens(decoy, whichtoken, resid);
484 command->residue_action( *task, resid);
490 decoy.push_back(
"NATRO");
492 TR <<
"NATRO " << resid <<
" (" << pose.
residue(resid).
name() <<
")" << std::endl;
494 command->initialize_from_tokens(decoy, whichtoken, resid);
495 command->residue_action(*task, resid);
508 using namespace basic::options;
509 using namespace core::chemical;
513 DisulfideMatchingPotential disulfPot;
519 Size landingRangeStart = 1;
526 TR <<
"Assignging Landing Range by Blueprint: " << landingRangeStart <<
" to " << landingRangeStop << std::endl;
529 if (option[ OptionKeys::remodel::disulf_landing_range].user()){
530 landingRangeStart = option[ OptionKeys::remodel::disulf_landing_range]()[1];
531 landingRangeStop = option[ OptionKeys::remodel::disulf_landing_range]()[2];
532 TR <<
"Assignging Landing Range by Arguments: " << landingRangeStart <<
" to " << landingRangeStop << std::endl;
536 TR <<
"FINDING DISULF" << std::endl;
537 utility::vector1_bool modeled_clusters(pose.
total_residue(),
false);
538 utility::vector1_bool residue_clusters(pose.
total_residue(),
false);
541 run_calculator(pose,
"neighborhood_calc",
"neighbors", residue_clusters);
542 run_calculator(pose,
"neighborhood_calc",
"central_residues", modeled_clusters);
549 for (utility::vector1_bool::iterator itr=modeled_clusters.begin(),
end=modeled_clusters.end(); itr !=
end; itr++){
555 TR <<
"Use disulf mobile range start: " << i << std::endl;
562 TR <<
"Use disulf mobile range stop: " << i << std::endl;
570 for (utility::vector1_bool::iterator itr=modeled_clusters.begin(),
end=modeled_clusters.end(); itr !=
end; itr++){
573 if ( residue_clusters[i] == 1) {
575 nbr_res.push_back(i);
577 if (modeled_clusters[i] == 1){
579 cen_res.push_back(i);
583 TR <<
"central residues: ";
589 TR <<
"neighbor residues: ";
606 disulfPot.score_disulfide(pose.
residue(*itr), pose.
residue(*itr2), match_t, match_r, match_rt);
609 int seqGap = (
int)*itr2-(
int)*itr;
610 if (match_rt < option[OptionKeys::remodel::match_rt_limit] && std::abs(seqGap)>1 && (*itr2) <= landingRangeStop && (*itr2) >= landingRangeStart){
611 TR <<
"DISULF possible " << dist << std::endl;
612 TR <<
"DISULF " << *itr <<
"x" << *itr2 << std::endl;
613 TR <<
"match_rt " << match_rt << std::endl;
614 std::pair<Size, Size> temp_pair;
615 temp_pair = std::make_pair(*itr, *itr2);
616 disulf_partners.push_back(temp_pair);
630 for (
utility::vector1<std::pair<Size,Size> >::iterator itr = disulf_partners.begin(); itr != disulf_partners.end(); itr++){
633 TR <<
"build_disulf between " << (*itr).first <<
" and " << (*itr).second << std::endl;
642 TR <<
"MODE 1: AUTO DESIGN of remodeled regions only" << std::endl;
650 utility::vector1_bool additional_sites(pose.
total_residue(),
false);
652 run_calculator(pose,
"neighborhood_calc",
"central_residues", additional_sites);
656 TR <<
"number to be packed after adding sites: " <<
working_model_.
task->num_to_be_packed() << std::endl;
661 TR <<
"MODE 2: AUTO DESIGN of remodeled regions and neighbors" << std::endl;
669 utility::vector1_bool additional_sites(pose.
total_residue(),
false);
671 run_calculator(pose,
"neighborhood_calc",
"neighbors", additional_sites);
675 TR <<
"number to be packed after adding sites: " <<
working_model_.
task->num_to_be_packed() << std::endl;
680 TR <<
"MODE 3: AUTO DESIGN of remodeled regions and repack neighbors only" << std::endl;
688 utility::vector1_bool additional_sites(pose.
total_residue(),
false);
689 utility::vector1_bool core_sites(pose.
total_residue(),
false);
691 run_calculator(pose,
"neighborhood_calc",
"neighbors", additional_sites);
692 run_calculator(pose,
"neighborhood_calc",
"central_residues", core_sites);
697 for (
Size ii = 1; ii <= core_sites.size();++ii){
698 if ( !core_sites[ii] ){
706 TR <<
"number to be packed after adding sites: " <<
working_model_.
task->num_to_be_packed() << std::endl;
713 TR <<
"MODE 4: Manual DESIGN REMODEL" << std::endl;
721 TR <<
"MODE 5: Manual DESIGN REMODEL with DESIGN NEIGHBOR" << std::endl;
730 utility::vector1_bool additional_sites(pose.
total_residue(),
false);
733 run_calculator(pose,
"neighborhood_calc",
"neighbors", additional_sites);
742 TR <<
"number to be packed after adding sites: " <<
working_model_.
task->num_to_be_packed() << std::endl;
751 TR <<
"MODE 6: Manual DESIGN REMODEL with REPACK NEIGHBOR" << std::endl;