54 #include <core/conformation/Residue.hh>
55 #include <core/kinematics/MoveMap.hh>
56 #include <core/pack/task/TaskFactory.hh>
57 #include <core/pack/task/operation/TaskOperations.hh>
58 #include <core/pack/task/operation/TaskOperation.hh>
59 #include <core/pose/Pose.hh>
60 #include <core/pose/PDBInfo.hh>
61 #include <core/pose/metrics/CalculatorFactory.hh>
62 #include <core/scoring/ScoreFunction.hh>
63 #include <core/scoring/ScoreFunctionFactory.hh>
64 #include <core/scoring/methods/EnergyMethodOptions.hh>
65 #include <core/scoring/hbonds/HBondOptions.hh>
66 #include <core/scoring/Energies.hh>
67 #include <core/scoring/hbonds/HBondSet.hh>
69 #include <protocols/moves/Mover.hh>
70 #include <protocols/simple_moves/MinMover.hh>
71 #include <protocols/simple_moves/PackRotamersMover.hh>
72 #include <protocols/jd2/JobDistributor.hh>
73 #include <protocols/toolbox/pose_metric_calculators/NeighborsByDistanceCalculator.hh>
74 #include <protocols/toolbox/task_operations/RestrictToInterface.hh>
76 #include <basic/options/keys/packing.OptionKeys.gen.hh>
77 #include <basic/options/keys/out.OptionKeys.gen.hh>
100 using namespace core;
156 char chain = pose.pdb_info()->chain(1);
157 if ( chain ==
' ' ) {
158 TR <<
"chain is whitespace, setting chain ID to 'A' " << std::endl;
159 for (
Size i=1; i<=pose.total_residue(); ++i ) {
160 pose.pdb_info()->chain(i,
'A');
168 int current_net_charge = get_net_charge( pose );
170 int delta_charge = target_net_charge - current_net_charge;
172 if ( delta_charge < 0 ) {
175 TR <<
"Current charge: " << current_net_charge <<
". Target charge: " << target_net_charge <<
". Incompatible user inputs. Cannot add negative charge with current options. Try using the flags include_asp include_glu (Rosetta-mode) or AvNAPSA_negative (AvNAPSA-mode)." << std::endl;
176 set_last_move_status(protocols::moves::FAIL_DO_NOT_RETRY);
179 }
else if ( delta_charge > 0 ) {
181 TR <<
"Current charge: " << current_net_charge <<
". Target charge: " << target_net_charge <<
". Incompatible user inputs. Cannot add positive charge with current options. Try using the flags include_arg include_lys (Rosetta-mode) or AvNAPSA_positive (AvNAPSA-mode)." << std::endl;
182 set_last_move_status(protocols::moves::FAIL_DO_NOT_RETRY);
185 }
else if ( delta_charge == 0 ) {
186 TR <<
"Current charge: " << current_net_charge <<
". Target charge: " << target_net_charge <<
". Current charge equals target charge, no supercharging necessary." << std::endl;
187 set_last_move_status(protocols::moves::FAIL_DO_NOT_RETRY);
193 option[OptionKeys::packing::use_input_sc](
true);
194 prepack_input_structure( pose );
201 AvNAPSA_values( pose );
202 set_resfile_AvNAPSA( pose );
203 design_supercharge_AvNAPSA( starting_pose, pose );
207 using namespace core::scoring;
208 ScoreFunctionOP
scorefxn = get_score_function();
209 scoring::methods::EnergyMethodOptions energymethodoptions(
scorefxn->energy_method_options() );
210 energymethodoptions.hbond_options().decompose_bb_hb_into_pair_energies(
true);
211 scorefxn->set_energy_method_options( energymethodoptions );
216 design_supercharge( starting_pose, pose );
220 energy_comparison( native, pose );
238 for (
Size i=1; i <= pose.n_residue(); ++i ) {
239 Real avnapsa_value( 9999 );
241 std::string name3 = pose.residue(i).name3();
243 if ( name3 ==
"ASP" || name3 ==
"GLU" || name3 ==
"ARG" || name3 ==
"LYS" || name3 ==
"ASN" || name3 ==
"GLN" ) {
247 if ( name3 ==
"ARG" || name3 ==
"LYS" ) {
248 AvNAPSA_values_.push_back( avnapsa_value );
249 TR <<
"residue " << i <<
" is already positive" << std::endl;
253 if ( name3 ==
"ASP" || name3 ==
"GLU" ) {
254 AvNAPSA_values_.push_back( avnapsa_value );
255 TR <<
"residue " << i <<
" is already negative" << std::endl;
260 conformation::Residue
const & i_rsd( pose.residue( i ) );
261 Size total_atom_neighbors_of_sidechain( 1 );
263 for (
Size ii = i_rsd.first_sidechain_atom();
ii <= i_rsd.nheavyatoms(); ++
ii ) {
264 conformation::Atom
const & ii_atom( i_rsd.atom(
ii ) );
265 Vector const & ii_atom_xyz = ii_atom.xyz();
267 for (
Size j=1; j <= pose.n_residue(); ++j ) {
269 conformation::Residue
const & j_rsd( pose.residue( j ) );
272 for (
Size jj = 1; jj <= j_rsd.nheavyatoms(); ++jj ) {
276 conformation::Atom
const & jj_atom( j_rsd.atom( jj ) );
277 Vector const & jj_atom_xyz = jj_atom.xyz();
279 if ( ii_atom_xyz.distance( jj_atom_xyz ) < 10.0 ) {
280 ++total_atom_neighbors_of_sidechain;
287 Size number_of_sidechain_atoms = i_rsd.nheavyatoms() - 4;
288 avnapsa_value = total_atom_neighbors_of_sidechain / number_of_sidechain_atoms;
290 TR <<
"residue: " << i <<
" heavy: " << i_rsd.nheavyatoms() <<
" " <<
"sidechain: " << i_rsd.first_sidechain_atom() <<
" AvNAPSA_value: " << avnapsa_value << std::endl;
294 AvNAPSA_values_.push_back( avnapsa_value );
297 TR <<
"there are " << pose.total_residue() <<
" residues and " << AvNAPSA_values_.size() <<
" AvNAPSA values" << std::endl;
307 TR <<
"Creating a resfile, it will be saved as " << out_path_ <<
"resfile_output_Asc" << std::endl;
309 OutputResfile.
open( out_path_ +
'/' +
"resfile_output_Asc" );
311 OutputResfile <<
"NATAA" << std::endl;
312 OutputResfile <<
"start" << std::endl;
314 std::stringstream pymol_avnapsa_residues;
319 for (
Size i(1); i <= AvNAPSA_values_.size(); ++i ) {
321 residues_to_mutate.push_back( i );
322 TR <<
"Mutate " << i << std::endl;
329 for (
Size i(1); i<= AvNAPSA_values_.size(); ++i ) {
330 if ( AvNAPSA_values_[i] != 9999 ) {
331 pair_residue_avnapsa.push_back( std::pair<Size,Real>(i,AvNAPSA_values_[i]) );
338 int net_charge = get_net_charge( pose );
341 for (
Size i(1); i <= pair_residue_avnapsa.size(); ++i ) {
342 Size this_res = pair_residue_avnapsa[i].first;
343 std::string name3 = pose.residue(this_res).name3();
349 }
else if ( pair_residue_avnapsa[i].second != 9999 ) {
350 residues_to_mutate.push_back(this_res);
351 TR <<
"Mutate " << this_res << std::endl;
355 if ( name3 ==
"ASP" || name3 ==
"GLU" ) {
357 }
else if ( name3 ==
"ARG" || name3 ==
"LYS" ) {
364 if ( name3 ==
"ARG" || name3 ==
"LYS" ) {
366 }
else if ( name3 ==
"ASP" || name3 ==
"GLU" ) {
377 Size number_to_mutate = residues_to_mutate.size();
378 largest_mutated_AvNAPSA_ = (
Size) pair_residue_avnapsa[number_to_mutate].second;
383 for (
Size i(1); i <= residues_to_mutate.size(); ++i ) {
384 Size j = residues_to_mutate[i];
385 pymol_avnapsa_residues << j <<
"+";
387 OutputResfile <<
" " << pose.pdb_info()->pose2pdb( j ) <<
" PIKAA K" << std::endl;
389 std::string resname = pose.residue(j).name3();
390 if ( resname ==
"ASN" ) {
391 OutputResfile <<
" " << pose.pdb_info()->pose2pdb( j ) <<
" PIKAA D" << std::endl;
393 OutputResfile <<
" " << pose.pdb_info()->pose2pdb( j ) <<
" PIKAA E" << std::endl;
398 TR <<
"PYMOL_SELECT AVNAPSA residues: " << pymol_avnapsa_residues.str() << std::endl;
409 using namespace core::pack::task::operation;
411 TaskFactoryOP task_factory(
new TaskFactory() );
412 task_factory->push_back(TaskOperationCOP(
new operation::InitializeFromCommandline() ));
415 if (
option[ OptionKeys::packing::resfile ].
user() ) {
416 task_factory->push_back( TaskOperationCOP(
new operation::ReadResfile ) );
417 TR <<
"Reading resfile from user input... make sure ALLAA is set as the default in your resfile!!" << std::endl;
420 task_factory->push_back( TaskOperationCOP(
new operation::ReadResfile( out_path_ +
'/' +
"resfile_output_Asc" ) ) );
422 using namespace core::scoring;
423 ScoreFunctionOP
scorefxn = get_score_function();
424 scoring::methods::EnergyMethodOptions energymethodoptions(
scorefxn->energy_method_options() );
425 energymethodoptions.hbond_options().decompose_bb_hb_into_pair_energies(
true);
426 scorefxn->set_energy_method_options( energymethodoptions );
430 std::string input_namebase( input_pdbname.base() );
432 protocols::simple_moves::PackRotamersMoverOP packrot_mover(
new protocols::simple_moves::PackRotamersMover );
433 packrot_mover->score_function(
scorefxn );
434 packrot_mover->task_factory( task_factory );
435 packrot_mover->apply( pose );
436 packrot_mover->apply( pose );
437 packrot_mover->apply( pose );
440 std::string pos_or_neg;
447 int final_net_charge = get_net_charge( pose );
448 std::stringstream name_info;
449 name_info <<
"_AvNAPSA_" << pos_or_neg <<
"_" << largest_mutated_AvNAPSA_ <<
"_" << final_net_charge;
451 outputname_ = input_namebase + name_info.str() +
".pdb";
452 TR <<
"NEW NAME FOR SUPERCHARGED OUTPUT: " << outputname_ << std::endl;
456 pose.dump_scored_pdb( out_path_ +
'/' + outputname_, *
scorefxn );
458 print_netcharge_and_mutations(starting_pose, pose );
476 using namespace core::pack::task::operation;
478 TaskFactoryOP task_factory(
new TaskFactory() );
479 task_factory->push_back(TaskOperationCOP(
new operation::InitializeFromCommandline() ));
481 using namespace core::scoring;
482 ScoreFunctionOP
scorefxn = get_score_function();
483 scoring::methods::EnergyMethodOptions energymethodoptions(
scorefxn->energy_method_options() );
484 energymethodoptions.hbond_options().decompose_bb_hb_into_pair_energies(
true);
485 scorefxn->set_energy_method_options( energymethodoptions );
488 protocols::simple_moves::PackRotamersMoverOP packrot_mover(
new protocols::simple_moves::PackRotamersMover );
489 packrot_mover->score_function( scorefxn_ );
491 core::pack::task::operation::RestrictToRepackingOP restrict_to_repack(
new core::pack::task::operation::RestrictToRepacking() );
492 task_factory->push_back( restrict_to_repack );
494 packrot_mover->task_factory( task_factory );
496 kinematics::MoveMapOP movemap_sc(
new kinematics::MoveMap );
497 kinematics::MoveMapOP movemap_scbb(
new kinematics::MoveMap );
498 movemap_sc->set_chi(
true );
499 movemap_sc->set_bb(
false );
500 movemap_scbb->set_chi(
true );
501 movemap_scbb->set_bb(
true );
503 protocols::simple_moves::MinMoverOP min_sc(
new protocols::simple_moves::MinMover( movemap_sc, scorefxn_,
"dfpmin_armijo", 0.01,
true ) );
504 protocols::simple_moves::MinMoverOP min_scbb(
new protocols::simple_moves::MinMover( movemap_scbb, scorefxn_,
"dfpmin_armijo", 0.01,
true ) );
507 TR <<
"Packrotamers" << std::endl;
508 packrot_mover->apply( pose );
509 packrot_mover->apply( pose );
510 packrot_mover->apply( pose );
513 TR <<
"Minimizing sidechains..." << std::endl;
514 min_sc->apply( pose );
515 TR <<
"Packrotamers" << std::endl;
516 packrot_mover->apply( pose );
517 packrot_mover->apply( pose );
518 TR <<
"Minimizing sidechains and backbone..." << std::endl;
519 min_sc->apply( pose );
520 min_scbb->apply( pose );
521 TR <<
"Packrotamers" << std::endl;
522 packrot_mover->apply( pose );
523 packrot_mover->apply( pose );
524 TR <<
"Minimizing sidechains and backbone..." << std::endl;
525 min_sc->apply( pose );
526 min_scbb->apply( pose );
527 TR <<
"Packrotamers" << std::endl;
528 packrot_mover->apply( pose );
529 packrot_mover->apply( pose );
541 Size biggest_calc(0);
542 std::string
const calc_stem(
"nbr_dist_calc_");
543 std::ostringstream calcname;
545 if ( biggest_calc <
res ) {
546 calcname << calc_stem <<
res;
547 if ( pose::metrics::CalculatorFactory::Instance().check_calculator_exists( calcname.str() ) ) {
548 basic::Warning() <<
"Calculator " << calcname.str() <<
" already exists, this is hopefully correct for your purposes" << std::endl;
550 using pose::metrics::PoseMetricCalculatorOP;
551 pose::metrics::CalculatorFactory::Instance().register_calculator( calcname.str(), PoseMetricCalculatorOP(
new protocols::toolbox::pose_metric_calculators::NeighborsByDistanceCalculator(res) ) );
561 TR << pose.pdb_info()->name() << std::endl;
562 for (
Size i(1); i<=pose.total_residue(); ++i ) {
563 calcname << calc_stem << i;
564 pose.metric( calcname.str(),
"num_neighbors", num_n);
570 TR <<
"adding " << i <<
" to surface set" << std::endl;
571 surface_res_.insert(i);
577 for (
Size i=1; i <= pose.n_residue(); ++i ) {
578 Real avnapsa_value( 9999 );
580 std::string name3 = pose.residue(i).name3();
582 if ( name3 ==
"GLY" ) {
587 conformation::Residue
const & i_rsd( pose.residue( i ) );
588 Size total_atom_neighbors_of_sidechain( 1 );
590 for (
Size ii = i_rsd.first_sidechain_atom();
ii <= i_rsd.nheavyatoms(); ++
ii ) {
591 conformation::Atom
const & ii_atom( i_rsd.atom(
ii ) );
592 Vector const & ii_atom_xyz = ii_atom.xyz();
594 for (
Size j=1; j <= pose.n_residue(); ++j ) {
596 conformation::Residue
const & j_rsd( pose.residue( j ) );
599 for (
Size jj = 1; jj <= j_rsd.nheavyatoms(); ++jj ) {
601 conformation::Atom
const & jj_atom( j_rsd.atom( jj ) );
602 Vector const & jj_atom_xyz = jj_atom.xyz();
604 if ( ii_atom_xyz.distance( jj_atom_xyz ) < 10.0 ) {
605 ++total_atom_neighbors_of_sidechain;
612 Size number_of_sidechain_atoms = i_rsd.nheavyatoms() - 4;
613 avnapsa_value = total_atom_neighbors_of_sidechain / number_of_sidechain_atoms;
617 AvNAPSA_values_.push_back( avnapsa_value );
618 TR <<
"AvNAPSA score for residue " << i <<
" " << avnapsa_value << std::endl;
620 for (
Size i(1); i<= AvNAPSA_values_.size(); ++i ) {
622 surface_res_.insert(i);
637 TR <<
"Creating a resfile, it will be saved as " << out_path_ <<
"resfile_output_Rsc" << std::endl;
639 OutputResfile.
open( out_path_ +
'/' +
"resfile_output_Rsc" );
641 OutputResfile <<
"NATAA" << std::endl;
642 OutputResfile <<
"start" << std::endl;
646 core::scoring::hbonds::HBondSet
hbond_set;
647 hbond_set.setup_for_residue_pair_energies( pose,
false,
false );
651 char NATAA_oneletter = pose.residue(*it).name1();
655 if ( NATAA_oneletter ==
'G' || NATAA_oneletter ==
'P' || NATAA_oneletter ==
'C' ) {
663 OutputResfile <<
" " << pose.pdb_info()->pose2pdb(*it) <<
" NATAA #same charge" << std::endl;
667 OutputResfile <<
" " << pose.pdb_info()->pose2pdb(*it) <<
" NATAA #same charge" << std::endl;
671 OutputResfile <<
" " << pose.pdb_info()->pose2pdb(*it) <<
" NATAA #same charge" << std::endl;
675 OutputResfile <<
" " << pose.pdb_info()->pose2pdb(*it) <<
" NATAA #same charge" << std::endl;
683 bool found_sc_hbond(
false );
686 core::scoring::hbonds::HBondCOP hbond(
hbond_set.hbond(i).get_self_ptr());
687 if ( hbond->energy() > -0.5 ) {
690 if ( hbond->don_res() == *it && !hbond->don_hatm_is_backbone() ) {
692 OutputResfile <<
" " << pose.pdb_info()->pose2pdb(*it) <<
" NATRO #has sc hbond energy=" << hbond->energy() << std::endl;
694 found_sc_hbond =
true;
697 if ( hbond->acc_res() == *it && !hbond->acc_atm_is_protein_backbone() ) {
698 OutputResfile <<
" " << pose.pdb_info()->pose2pdb(*it) <<
" NATRO #has sc hbond energy=" << hbond->energy() << std::endl;
699 found_sc_hbond =
true;
703 if ( found_sc_hbond ) {
711 PIKAA_residues.push_back(NATAA_oneletter);
713 PIKAA_residues.push_back(
'R');
716 PIKAA_residues.push_back(
'K');
719 PIKAA_residues.push_back(
'D');
722 PIKAA_residues.push_back(
'E');
726 OutputResfile <<
" " << pose.pdb_info()->pose2pdb(*it) <<
" PIKAA ";
727 for (
core::Size j(1); j<=PIKAA_residues.size(); ++j ) {
728 OutputResfile << PIKAA_residues[j];
730 OutputResfile << std::endl;
742 ref_weights.push_back(0.16);
743 ref_weights.push_back(1.7);
746 ref_weights.push_back(0.63);
747 ref_weights.push_back(-0.17);
748 ref_weights.push_back(0.56);
749 ref_weights.push_back(0.24);
751 ref_weights.push_back(-0.1);
752 ref_weights.push_back(-0.34);
753 ref_weights.push_back(-0.89);
754 ref_weights.push_back(0.02);
755 ref_weights.push_back(-0.97);
757 ref_weights.push_back(-0.37);
758 ref_weights.push_back(-0.27);
759 ref_weights.push_back(0.29);
760 ref_weights.push_back(0.91);
761 ref_weights.push_back(0.51);
771 using namespace core::pack::task::operation;
773 TaskFactoryOP task_factory(
new TaskFactory() );
774 task_factory->push_back(TaskOperationCOP(
new operation::InitializeFromCommandline() ));
777 if (
option[ OptionKeys::packing::resfile ].
user() ) {
778 task_factory->push_back( TaskOperationCOP(
new operation::ReadResfile ) );
779 TR <<
"Reading resfile from user input... make sure ALLAA is set as the default in your resfile!!" << std::endl;
782 task_factory->push_back( TaskOperationCOP(
new operation::ReadResfile( out_path_ +
'/' +
"resfile_output_Rsc" ) ) );
784 using namespace core::scoring;
785 ScoreFunctionOP
scorefxn = get_score_function();
786 scoring::methods::EnergyMethodOptions energymethodoptions(
scorefxn->energy_method_options() );
787 energymethodoptions.hbond_options().decompose_bb_hb_into_pair_energies(
true);
788 scorefxn->set_energy_method_options( energymethodoptions );
790 ScoreFunctionOP customref_scorefxn = get_score_function();
791 scoring::methods::EnergyMethodOptions energymethodoptions_customref( customref_scorefxn->energy_method_options() );
792 energymethodoptions_customref.hbond_options().decompose_bb_hb_into_pair_energies(
true);
793 customref_scorefxn->set_energy_method_options( energymethodoptions_customref );
795 customref_scorefxn->set_method_weights( ref, custom_ref_weights );
796 TR <<
"Using SCORE12 with custom reference weights\n" << *customref_scorefxn << std::flush;
799 protocols::simple_moves::PackRotamersMoverOP packrot_mover(
new protocols::simple_moves::PackRotamersMover );
800 packrot_mover->score_function( customref_scorefxn );
801 packrot_mover->task_factory( task_factory );
811 int charge_diff =
std::abs( get_net_charge(pose) - net_charge_target );
814 Real refweight_max_absvalue(3.2);
815 bool refweight_under_max(
true );
816 Real refweight_increment(0.10);
818 while ( charge_diff > 1 && counter < 40 && refweight_under_max ) {
820 int net_charge = get_net_charge( pose );
823 if (
std::abs(net_charge - net_charge_target) > 10 ) { refweight_increment = 0.5; }
824 else if (
std::abs(net_charge - net_charge_target) > 2 ) { refweight_increment = 0.1; }
825 else if (
std::abs(net_charge - net_charge_target) < 2 ) { refweight_increment = 0.02;}
830 custom_ref_weights[15] = custom_ref_weights[15] - refweight_increment;
833 custom_ref_weights[9] = custom_ref_weights[9] - refweight_increment;
836 if ( net_charge > net_charge_target &&
option[local::include_arg] ) {
837 custom_ref_weights[15] = custom_ref_weights[15] + refweight_increment;
839 if ( net_charge > net_charge_target &&
option[local::include_lys] ) {
840 custom_ref_weights[9] = custom_ref_weights[9] + refweight_increment;
845 custom_ref_weights[3] = custom_ref_weights[3] - refweight_increment;
849 custom_ref_weights[4] = custom_ref_weights[4] - refweight_increment;
852 if ( net_charge < net_charge_target &&
option[local::include_asp] ) {
853 custom_ref_weights[3] = custom_ref_weights[3] + refweight_increment;
855 if ( net_charge < net_charge_target &&
option[local::include_glu] ) {
856 custom_ref_weights[4] = custom_ref_weights[4] + refweight_increment;
859 customref_scorefxn->set_method_weights( ref, custom_ref_weights );
860 packrot_mover->score_function( customref_scorefxn );
866 TR <<
"Supercharging the protein surface... current charge: " << net_charge <<
" target charge: " << net_charge_target << std::endl;
867 TR <<
"Refweights D E K R " << custom_ref_weights[3] <<
" " << custom_ref_weights[4] <<
" " << custom_ref_weights[9] <<
" " << custom_ref_weights[15] << std::endl;
868 packrot_mover->apply( pose );
870 charge_diff =
std::abs( get_net_charge(pose) - net_charge_target );
874 if ( fabs(custom_ref_weights[15]) > refweight_max_absvalue || fabs(custom_ref_weights[9]) > refweight_max_absvalue || fabs(custom_ref_weights[3]) > refweight_max_absvalue || fabs(custom_ref_weights[4]) > refweight_max_absvalue ) {
875 refweight_under_max =
false;
886 std::string input_namebase( input_pdbname.base() );
887 std::string include_RKDE =
"_";
888 std::string weights_RKDE =
"_";
891 include_RKDE = include_RKDE +
"R";
893 std::stringstream out;
894 out << std::setprecision(2) << std::fixed << custom_ref_weights[15];
897 if ( custom_ref_weights[15] > 0.0 ) { s =
"+" +
s; }
898 weights_RKDE = weights_RKDE + s +
"_";
901 include_RKDE = include_RKDE +
"K";
903 std::stringstream out;
904 out << std::setprecision(2) << std::fixed << custom_ref_weights[9];
907 if ( custom_ref_weights[9] > 0.0 ) { s =
"+" +
s; }
908 weights_RKDE = weights_RKDE + s +
"_";
911 include_RKDE = include_RKDE +
"D";
913 std::stringstream out;
914 out << std::setprecision(2) << std::fixed << custom_ref_weights[3];
917 if ( custom_ref_weights[3] > 0.0 ) { s =
"+" +
s; }
918 weights_RKDE = weights_RKDE + s +
"_";
921 include_RKDE = include_RKDE +
"E";
923 std::stringstream out;
924 out << std::setprecision(2) << std::fixed << custom_ref_weights[4];
927 if ( custom_ref_weights[4] > 0.0 ) { s =
"+" +
s; }
928 weights_RKDE = weights_RKDE + s +
"_";
932 std::stringstream ss_i;
933 std::string i_string;
935 if ( !
option[local::target_net_charge_active] ) {
940 if ( i < 10 ) { i_string =
"000" + ss_i.str(); }
941 else if ( i < 100 ) { i_string =
"00" + ss_i.str(); }
942 else if ( i < 1000 ) { i_string =
"0" + ss_i.str(); }
943 else { i_string = ss_i.str(); }
950 TR <<
"Supercharging the protein surface... nstruct = " << i << std::endl;
951 packrot_mover->apply( pose );
952 packrot_mover->apply( pose );
953 packrot_mover->apply( pose );
955 outputname_ = input_namebase + include_RKDE + weights_RKDE + i_string +
".pdb";
956 TR <<
"NEW NAME FOR SUPERCHARGED OUTPUT: " << outputname_ << std::endl;
960 pose.dump_scored_pdb( out_path_ +
'/' + outputname_, *
scorefxn );
962 print_netcharge_and_mutations(starting_pose, pose );
969 ss_i << get_net_charge( pose );
970 i_string = ss_i.str();
972 outputname_ = input_namebase + include_RKDE + weights_RKDE + i_string +
".pdb";
973 TR <<
"NEW NAME FOR SUPERCHARGED OUTPUT: " << outputname_ << std::endl;
977 pose.dump_scored_pdb( out_path_ +
'/' + outputname_, *
scorefxn );
979 print_netcharge_and_mutations(starting_pose, pose );
994 for (
Size i=1; i<=pose.total_residue(); i++ ) {
995 if ( pose.residue(i).name3() ==
"ARG" ) { num_arg++; }
996 else if ( pose.residue(i).name3() ==
"LYS" ) { num_lys++; }
997 else if ( pose.residue(i).name3() ==
"ASP" ) { num_asp++; }
998 else if ( pose.residue(i).name3() ==
"GLU" ) { num_glu++; }
1000 int net_charge = num_arg + num_lys - num_asp - num_glu;
1001 TR << outputname_ <<
" Net Charge of input structure = " << get_net_charge( starting_pose ) << std::endl;
1002 TR << outputname_ <<
" R=" << num_arg <<
", K=" << num_lys <<
", D=" << num_asp <<
", E=" << num_glu << std::endl;
1003 TR << outputname_ <<
" Net Charge = " << net_charge << std::endl;
1005 Size num_mutations = 0;
1006 std::string pymol_sel_mutations =
"select ";
1007 TR << outputname_ <<
" Mutations: ";
1008 for (
Size i=1; i<=pose.total_residue(); i++ ) {
1010 if ( pose.residue(i).name1() != starting_pose.residue(i).name1() ) {
1012 Size whitespace = pose.pdb_info()->pose2pdb(i).find(
" ");
1013 std::string resnum_only = pose.pdb_info()->pose2pdb(i).substr(0, whitespace);
1014 TR << starting_pose.residue(i).name1() << resnum_only << pose.residue(i).name1() <<
", ";
1015 pymol_sel_mutations = pymol_sel_mutations + resnum_only +
"+";
1019 TR << outputname_ <<
" # of mutations: " << num_mutations << std::endl;
1020 TR << outputname_ <<
" " << pymol_sel_mutations << std::endl;
1028 for (
Size i(1); i<=pose.total_residue(); ++i ) {
1029 std::string name3 = pose.residue(i).name3();
1030 if ( name3 ==
"ARG" || name3 ==
"LYS" ) {
1032 }
else if ( name3 ==
"ASP" || name3 ==
"GLU" ) {
1043 TR <<
"Comparing energies of native and designed" << std::endl;
1044 assert(native.total_residue() == pose.total_residue());
1047 using namespace core::pack::task::operation;
1049 TaskFactoryOP task_factory(
new TaskFactory() );
1050 task_factory->push_back(TaskOperationCOP(
new operation::InitializeFromCommandline() ));
1051 core::pack::task::operation::RestrictToRepackingOP restrict_to_repack(
new core::pack::task::operation::RestrictToRepacking() );
1052 task_factory->push_back( restrict_to_repack );
1054 protocols::simple_moves::PackRotamersMoverOP packrot_mover(
new protocols::simple_moves::PackRotamersMover );
1055 packrot_mover->score_function( scorefxn_ );
1056 packrot_mover->task_factory( task_factory );
1067 TR <<
"Packing designed" << std::endl;
1068 packrot_mover->apply( pose );
1069 packrot_mover->apply( pose );
1070 packrot_mover->apply( pose );
1071 TR <<
"Packing native" << std::endl;
1072 packrot_mover->apply( native );
1073 packrot_mover->apply( native );
1074 packrot_mover->apply( native );
1081 TR <<
"Scoring native and design" << std::endl;
1082 scorefxn_->score(native);
1083 scorefxn_->score(pose);
1151 TR <<
"Initialized vectors" << std::endl;
1152 TR <<
"Adding native energies" << std::endl;
1153 for (
Size i(1); i <= native.total_residue(); ++i ) {
1155 total_native.push_back( native.energies().residue_total_energy(i) );
1156 fa_atr_native.push_back( native.energies().residue_total_energies(i)[scoring::fa_atr] );
1157 fa_rep_native.push_back( native.energies().residue_total_energies(i)[scoring::fa_rep] );
1158 fa_sol_native.push_back( native.energies().residue_total_energies(i)[scoring::fa_sol] );
1159 fa_intra_rep_native.push_back( native.energies().residue_total_energies(i)[scoring::fa_intra_rep] );
1160 fa_elec_native.push_back( native.energies().residue_total_energies(i)[scoring::fa_elec] );
1161 pro_close_native.push_back( native.energies().residue_total_energies(i)[scoring::pro_close] );
1162 hbond_sr_bb_native.push_back( native.energies().residue_total_energies(i)[scoring::hbond_sr_bb] );
1163 hbond_lr_bb_native.push_back( native.energies().residue_total_energies(i)[scoring::hbond_lr_bb] );
1164 hbond_bb_sc_native.push_back( native.energies().residue_total_energies(i)[scoring::hbond_bb_sc] );
1165 hbond_sc_native.push_back( native.energies().residue_total_energies(i)[scoring::hbond_sc] );
1166 dslf_fa13_native.push_back( native.energies().residue_total_energies(i)[scoring::dslf_fa13] );
1167 rama_native.push_back( native.energies().residue_total_energies(i)[scoring::rama] );
1168 omega_native.push_back( native.energies().residue_total_energies(i)[scoring::omega] );
1169 fa_dun_native.push_back( native.energies().residue_total_energies(i)[scoring::fa_dun] );
1170 p_aa_pp_native.push_back( native.energies().residue_total_energies(i)[scoring::p_aa_pp] );
1171 ref_native.push_back( native.energies().residue_total_energies(i)[scoring::ref] );
1174 TR <<
"Adding designed energies" << std::endl;
1175 for (
Size i(1); i <= pose.total_residue(); ++i ) {
1177 total.push_back( pose.energies().residue_total_energy(i) );
1178 fa_atr.push_back( pose.energies().residue_total_energies(i)[scoring::fa_atr] );
1179 fa_rep.push_back( pose.energies().residue_total_energies(i)[scoring::fa_rep] );
1180 fa_sol.push_back( pose.energies().residue_total_energies(i)[scoring::fa_sol] );
1181 fa_intra_rep.push_back( pose.energies().residue_total_energies(i)[scoring::fa_intra_rep] );
1182 fa_elec.push_back( pose.energies().residue_total_energies(i)[scoring::fa_elec] );
1183 pro_close.push_back( pose.energies().residue_total_energies(i)[scoring::pro_close] );
1184 hbond_sr_bb.push_back( pose.energies().residue_total_energies(i)[scoring::hbond_sr_bb] );
1185 hbond_lr_bb.push_back( pose.energies().residue_total_energies(i)[scoring::hbond_lr_bb] );
1186 hbond_bb_sc.push_back( pose.energies().residue_total_energies(i)[scoring::hbond_bb_sc] );
1187 hbond_sc.push_back( pose.energies().residue_total_energies(i)[scoring::hbond_sc] );
1188 dslf_fa13.push_back( pose.energies().residue_total_energies(i)[scoring::dslf_fa13] );
1189 rama.push_back( pose.energies().residue_total_energies(i)[scoring::rama] );
1190 omega.push_back( pose.energies().residue_total_energies(i)[scoring::omega] );
1191 fa_dun.push_back( pose.energies().residue_total_energies(i)[scoring::fa_dun] );
1192 p_aa_pp.push_back( pose.energies().residue_total_energies(i)[scoring::p_aa_pp] );
1193 ref.push_back( pose.energies().residue_total_energies(i)[scoring::ref] );
1195 resnums.push_back( i );
1204 Real sum_fa_intra_rep(0);
1205 Real sum_fa_elec(0);
1206 Real sum_pro_close(0);
1207 Real sum_hbond_sr_bb(0);
1208 Real sum_hbond_lr_bb(0);
1209 Real sum_hbond_bb_sc(0);
1210 Real sum_hbond_sc(0);
1211 Real sum_dslf_fa13(0);
1215 Real sum_p_aa_pp(0);
1219 TR <<
"Subtracting design from native energies" << std::endl;
1221 for (
Size jj(1); jj <= resnums.size(); ++jj ) {
1225 std::string native_name3 = native.residue(ii).name3();
1226 std::string pose_name3 = pose.residue(ii).name3();
1228 bool is_mutation( native_name3 != pose_name3);
1233 if ( is_mutation || !is_mutation_option ) {
1235 Real diff_total = total[
ii] - total_native[
ii];
1236 Real diff_fa_atr = fa_atr[
ii] - fa_atr_native[
ii];
1237 Real diff_fa_rep = fa_rep[
ii] - fa_rep_native[
ii];
1238 Real diff_fa_sol = fa_sol[
ii] - fa_sol_native[
ii];
1239 Real diff_fa_intra_rep = fa_intra_rep[
ii] - fa_intra_rep_native[
ii];
1240 Real diff_fa_elec = fa_elec[
ii] - fa_elec_native[
ii];
1241 Real diff_pro_close = pro_close[
ii] - pro_close_native[
ii];
1242 Real diff_hbond_sr_bb = hbond_sr_bb[
ii] - hbond_sr_bb_native[
ii];
1243 Real diff_hbond_lr_bb = hbond_lr_bb[
ii] - hbond_lr_bb_native[
ii];
1244 Real diff_hbond_bb_sc = hbond_bb_sc[
ii] - hbond_bb_sc_native[
ii];
1245 Real diff_hbond_sc = hbond_sc[
ii] - hbond_sc_native[
ii];
1246 Real diff_dslf_fa13 = dslf_fa13[
ii] - dslf_fa13_native[
ii];
1247 Real diff_rama = rama[
ii] - rama_native[
ii];
1248 Real diff_omega = omega[
ii] - omega_native[
ii];
1249 Real diff_fa_dun = fa_dun[
ii] - fa_dun_native[
ii];
1250 Real diff_p_aa_pp = p_aa_pp[
ii] - p_aa_pp_native[
ii];
1251 Real diff_ref = ref[
ii] - ref_native[
ii];
1253 sum_total += diff_total ;
1254 sum_fa_atr += diff_fa_atr ;
1255 sum_fa_rep += diff_fa_rep ;
1256 sum_fa_sol += diff_fa_sol ;
1257 sum_fa_intra_rep += diff_fa_intra_rep ;
1258 sum_fa_elec += diff_fa_elec ;
1259 sum_pro_close += diff_pro_close ;
1260 sum_hbond_sr_bb += diff_hbond_sr_bb ;
1261 sum_hbond_lr_bb += diff_hbond_lr_bb ;
1262 sum_hbond_bb_sc += diff_hbond_bb_sc ;
1263 sum_hbond_sc += diff_hbond_sc ;
1264 sum_dslf_fa13 += diff_dslf_fa13 ;
1265 sum_rama += diff_rama ;
1266 sum_omega += diff_omega ;
1267 sum_fa_dun += diff_fa_dun ;
1268 sum_p_aa_pp += diff_p_aa_pp ;
1269 sum_ref += diff_ref ;
1272 TR << pose.pdb_info()->name() <<
" " << ii <<
" ";
1273 TR << std::setprecision(4) << std::fixed << diff_total <<
" ";
1274 TR << std::setprecision(4) << std::fixed << diff_fa_atr <<
" ";
1275 TR << std::setprecision(4) << std::fixed << diff_fa_rep <<
" ";
1276 TR << std::setprecision(4) << std::fixed << diff_fa_sol <<
" ";
1277 TR << std::setprecision(4) << std::fixed << diff_fa_intra_rep <<
" ";
1278 TR << std::setprecision(4) << std::fixed << diff_fa_elec <<
" ";
1279 TR << std::setprecision(4) << std::fixed << diff_pro_close <<
" ";
1280 TR << std::setprecision(4) << std::fixed << diff_hbond_sr_bb <<
" ";
1281 TR << std::setprecision(4) << std::fixed << diff_hbond_lr_bb <<
" ";
1282 TR << std::setprecision(4) << std::fixed << diff_hbond_bb_sc <<
" ";
1283 TR << std::setprecision(4) << std::fixed << diff_hbond_sc <<
" ";
1284 TR << std::setprecision(4) << std::fixed << diff_dslf_fa13 <<
" ";
1285 TR << std::setprecision(4) << std::fixed << diff_rama <<
" ";
1286 TR << std::setprecision(4) << std::fixed << diff_omega <<
" ";
1287 TR << std::setprecision(4) << std::fixed << diff_fa_dun <<
" ";
1288 TR << std::setprecision(4) << std::fixed << diff_p_aa_pp <<
" ";
1289 TR << std::setprecision(4) << std::fixed << diff_ref <<
" ";
1296 TR << pose.pdb_info()->name() <<
" SUM-DIFFS ";
1297 TR << sum_total << std::setprecision(4) << std::fixed <<
" ";
1298 TR << sum_fa_atr << std::setprecision(4) << std::fixed <<
" ";
1299 TR << sum_fa_rep << std::setprecision(4) << std::fixed <<
" ";
1300 TR << sum_fa_sol << std::setprecision(4) << std::fixed <<
" ";
1301 TR << sum_fa_intra_rep<< std::setprecision(4) << std::fixed <<
" ";
1302 TR << sum_fa_elec << std::setprecision(4) << std::fixed <<
" ";
1303 TR << sum_pro_close << std::setprecision(4) << std::fixed <<
" ";
1304 TR << sum_hbond_sr_bb << std::setprecision(4) << std::fixed <<
" ";
1305 TR << sum_hbond_lr_bb << std::setprecision(4) << std::fixed <<
" ";
1306 TR << sum_hbond_bb_sc << std::setprecision(4) << std::fixed <<
" ";
1307 TR << sum_hbond_sc << std::setprecision(4) << std::fixed <<
" ";
1308 TR << sum_dslf_fa13 << std::setprecision(4) << std::fixed <<
" ";
1309 TR << sum_rama << std::setprecision(4) << std::fixed <<
" ";
1310 TR << sum_omega << std::setprecision(4) << std::fixed <<
" ";
1311 TR << sum_fa_dun << std::setprecision(4) << std::fixed <<
" ";
1312 TR << sum_p_aa_pp << std::setprecision(4) << std::fixed <<
" ";
1313 TR << sum_ref << std::setprecision(4) << std::fixed <<
" ";
1316 TR << pose.pdb_info()->name() <<
" score_terms: total fa_atr fa_rep fa_sol fa_intra_rep fa_elec pro_close hbond_sr_bb hbond_lr_bb hbond_bb_sc hbond_sc dslf_fa13 rama omega fa_dun p_aa_pp ref" << std::endl;
1374 protocols::jd2::JobDistributor::get_instance()->go(protocols::moves::MoverOP(
new supercharge ));
1376 TR <<
"************************d**o**n**e**************************************" << std::endl;
1379 std::cout <<
"caught exception " << e.
msg() << std::endl;
virtual void apply(Pose &pose)
basic::options::BooleanOptionKey const include_asp("include_asp")
virtual std::string const msg() const
Size largest_mutated_AvNAPSA_
Automatic hidden index key for integer options.
basic::options::RealOptionKey const refweight_arg("refweight_arg")
basic::options::BooleanOptionKey const AvNAPSA_negative("AvNAPSA_negative")
core::scoring::ScoreFunctionOP scorefxn_
void energy_comparison(Pose &native, Pose &pose)
utility::keys::KeyLookup< KeyType >::const_iterator const_iterator
Key collection iterators.
vector0: std::vector with assert-checked bounds
virtual void prepack_input_structure(Pose &pose)
utility::vector1< Real > AvNAPSA_values_
void init(int argc, char *argv[])
Command line init() version.
BooleanOptionKey const user("options:user")
basic::options::RealOptionKey const refweight_glu("refweight_glu")
utility::keys::lookup::end< KeyType > const end
Automatic hidden index key for real options.
int main(int argc, char *argv[])
int get_net_charge(Pose const &pose)
File name class supporting Windows and UN*X/Linux format names.
Tracer & T(std::string const &channel, TracerPriority priority)
T is special function for assign tracer property on the static object.
void set_surface(Pose const &pose)
common derived classes for thrown exceptions
basic::options::BooleanOptionKey const AvNAPSA_positive("AvNAPSA_positive")
basic::options::BooleanOptionKey const target_net_charge_active("target_net_charge_active")
virtual void design_supercharge_AvNAPSA(Pose const &starting_pose, Pose &pose)
basic::options::BooleanOptionKey const include_glu("include_glu")
basic::options::BooleanOptionKey const compare_residue_energies_all("compare_residue_energies_all")
basic::options::BooleanOptionKey const compare_residue_energies_mut("compare_residue_energies_mut")
basic::options::IntegerOptionKey const surface_residue_cutoff("surface_residue_cutoff")
void set_resfile(Pose const &pose)
Program exit functions and macros.
Tracer & Error(TracerPriority priority=t_error)
Predefined Error tracer.
void design_supercharge(Pose const &starting_pose, Pose &pose)
basic::options::BooleanOptionKey const include_arg("include_arg")
basic::options::BooleanOptionKey const dont_mutate_correct_charge("dont_mutate_correct_charge")
virtual void AvNAPSA_values(Pose const &pose)
basic::options::IntegerOptionKey const surface_atom_cutoff("surface_atom_cutoff")
T abs(T const &x)
std::abs( x ) == | x |
Automatic hidden index key for boolean options.
utility::pointer::shared_ptr< supercharge > superchargeOP
File name class supporting Windows and UN*X/Linux format names.
basic::options::IntegerOptionKey const nstruct("nstruct")
rule< Scanner, options_closure::context_t > options
Tracer & Warning(TracerPriority priority=t_warning)
Predefined Warning tracer.
utility::options::OptionCollection option
OptionCollection global.
Output file stream wrapper for uncompressed and compressed files.
basic::options::RealOptionKey const refweight_lys("refweight_lys")
basic::options::BooleanOptionKey const include_lys("include_lys")
basic::options::IntegerOptionKey const target_net_charge("target_net_charge")
ocstream cout(std::cout)
Wrapper around std::cout.
basic::options::RealOptionKey const refweight_asp("refweight_asp")
utility::vector1< Real > set_reference_energies()
vector1: std::vector with 1-based indexing
Adds charged residues to a protein surface.
virtual void set_resfile_AvNAPSA(Pose const &pose)
Class for handling user debug/warnings/errors. Use instance of this class instead of 'std::cout' for ...
static THREAD_LOCAL basic::Tracer TR("apps.public.design.supercharge")
basic::options::BooleanOptionKey const pre_packminpack("pre_packminpack")
ozstream: Output file stream wrapper for uncompressed and compressed files
void print_netcharge_and_mutations(Pose const &starting_pose, Pose const &pose)
Program options global and initialization function.
void open(std::string const &filename_a, std::ios_base::openmode open_mode=std::ios_base::out)
Open a file.
virtual std::string get_name() const
rule< Scanner, option_closure::context_t > option
basic::options::BooleanOptionKey const dont_mutate_glyprocys("dont_mutate_glyprocys")
basic::options::BooleanOptionKey const dont_mutate_hbonded_sidechains("dont_mutate_hbonded_sidechains")