Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LocalInserter.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 /// @file protocols/loops/LocalInserter.cc
11 /// @brief
12 /// @author Mike Tyka
13 
15 // AUTO-REMOVED #include <protocols/loophash/LoopHashMap.hh>
17 
18 #include <core/pose/util.hh>
19 // AUTO-REMOVED #include <core/scoring/constraints/util.hh>
20 #include <basic/Tracer.hh>
21 #include <core/scoring/rms_util.hh>
22 #include <protocols/loops/Loop.hh>
23 #include <protocols/loops/Loops.hh>
24 #include <protocols/loops/util.hh>
29 
31 
32 #include <utility/vector1.hh>
33 
34 //Auto Headers
35 #include <core/pose/Pose.hh>
36 
37 using namespace core;
38 using namespace core::pose;
39 
40 namespace protocols {
41 namespace loophash {
42 
43 static basic::Tracer TR("LocalInserter");
44 
45 /// @details Auto-generated virtual destructor
46 LocalInserter::~LocalInserter() {}
47 
48 
49 ///@brief set the score function for the first round of minimization
50 ///during a loophash insert
51 void
52 LocalInserter_SimpleMin::scorefxn_rama_cst(
54 ){
55  scorefxn_rama_cst_=scorefxn;
56 }
57 
58 ///@brief set the score function for the second round of minimization
59 ///during a loophash insert
60 void
61 LocalInserter_SimpleMin::scorefxn_cen_cst(
63 ){
64  scorefxn_cen_cst_=scorefxn;
65 }
66 
68 LocalInserter_SimpleMin::make_local_bb_change(
69  core::pose::Pose &newpose,
70  const core::pose::Pose &original_pose,
72  core::Size res_pos
73 )
74 {
75  using namespace core;
76  using namespace optimization;
77 
78  // set newpose
79  protocols::loops::Loops exclude_region;
80  exclude_region.add_loop( protocols::loops::Loop( res_pos, res_pos + new_bs.length() ) );
81  //core::pose::Pose newpose( original_pose );
82  transfer_phi_psi( original_pose, newpose );
83  add_coordinate_constraints_to_pose( newpose, original_pose, exclude_region );
84  new_bs.apply_to_pose( newpose, res_pos );
85  pose::set_ss_from_phipsi( newpose );
86 
87  //scorefxn_rama_cst.show( TR.Info, *newpose );
88 
89  kinematics::MoveMap final_mm;
90  final_mm.set_bb(true);
91  // setup movemap & minimisation
92 
93  // just for comparison with cut!
94  //core::pose::PoseOP newpose2( new Pose( original_pose ) );
95  //new_bs.apply_to_pose( *newpose2, ir, true );
96  //newpose2->dump_pdb("rep_" + utility::to_string( ir ) + "_" + utility::to_string( jr ) + "_" + utility::to_string( int(xyzdist) ) + "_" + utility::to_string( int(angdist) ) + ".cut.pdb" );
97  //scorefxn_rama_cst.show( TR.Info, *newpose );
98  //newpose->dump_pdb("rep_" + utility::to_string( ir ) + "_" + utility::to_string( jr ) + "_" + utility::to_string( int(xyzdist) ) + "_" + utility::to_string( int(angdist) ) + ".bef.pdb" );
99  AtomTreeMinimizer().run( newpose, final_mm, scorefxn_rama_cst_, options_ );
100  //scorefxn_rama_cst.show( TR.Info, *newpose );
101  //newpose->dump_pdb("rep_" + utility::to_string( ir ) + "_" + utility::to_string( jr ) + "_" + utility::to_string( int(xyzdist) ) + "_" + utility::to_string( int(angdist) ) + ".aft.pdb" );
102  //newpose->dump_pdb("rep_" + utility::to_string( ir ) + "_" + utility::to_string( jr ) + "_" + utility::to_string( int(xyzdist) ) + "_" + utility::to_string( int(angdist) ) + ".pdb" );
103 
104  core::Real premin_rms = core::scoring::CA_rmsd( newpose, original_pose );
105  //scorefxn_cen_cst.show( TR.Info, *newpose );
106  AtomTreeMinimizer().run( newpose, final_mm, scorefxn_cen_cst_, options2_ );
107  //scorefxn_cen_cst.show( TR.Info, *newpose );
108 
109  // get final RMS
110  core::Real final_rms = core::scoring::CA_rmsd( newpose, original_pose );
111  TR.Debug << "Premin RMS: " << premin_rms << "Min Score3 " << "Final RMS: " << final_rms << std::endl;
112 
113 
114  //transfer_phi_psi( newpose, start_pose );
115 
116  core::Real final_score = scorefxn_cen_cst_(newpose);
117 
118  TR.Debug << "INSERTRESULT: " << final_rms << " " << final_score << std::endl;
119  core::pose::setPoseExtraScores( newpose, "lh_censcore", final_score );
120 
121  //transfer_phi_psi( newpose, start_pose );
122 
123  return final_rms;
124 }
125 
127 LocalInserter_SimpleMin::make_local_bb_change_close_gaps(
128  core::pose::Pose &newpose,
129  const core::pose::Pose &original_pose,
131  core::Size res_pos
132 )
133 {
134  using namespace core;
135  using namespace optimization;
136 
137  // set newpose
138  protocols::loops::Loops exclude_region;
139  utility::vector1 < Size > excluded_res;
140  exclude_region.add_loop( protocols::loops::Loop( res_pos, res_pos + new_bs.length() ) );
141  //core::pose::Pose newpose( original_pose );
142  transfer_phi_psi( original_pose, newpose );
143  add_coordinate_constraints_to_pose( newpose, original_pose, exclude_region );
144 
145 
146  // fix gaps between ir and jr if it exists by idealizing every position
147  for( Size idx = res_pos, end_pos = res_pos + new_bs.length(); idx <= end_pos; idx ++ ) {
149  excluded_res.push_back(idx);
150  }
151  new_bs.apply_to_pose( newpose, res_pos );
152 
153  pose::set_ss_from_phipsi( newpose );
154 
155 
156  kinematics::MoveMap final_mm;
157  final_mm.set_bb(true);
158  // setup movemap & minimisation
159 
160  AtomTreeMinimizer().run( newpose, final_mm, scorefxn_rama_cst_, options_ );
161 
162  core::Real premin_rms = core::scoring::CA_rmsd( newpose, original_pose );
163  //scorefxn_cen_cst.show( TR.Info, *newpose );
164  AtomTreeMinimizer().run( newpose, final_mm, scorefxn_cen_cst_, options2_ );
165  //scorefxn_cen_cst.show( TR.Info, *newpose );
166 
167 
168 
169  // get final RMS
170  // since we're closing gaps, we only want to make sure the rmsd of the non loophash region is under some cutoff
171  core::Real final_rms = core::scoring::CA_rmsd( newpose, original_pose, 1, original_pose.total_residue(), excluded_res );
172  TR.Debug << "Premin RMS: " << premin_rms << "Min Score3 " << "Final RMS: " << final_rms << std::endl;
173 
174 
175 
176  core::Real final_score = scorefxn_cen_cst_(newpose);
177 
178  TR.Debug << "INSERTRESULT: " << final_rms << " " << final_score << std::endl;
179  core::pose::setPoseExtraScores( newpose, "censcore", final_score );
180 
181  // remove that extra virtual atom cooordinate constraints adds on
183 
184  return final_rms;
185 }
186 
188 LocalInserter_SimpleMin::make_local_bb_change_include_cut(
189  core::pose::Pose &newpose,
190  const core::pose::Pose &original_pose,
192  core::Size res_pos
193 )
194 {
195  using namespace core;
196  using namespace optimization;
197 
198  // set newpose
199  protocols::loops::Loops exclude_region;
200  exclude_region.add_loop( protocols::loops::Loop( res_pos, res_pos + new_bs.length() ) );
201  transfer_phi_psi( original_pose, newpose );
202  add_coordinate_constraints_to_pose( newpose, original_pose, exclude_region );
203  new_bs.apply_to_pose( newpose, res_pos, true );
204  pose::set_ss_from_phipsi( newpose );
205 
206  // get final RMS
207  core::Real final_rms = core::scoring::CA_rmsd( newpose, original_pose );
208  TR << "Final RMS: " << final_rms << std::endl;
209  TR.Debug << "Final RMS: " << final_rms << std::endl;
210 
211  //transfer_phi_psi( newpose, start_pose );
212 
213  core::Real final_score = scorefxn_cen_cst_(newpose);
214 
215  TR.Debug << "INSERTRESULT: " << final_rms << " " << final_score << std::endl;
216  core::pose::setPoseExtraScores( newpose, "censcore", final_score );
217  core::pose::setPoseExtraScores( newpose, "rms", final_rms );
218 
219  //transfer_phi_psi( newpose, start_pose );
220 
221  return final_rms;
222 }
223 
224 void
225 LocalInserter_SimpleMin::set_default_score_functions(){
226  using namespace core::scoring;
227 
228  scorefxn_rama_cst_.set_weight( coordinate_constraint, 0.5 );
229  scorefxn_rama_cst_.set_weight( rama , 1.0 );
230 
231  scorefxn_cen_cst_.set_weight( coordinate_constraint, 0.05 );
232  scorefxn_cen_cst_.set_weight( env , 1.0);
233  scorefxn_cen_cst_.set_weight( pair , 1.0);
234  scorefxn_cen_cst_.set_weight( cbeta , 1.0);
235  scorefxn_cen_cst_.set_weight( vdw , 1.0);
236  scorefxn_cen_cst_.set_weight( rg , 3.0);
237  scorefxn_cen_cst_.set_weight( cenpack , 1.0);
238  scorefxn_cen_cst_.set_weight( hs_pair , 1.0);
239  scorefxn_cen_cst_.set_weight( ss_pair , 1.0);
240  scorefxn_cen_cst_.set_weight( rsigma , 1.0);
241  scorefxn_cen_cst_.set_weight( sheet , 1.0);
242 }
243 
244 } // namespace loophash
245 } // namespace protocols
246 
247 
248 
249