Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DisulfideMover.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 sw=2 noet:
3 //
4 // This file is part of the Rosetta software suite and is made available under license.
5 // The Rosetta software is developed by the contributing members of the Rosetta Commons consortium.
6 // (C) 199x-2009 Rosetta Commons participating institutions and developers.
7 // For more information, see http://www.rosettacommons.org/.
8 
9 /// @file protocols/protein_interface_design/movers/DisulfideMover.hh
10 /// @author Spencer Bliven <blivens@u.washington.edu>
11 /// @date 4/30/2009
12 
13 // Unit headers
16 
17 
18 // Project Headers
19 #include <core/types.hh>
20 #include <core/pose/Pose.hh>
21 
27 //parsing
28 #include <utility/tag/Tag.hh>
30 #include <protocols/moves/Mover.fwd.hh> //Movers_map
31 #include <protocols/filters/Filter.fwd.hh> //Filters_map
33 #include <core/pose/selection.hh>
34 
38 
39 #include <core/scoring/Energies.hh>
41 
43 
44 //get_resnum crap
45 
46 // Utility Headers
47 #include <utility/vector1.hh>
48 
49 // Unit Headers
50 
51 // C++ headers
52 //#include <map>
53 #include <algorithm>
54 
56 #include <utility/vector0.hh>
57 #include <basic/Tracer.hh>
58 
59 
60 namespace protocols {
61 namespace protein_interface_design {
62 namespace movers {
63 
64 using namespace core;
65 using namespace protocols::moves;
66 using namespace core::chemical;
67 using namespace std;
68 
69 using utility::vector1;
70 using utility::vector1_int;
71 using core::pose::Pose;
72 using core::pose::PoseOP;
74 
75 static basic::Tracer TR( "protocols.protein_interface_design.movers.DisulfideMover" );
76 
78 
81 {
83 }
84 
87  return new DisulfideMover;
88 }
89 
92 {
93  return "DisulfideMover";
94 }
95 
96 ///@brief default ctor
98  parent(),
99  rb_jump_(1)
100 {}
101 
102 ///@brief copy ctor
104  //utility::pointer::ReferenceCount(),
105  parent( dm ),
106  rb_jump_(dm.rb_jump_)
107 {}
108 
109 ///@brief Constructor with a single target residue
111  parent(),
112  rb_jump_(1)
113 {
114  target_residues_.push_back(targetResidue);
115 }
116 
117 ///@brief Constructor with multiple target residues
119  parent(),
120  rb_jump_(1)
121 {
122  target_residues_ = targetResidues;
123 }
124 
126 
127 /// @brief Modify the pose to define a disulfide bond between the two specified
128 /// residues.
129 /// @details Does not do the repacking & minimization required to place the
130 /// disulfide correctly.
131 void DisulfideMover::form_disulfide(Pose & pose, Size lower_res, Size upper_res)
132 {
133  ResidueTypeSetCAP restype_set =
135  Residue const cyd( restype_set->name_map("CYD"), true/*dummy*/ );
136 
137  //mutate the two residues
138  pose.replace_residue(lower_res, cyd, true /*orient backbone*/);
139  pose.replace_residue(upper_res, cyd, true /*orient backbone*/);
140 
141  //form the bond between the two residues
142  pose.conformation().declare_chemical_bond(lower_res,"SG",upper_res,"SG");
143 }
144 
145 void DisulfideMover::apply( Pose & pose ) {
146  vector1< pair<Size,Size> > potential_disulfides;
147  disulfide_list(pose, target_residues_, rb_jump_, potential_disulfides);
148  TR.Info << "Found " << potential_disulfides.size()
149  << " potential disulfide bonds." << endl;
150 
151  allowed_aas_[ chemical::aa_cys ] = false;
152  allowed_aas_[ chemical::aa_gly ] = false;
153  allowed_aas_[ chemical::aa_pro ] = false;
154 
155  PoseOP best_pose = 0;
156 
157  for( vector1< pair<Size,Size> >::const_iterator
158  disulf = potential_disulfides.begin(),
159  end_disulf = potential_disulfides.end();
160  disulf != end_disulf;
161  ++disulf )
162  {
163  TR.Debug << "Trying disulfide from " << disulf->first
164  << " to " << disulf->second << endl;
165 
166  PoseOP trial_pose(new Pose(pose));
167 
168  //Introduce a disulfide bond
169  form_disulfide(*trial_pose, disulf->first, disulf->second);
170 
171  trial_pose->update_residue_neighbors();
173  interface.calculate(*trial_pose);
174 
175  // Setup Packer
177  task_->initialize_from_command_line().or_include_current( true );
178  task_->restrict_to_repacking();
179 
180  // for each residue
181  for( Size i(1); i <= trial_pose->total_residue(); ++i )
182  {
183  Residue const& res(trial_pose->residue(i));
184  if( !res.is_protein() )
185  continue;
186  // Repack interface residues (except for disallowed aas)
187  if( interface.is_interface(i) &&
188  ( allowed_aas_[ res.aa() ] || //allowed or a target disulf
189  i == disulf->first ||
190  i == disulf->second
191  ) )
192  continue;
193 
194  // Other residues are unchanged
195  task_->nonconst_residue_task(i).prevent_repacking();
196  }
197 
198  // Setup minimizer: allow interface to move
200  mm->set_bb( false );
201  mm->set_jump( rb_jump_, false );
202  for( core::Size i=1; i<=trial_pose->total_residue(); ++i ) {
203  Residue const& res(trial_pose->residue(i));
204 
205  if ( !trial_pose->residue(i).is_protein() ) continue;
206  if( interface.is_interface(i) &&
207  ( allowed_aas_[ res.aa() ] || //allowed or a target disulf
208  i == disulf->first ||
209  i == disulf->second ))
210  {
211  mm->set_chi( i, true );
212 ;
213  //mm->set_bb( i, true );
214  }
215  }
216 
217  // Form disulfide bond
218  core::util:: rebuild_disulfide(*trial_pose,disulf->first, disulf->second,
220 
221  std::string name = trial_pose->residue(disulf->first).name();
222  assert(name == "CYD");
223 
224  // Is this pose better than the previous best pose?
225  if( !best_pose ||
226  best_pose->energies().total_energy() > trial_pose->energies().total_energy() )
227  // && great disulfide bond?
228  {
229  best_pose = trial_pose;
230  }
231  }
232 
233  if( best_pose )
234  pose = *best_pose;
235 
236 }
237 
241 }
242 
243 /// @brief Find all residues which could disulfide bond to a target
244 /// @return pairs of residues (target, host) from the target protein and the
245 /// docking protein.
246 void DisulfideMover::disulfide_list( Pose const& const_pose,
247  vector1< Size > const& targets, Size rb_jump,
248  vector1< pair<Size,Size> > & disulfides )
249 {
250  disulfides.clear();
251 
252  //We make a nonconst copy just so that the interface can be updated first
253  //I don't have a test case where this is necessary, but other code does it too
254  Pose pose(const_pose);
256 
257  protocols::scoring::Interface interface(rb_jump);
258  interface.calculate(pose);
259 
260  vector1<vector1_int> pairs = interface.pair_list();
261 
262  // divide the targets by interface
263  vector1<Size> lower_targets;
264  vector1<Size> upper_targets;
265  for(vector1<Size>::const_iterator target = targets.begin(),
266  end_target = targets.end();
267  target != end_target; ++target)
268  {
269  if( find(pairs[1].begin(), pairs[1].end(), static_cast<int>(*target)) != pairs[1].end() ) {
270  //lower partner
271  lower_targets.push_back(*target);
272  }
273  else if( find(pairs[2].begin(), pairs[2].end(), static_cast<int>(*target)) != pairs[2].end() ) {
274  //upper partner
275  upper_targets.push_back(*target);
276  }
277  else { //Target not in the interface
278  TR.Debug << "Target "<< *target
279  << " does not lie on the protein interface." << std::endl;
280  continue; //ignore this target
281  }
282  }
283 
284  // If no targets were specified on one partner, just use everything in the interface
285  if( lower_targets.empty() )
286  lower_targets = pairs[1];
287  if( upper_targets.empty() )
288  upper_targets = pairs[2];
289 
290  // loop through all targets. If one is found, return it.
291  for(vector1<Size>::const_iterator lower_target = lower_targets.begin(),
292  end_lower_target = lower_targets.end();
293  lower_target != end_lower_target; ++lower_target)
294  {
295  for( vector1<Size>::const_iterator upper_target = upper_targets.begin(),
296  end_host = upper_targets.end();
297  upper_target != end_host; ++upper_target )
298  {
299  if( interface.is_pair(pose.residue(*lower_target), pose.residue(*upper_target)) &&
300  potential_.is_disulfide(pose.residue(*lower_target), pose.residue(*upper_target)) )
301  {
302  disulfides.push_back(std::make_pair(*lower_target,*upper_target));
303  }
304  }
305  }
306 }
307 
308 /**
309  * @brief Reinitialize this Mover with parameters from the specified tags.
310  * @details Parameters recognized:
311  * - target_pdb_num or target_res_num. A single target residue to form disulfides to
312  * - target_pdb_nums or target_res_nums. A list of possible target residues
313  */
315  DataMap & data,
317  Movers_map const &,
318  Pose const & pose)
319 {
320 
321  // Set target to the residue specified by "target_pdb_num" or "target_res_num"
322  if( tag->hasOption("targets") ){
323  target_residues_ = core::pose::get_resnum_list(tag, "targets",pose);
324  }
325 
326  using namespace core::scoring;
327  std::string const scorefxn_repack( tag->getOption<string>( "scorefxn_repack", "score12" ) );
328  std::string const scorefxn_minimize( tag->getOption<string>( "scorefxn_minimize", "score12" ) );
329  scorefxn_repack_ = new ScoreFunction( *data.get< ScoreFunction * >( "scorefxns", scorefxn_repack ) );
330  scorefxn_minimize_ = new ScoreFunction( *data.get< ScoreFunction * >( "scorefxns", scorefxn_minimize ) );
331 
332 
333  TR<<"DisulfideMover targeting residues ";
334  for(vector1<Size>::const_iterator target = target_residues_.begin();
335  target != target_residues_.end();++target)
336  {
337  TR<<*target<<", ";
338  }
339  TR<<std::endl;
340 }
341 
342 
343 } // movers
344 } // protein_interface_design
345 } // protocols