Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ddGMover.hh
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 /// @file
11 /// @brief
12 /// @author Liz Kellogg
13 
14 #ifndef INCLUDED_protocols_ddg_ddGMover_hh
15 #define INCLUDED_protocols_ddg_ddGMover_hh
16 
17 /// Where is the ddGMover.fwd.hh include?
18 
19 // Package headers
20 #include <protocols/moves/Mover.hh>
21 
22 // Project headers
23 // AUTO-REMOVED #include <core/pack/pack_rotamers.hh>
24 // AUTO-REMOVED #include <core/pack/task/PackerTask.hh>
25 // AUTO-REMOVED #include <core/pack/task/TaskFactory.hh>
26 // AUTO-REMOVED #include <core/pose/Pose.hh>
27 // AUTO-REMOVED #include <core/scoring/ScoreFunction.hh>
28 // AUTO-REMOVED #include <core/scoring/ScoreFunctionFactory.hh>
29 // AUTO-REMOVED #include <core/scoring/constraints/ConstraintSet.hh>
31 
32 
34 
35 // ObjexxFCL headers
36 #include <ObjexxFCL/FArray2D.hh>
37 
38 #include <core/chemical/AA.hh>
41 #include <utility/vector0.hh>
42 #include <utility/vector1.hh>
43 
44 namespace protocols {
45 namespace ddg {
46 
47  using namespace core;
48  using namespace scoring;
49 
50  typedef std::vector<double> ddGs;
51 
52 class ddGMover: public moves::Mover{
53 public:
54  ddGMover();
55 
56  ddGMover(
60  );
61 
62  virtual ~ddGMover();
63 
64  //setter function
65  void neighbor_cutoff(double cutoff);
66  void restrict_to_nbrs(bool truefalse);
67  void score_function( core::scoring::ScoreFunctionOP s);
68  void set_minimization_score_function( core::scoring::ScoreFunctionOP s);
69  // Undefined, commenting out to fix PyRosetta build
70  //void set_constraint_set( core::scoring::constraints::ConstraintSetOP cs);
71  void num_iterations(int num);
72  void dump_pdbs(bool truefalse);
73  void debug_output(bool truefalse);
74  void is_interface_ddg(bool truefalse);
75  void wt_score_components(ObjexxFCL::FArray2D<double> wsc);
76  void wt_unbound_score_components(ObjexxFCL::FArray2D<double> wusc);
77  void mutant_score_components(ObjexxFCL::FArray2D<double> msc);
78  void residues_to_mutate(utility::vector1<core::chemical::AA> residues);
79  void set_min_cst(bool truefalse);
80  void set_mean(bool truefalse);
81  void set_min(bool truefalse);
82  void set_num_decoys_used_in_calculations(core::Real num_lowe_used);
83 
84  //accessor function
85  core::Real neighbor_cutoff();
86  bool restrict_to_nbrs();
87  core::scoring::ScoreFunctionOP score_function();
88  core::scoring::ScoreFunctionOP minimization_score_function();
89  // Undefined, commenting out to fix PyRosetta build
90  //core::scoring::constraints::ConstraintSetOP constraint_set();
91  int num_iterations();
92  bool is_interface_ddg();
93  ObjexxFCL::FArray2D<double> wt_score_components();
94  ObjexxFCL::FArray2D<double> wt_unbound_score_components();
95  ObjexxFCL::FArray2D<double> mutant_score_components();
96  utility::vector1<core::chemical::AA> residues_to_mutate();
97 
98  utility::vector1<double> get_wt_min_score_components();
99  utility::vector1<double> get_wt_averaged_score_components();
100  utility::vector1<double> get_mutant_min_score_components();
101  utility::vector1<double> get_mutant_averaged_score_components();
102  utility::vector1<double> get_delta_energy_components();
103  void get_scorefunction_header(
105  utility::vector1<std::string> & components
106  );
107  std::string mutation_label(pose::Pose const & pose) const;
108  double get_wt_averaged_totals();
109  double get_wt_min_totals();
110  double get_mutant_averaged_totals();
111  double get_mutant_min_totals();
112  double ddG();
113  virtual void apply(core::pose::Pose & pose);
114  virtual std::string get_name() const;
115  bool is_wt_calc_complete();
116  bool is_mutant_calc_complete();
117  bool is_properly_initialized(pose::Pose & pose);
118  bool get_min_cst();
119  bool use_mean();
120  bool use_min();
121  core::Real get_num_decoys_used_in_calculations();
122 
123 private:
125  bool mean_;
126  bool min_;
127  bool min_cst_;
132  core::scoring::ScoreFunctionOP min_cst_sfxn_; /// minimize the score with this score function
133  core::scoring::ScoreFunctionOP min_cst_sfxn_no_cst_weight_; /// report the score with this score function
135 
144 
147  bool dmp_pdb_;
149  ObjexxFCL::FArray2D<double> wt_components_;
150  ObjexxFCL::FArray2D<double> wt_unbound_components_; //ek interface ddg capabilities;
151  ObjexxFCL::FArray2D<double> mutant_components_;
152  ObjexxFCL::FArray2D<double> mutant_unbound_components_; //ek interface ddg capabilities;
155 
157  find_nbrs(
158  core::pose::Pose & p,
159  utility::vector1<int> & mutation_position,
160  double radii
161  );
162 
163  void setup_packertask(core::pack::task::PackerTaskOP pt, core::pose::Pose & p);
164  //void refine_structure();
165 
166 
167  bool is_complete(ObjexxFCL::FArray2D<double> to_check);
168 
169  double sum(ddGs &scores_to_sum);
170  double average( utility::vector1<double> &scores_to_average);
171  int store_energies(
172  ObjexxFCL::FArray2D< double > &two_d_e_arrays,
174  core::pose::Pose &p,
175  int next_index,
176  int size_to_expect
177  );
178 
179  int average_score_components(
180  ObjexxFCL::FArray2D< double > &scores_to_average,
181  utility::vector1<double> &averaged_scores
182  );
183 
184  //int which_iteration(ObjexxFCL::FArray2D<double> scores);//locates uninitialized values
185  //and returns the iteration to continue on
186  //above not used/???
187 
188  void calculate_interface_unbound_energy(core::pose::Pose & p,core::scoring::ScoreFunctionOP s,core::pack::task::PackerTaskOP pt);
189 
190  //void setup_rotamer_constraints(pose::Pose & p,ScoreFunction & s,
191  // utility::vector1<int> & res_to_include)
192  void setup_rotamer_constraints(
193  core::pose::Pose & p,
195  utility::vector1<int> & mutation_position,
196  bool all_but_mutation_site,
197  utility::vector1<char> & constraints_at_pos
198  );
199 
200  /// @brief sets up only rotamer constraints available during repacking
201  void setup_repack_constraints(
202  core::pose::Pose & pose,
204  bool all_but_mut_site,
205  utility::vector1<char> & constraints_at_pos
206  );
207 
208  void setup_constraints(
209  pose::Pose & pose,
211  float const cst_tol,
212  bool all_but_mut_site,
213  utility::vector1<char> & constraints_at_pos
214  );
215 
217  pose::Pose & pose,
220  );
221 
222  void print_verbose_ddgs(
226  bool mean,
227  bool min,
229  );
230 
231 private:
232  /// APL's attempts at refactoring this code
233 
234  /// @brief Apply the protocol to the wild type species.
235  void relax_wildtype_structure(
236  core::pose::Pose & pose,
237  protocols::scoring::Interface & protein_interface,
238  std::string const & wt_traj,
239  bool output_silent
240  );
241 
242  /// @brief Initialize a packer task to reflect the residues that should be repacked
243  /// based on the structure of the wildtype pose.
244  void
245  setup_packer_task_for_mutations(
246  core::pose::Pose const & pose,
247  protocols::scoring::Interface const & protein_interface,
250  );
251 
252  void
253  initialize_task_level_behavior(
255  );
256 
257 
258  bool
259  is_any_pdb_empty(
260  core::pose::Pose const & pose,
261  std::string const & mutant_traj,
262  bool const output_silent
263  ) const;
264 
266  neighborhood_of_mutations(
267  core::pose::Pose const & pose,
269  ) const;
270 
271  void
272  initialize_rotamer_behavior_for_residue_level_task(
274  ) const;
275 
276 };
277 
278 } //moves
279 } //protocols
280 
281 #endif
282