20 #include <utility/tag/Tag.hh>
28 #include <basic/Tracer.hh>
38 #include <utility/vector1.hh>
39 #include <boost/foreach.hpp>
40 #define foreach BOOST_FOREACH
55 #include <ObjexxFCL/format.hh>
59 #include <utility/string_util.hh>
61 #include <utility/vector0.hh>
69 namespace simple_filters {
71 static basic::Tracer
TR(
"protocols.simple_filters.RotamerBoltzmannWeight" );
75 parent(
"RotamerBoltzmannWeight" ),
76 task_factory_( NULL ),
82 ddG_threshold_( 1.5 ),
83 repacking_radius_( 6.0 ),
84 energy_reduction_factor_( 0.5 ),
85 compute_entropy_reduction_( false ),
88 skip_ala_scan_( false ),
90 no_modified_ddG_(false)
156 runtime_assert( jump );
203 TR<<
"----------First pass alanine scanning to identify hot spot residues------------"<<std::endl;
205 hotspot_residues.clear();
213 ala_scan.
jump( jump );
216 TR<<
"All energy calculations will be computed subject to repacking in bound and unbound states (ddG).";
218 TR<<
"All energy calculations will be computed subject to no repacking in the bound and unboud states (dG)";
223 orig_ddG = ddg_filter.
compute( pose );
224 TR<<
"\nOriginal complex ddG "<<orig_ddG<<std::endl;
230 TR<<
"Adding residue "<<resi<<
" to hotspot list\n";
231 hotspot_residues.push_back( resi );
235 core::Real const ddG( ala_scan_ddG - orig_ddG );
236 TR<<
"ddG for resi "<<pose.
residue( resi ).
name3()<<resi<<
" is "<<ddG<<std::endl;
239 hotspot_residues.push_back( resi );
243 TR<<
"----------Done with first pass alanine scanning to identify hot spot residues------------"<<std::endl;
244 return( hotspot_residues );
258 if( hotspot_res.size()==0 ) {
259 if(
type_ ==
"monomer" ) {
268 hotspot_res = srb.
compute( const_pose );
271 using namespace protocols::moves;
275 for (
Size i = 1; i <= sym_dof_name_list.size(); i++) {
278 translate->step_size( 1000.0 );
279 translate->apply( unbound_pose );
284 translate->step_size( 1000.0 );
285 translate->apply( unbound_pose );
292 if( hotspot_res.size() == 0 ){
293 TR<<
"No hot-spot residues detected in first pass alanine scan. Doing nothing"<<std::endl;
296 TR<<hotspot_res.size()<<
" hot-spot residues detected."<<std::endl;
301 foreach(
core::Size const hs_res, hotspot_res ){
303 TR<<const_pose.
residue( hs_res ).
name3()<<hs_res<<
" "<<boltz_weight<<
'\n';
318 using namespace core::pack::rotamer_set;
319 using namespace core::pack::task;
320 using namespace core::conformation;
322 TR<<
"-----Computing Boltzmann weight for residue "<<resi<<std::endl;
329 rotset->set_resid( resi );
333 PackerTaskOP ptask( tf->create_task_and_apply_taskoperations( pose ) );
340 ptask->set_bump_check(
true );
341 rotset->build_rotamers( pose, *
scorefxn_, *ptask, packer_graph,
false );
347 des_around->include_residue( resi );
348 tf->push_back( des_around );
349 PackerTaskOP task = tf->create_task_and_apply_taskoperations( pose );
361 mm->set_jump(
false );
363 mm->set_jump(
rb_jump(),
true );
365 if( task->being_designed( i ) ){
366 task->nonconst_residue_task( i ).restrict_to_repacking();
367 mm->set_chi( i,
true );
370 task->nonconst_residue_task( i ).prevent_repacking();
371 mm->set_chi( i,
false );
374 task->nonconst_residue_task( resi ).prevent_repacking();
382 min_mover->apply( pose );
385 TR<<
"Total score for input pose: "<<init_score<<std::endl;
387 for( Rotamers::const_iterator rotamer = rotset->begin(); rotamer != rotset->end(); ++rotamer ){
388 pose = const_min_pose;
392 min_mover->apply( pose );
394 TR<<
"This rotamer has score "<<
score<<std::endl;
395 scores.push_back(
score );
399 boltz_sum += exp(( init_score - score )/
temperature());
401 return( 1/boltz_sum );
433 using namespace core::graph;
434 using namespace core::scoring;
443 core::Size const int_resi = (*egraph_it)->get_other_ind( res );
445 if( int_resi_chain != res_chain ){
448 total_residue_energy += intE;
451 return( total_residue_energy );
459 out<<
"RotamerBoltzmannWeightFilter returns "<<
compute( pose )<<std::endl;
460 out<<
"RotamerBoltzmannWeightFilter final report\n";
461 out<<
"Residue"<<
'\t'<<
"ddG"<<
'\t'<<
"RotamerProbability"<<
'\n';
480 using namespace utility::tag;
482 TR <<
"RotamerBoltzmannWeightFilter"<<std::endl;
488 unbound( tag->getOption<
bool >(
"unbound", 1 ) );
495 repack( tag->getOption<
bool >(
"repack", 1 ) );
497 foreach(
TagPtr const tag, branch ){
498 using namespace core::chemical;
502 core::Real const threshold_probability_input( tag->getOption<
core::Real >(
"threshold_probability" ) );
509 fast_calc_ = tag->getOption<
bool >(
"fast_calc",0);
512 skip_ala_scan( tag->getOption<
bool >(
"skip_ala_scan", 0 ) );
513 write2pdb( tag->getOption<
bool >(
"write2pdb", 0 ) );
517 utility::lua::LuaObject
const & score_fxns,
518 utility::lua::LuaObject
const & tasks ) {
519 TR <<
"RotamerBoltzmannWeightFilter"<<std::endl;
523 rb_jump(def[
"jump"] ? def[
"jump"].to<core::Size>() : 1);
524 unbound(def[
"unbound"] ? def[
"unbound"].to<bool>() :
true);
525 ddG_threshold(def[
"ddG_threshold"] ? def[
"ddG_threshold"].to<core::Real>() : 1.5);
526 temperature(def[
"temperature"] ? def[
"temperature"].to<core::Real>() : 0.8);
527 if( def[
"scorefxn"] ) {
532 energy_reduction_factor(def[
"energy_reduction_factor"] ? def[
"energy_reduction_factor"].to<core::Real>() : 0.5);
534 repack(def[
"repack"] ? def[
"repack"].to<bool>() :
true);
536 if( def[
"per_aa_threshold"] ) {
537 for (utility::lua::LuaIterator i=def[
"per_aa_threshold"].begin(),
end; i !=
end; ++i) {
545 fast_calc_ = def[
"fast_calc"] ? def[
"fast_calc"].to<
bool>() :
false;
546 no_modified_ddG_ = def[
"no_modified_ddG"] ? def[
"no_modified_ddG"].to<
bool>() :
false;
548 skip_ala_scan( def[
"skip_ala_scan"] ? def[
"skip_ala_scan"].to<bool>() :
false );
549 write2pdb( def[
"write2pdb"] ? def[
"write2pdb"].to<bool>() :
false );
559 std::string output_string =
"RotamerBoltzmannWeight " + user_name +
": " + residue_name + ObjexxFCL::string_of(residue) +
" = " + ObjexxFCL::string_of(boltzmann_weight);
560 job->add_string(output_string);
657 out<<
"Residue"<<
'\t'<<
"ddG"<<
'\t'<<
"RotamerProbability"<<
'\t'<<
"EnergyReduction\n";
666 if( prob <= threshold_prob ){
671 out<<energy_reduction;
672 modified_ddG += energy_reduction;
678 out<<
"ddG before, after modification: "<<ddG_in<<
", "<<modified_ddG<<std::endl;
679 return( modified_ddG );