Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SetupHotspotConstraintsMover.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 
11 /// @file protocols/protein_interface_design/movers/SetupHotspotConstraintsMover.cc
12 /// @brief
13 /// @author Jacob Corn (jecorn@u.washington.edu), Sarel Fleishman (sarelf@uw.edu)
16 #include <core/pose/Pose.hh>
17 #include <protocols/moves/Mover.hh>
20 #include <core/types.hh>
23 #include <basic/Tracer.hh>
24 #include <utility/tag/Tag.hh>
26 #include <boost/foreach.hpp>
27 #define foreach BOOST_FOREACH
28 
29 #include <utility/vector0.hh>
30 #include <utility/vector1.hh>
31 #include <complex>
32 
33 
34 namespace protocols {
35 namespace protein_interface_design {
36 namespace movers {
37 
38 using namespace protocols::moves;
39 
40 static basic::Tracer TR( "protocols.protein_interface_design.movers.SetupHotspotConstraintsMover" );
41 
44 {
46 }
47 
51 }
52 
55 {
56  return "SetupHotspotConstraints";
57 }
58 
60  protocols::moves::Mover( "SetupHotspotConstraintsMover" ),
61  chain_to_design_( 2 ),
62  CB_force_constant_( 1.0 ),
63  worst_allowed_stub_bonus_( 0.0 ),
64  apply_self_energies_( true ),
65  bump_cutoff_( 4.0 ),
66  apply_ambiguous_constraints_( true ),
67  colonyE_( false )
68  {}
69 
73 }
74 
78 }
79 
82  core::Size const chain_to_design,
83  core::Real const & CB_force_constant,
84  core::Real const & worst_allowed_stub_bonus,
85  bool const apply_self_energies,
86  core::Real const & bump_cutoff,
87  bool const apply_ambiguous_constraints,
88  bool const colonyE
89 ) :
90  protocols::moves::Mover( "SetupHotspotConstraintMover" ),
91  chain_to_design_(chain_to_design),
92  CB_force_constant_(CB_force_constant),
93  worst_allowed_stub_bonus_(worst_allowed_stub_bonus),
94  apply_self_energies_(apply_self_energies),
95  bump_cutoff_(bump_cutoff),
96  apply_ambiguous_constraints_(apply_ambiguous_constraints),
97  colonyE_( colonyE)
98 {
99 // packer_task_ = packer_task->clone();
101 }
102 
104  //utility::pointer::ReferenceCount(),
105  protocols::moves::Mover( init ),
106  chain_to_design_( init.chain_to_design_),
107  CB_force_constant_(init.CB_force_constant_),
108  worst_allowed_stub_bonus_(init.worst_allowed_stub_bonus_),
109  apply_self_energies_(init.apply_self_energies_),
110  bump_cutoff_(init.bump_cutoff_),
111  apply_ambiguous_constraints_(init.apply_ambiguous_constraints_),
112  colonyE_( init.colonyE_ )
113 {
115 }
116 
117 void
119  if ( colonyE_ ) {
121  hotspot_stub_set_ = colonyE_set;
122  }
123  if ( std::abs(CB_force_constant_) > 1E-9 ) {
124  hotspot_stub_set_->add_hotspot_constraints_to_pose( pose, chain_to_design_, hotspot_stub_set_,
126  } else {
128  pose.constraint_set( empty_constraint_set );
129  }
130 }
131 
134 return "SetupHotspotConstraintsMover";
135 }
136 
137 /// This needs to be parsed before all other movers b/c it changes scorefxns
138 void
140 {
141  using core::Real;
142  chain_to_design_ = tag->getOption<Size>( "redesign_chain", 2 );
143 
144  CB_force_constant_ = tag->getOption<Real>( "cb_force", 0.5 );
145  worst_allowed_stub_bonus_ = tag->getOption<Real>( "worst_allowed_stub_bonus", 0 );
146  apply_self_energies_ = tag->getOption<bool>( "apply_stub_self_energies", 0 );
147  bump_cutoff_ = tag->getOption<Real>( "apply_stub_bump_cutoff", 10. );
148  apply_ambiguous_constraints_ = tag->getOption<bool>( "pick_best_energy_constraint", 1 );
149  core::Real const bb_stub_cst_weight( tag->getOption< core::Real >( "backbone_stub_constraint_weight", 1.0 ) );
150 
151  colonyE_ = tag->getOption<bool>( "colonyE", 0 );
152 
154  if( tag->hasOption( "stubfile" ) ){
155  std::string const hotspot_fname( tag->getOption<std::string>( "stubfile", "stubs.pdb" ) );
156  hotspot_stub_set_->read_data( hotspot_fname );
157  }
158  utility::vector1< TagPtr > const branch_tags( tag->getTags() );
159  foreach( TagPtr const curr_tag, branch_tags ){
160  if( curr_tag->getName() == "HotspotFiles" ){
161  utility::vector1< TagPtr > const branch_tags2( curr_tag->getTags() );
162  foreach( TagPtr const curr_tag2, branch_tags2 ){
163  std::string const file_name( curr_tag2->getOption< std::string >( "file_name" ) );
164  std::string const nickname( curr_tag2->getOption< std::string >( "nickname" ) );
165  core::Size const stub_num( curr_tag2->getOption< core::Size >( "stub_num", 100000 ) );
167  temp_stubset->read_data( file_name );
168  temp_stubset->remove_random_stubs_from_set( temp_stubset->size() - stub_num );
169  hotspot_stub_set_->add_stub_set( *temp_stubset );
170  TR<<"Read stubset from file "<<file_name<<" and associating it with name "<<nickname<<'\n';
171  TR<<stub_num<<" stubs kept in memory\n";
172  data.add( "hotspot_library", nickname, temp_stubset );
173  }
174  }
175  else
176  utility_exit_with_message( curr_tag->getName() + " not recognized by SetupHotspotConstraints, did you mean HotspotFiles?" );
177  }
178 
179  TR<<"applying hotspot hashing constraints to pose with " << " cb_force weight of "<<CB_force_constant_<<", apply ambiguous constraints set to "<<apply_ambiguous_constraints_<< " and colonyE set to " << colonyE_ << "\n";
180  data.add( "constraints" , "hotspot_stubset", hotspot_stub_set_ );
181 
182  for( std::map< std::string, utility::pointer::ReferenceCountOP >::const_iterator it = (data)[ "scorefxns" ].begin(); it!=(data)[ "scorefxns" ].end(); ++it ){
183  using namespace core::scoring;
184  ScoreFunctionOP scorefxn( *data.get< ScoreFunction * >( "scorefxns", it->first) );
185  core::Real const weight( scorefxn->get_weight( backbone_stub_constraint ) );
186  if( weight == 0.0 ){
187  scorefxn->set_weight( backbone_stub_constraint, bb_stub_cst_weight );
188  TR<<"Setting bacbkone_stub_constraint weight in scorefxn "<<it->first<<" to "<<bb_stub_cst_weight<<'\n';
189  }
190  else
191  TR<<"Skipping resetting of backbone_stub_constraint weight in "<<it->first<<" which is already preset to "<<weight<<'\n';
192  }
193  TR.flush();
194 }
195 
197 
198 } //movers
199 } //protein_interface_design
200 } //protocols