Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SurfaceDockingProtocol.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;
2 // rm-trailing-spaces:t -*-
3 // vi: set ts=2 noet:
4 //
5 // (c) Copyright Rosetta Commons Member Institutions.
6 // (c) This file is part of the Rosetta software suite and is made available
7 // under license.
8 // (c) The Rosetta software is developed by the contributing members of the
9 // Rosetta Commons.
10 // (c) For more information, see http://www.rosettacommons.org. Questions about
11 // this can be
12 // (c) addressed to University of Washington UW TechTransfer,
13 // email: license@u.washington.edu.
14 
15 /// @file SurfaceDockingProtocol.cc
16 /// @author Robin A Thottungal (rathottungal@gmail.com)
17 
18 // Unit Headers
20 
21 // Package Headers
26 
27 
28 // Project headers
30 #include <protocols/moves/Mover.hh>
41 #include <protocols/jd2/Job.hh>
43 
45 
47 
50 
51 // for adding data to pose
52 #include <basic/datacache/BasicDataCache.hh>
54 
55 
56 #include <core/pose/Pose.hh>
57 #include <core/pose/PDBInfo.hh>
58 #include <basic/Tracer.hh>
64 
65 //Abinitio
70 
71 //option key includes
72 #include <basic/options/keys/in.OptionKeys.gen.hh>
73 #include <basic/options/keys/run.OptionKeys.gen.hh>
74 #include <basic/options/keys/out.OptionKeys.gen.hh>
75 #include <basic/options/option.hh>
76 
77 
78 //Utility Headers
79 #include <utility/exit.hh>
80 #include <basic/prof.hh>
81 #include <basic/Tracer.hh>
83 #include <string>
84 
85 
86 using basic::T;
87 using basic::Error;
88 using basic::Warning;
89 
90 using namespace protocols::surface_docking;
91 using namespace protocols;
92 using namespace protocols::moves;
93 //using namespace ObjexxFCL::fmt;
94 
95 //using core::pose::datacache::CacheableDataType::SURFACE_PARAMS;
96 static basic::Tracer TR("protocols.SurfaceDocking.SurfaceDockingProtocol");
97 
98 namespace protocols {
99 namespace surface_docking {
100 
101 using namespace core;
103 
104 //constructor
106  Mover::type( "SurfaceDockingProtocol");
108  ( "standard","score12" );
109  // setting weighs for score12
110  TR << "Setting Weights for score12" << std::endl;
112  //score_sidechain_pack_->set_weight(core::scoring::fa_atr,0.97);
113  //score_sidechain_pack_->set_weight(core::scoring::fa_sol,0.92);
114  //score_sidechain_pack_->set_weight(core::scoring::fa_rep,0.64);
115  }
116 
117 //destructor
119 
121  // Make sure the HETATM is first
122  TR<<"Total Residue:"<<pose.total_residue()<<std::endl;
124  //TR<<"Old FoldTree"<<ft<<std::endl;
125  TR<<"FoldTree"<<ft<<std::endl;
126  TR<<"Number of Jumps:"<<pose.num_jump()<<std::endl;
127 }
128 
129 
130 
132 
133  Size const first_protein_residue( pose.num_jump() + 1 );
134 
135  // Initialize the SurfaceEnergies object; this protocol assumes that the block of residues from num_jump to total_residue
136  // represents the single range of non-surface residues
138  surfEs->set_total_residue( pose.total_residue() );
139  surfEs->set_residue_range_not_surface( first_protein_residue, pose.total_residue() );
140  pose.set_new_energies_object( surfEs );
141 
142  // Attaching SurfaceParameters to pose
143  utility::vector0< std::string > SurfVectors(3);
144  TR<<"Remark Info attached to pose SurfaceDockingProtocol:"<<std::endl;
145  TR<<"Size of Remarks:"<<pose.pdb_info()->remarks().size()<<std::endl;
146  for(Size i=0; i<pose.pdb_info()->remarks().size(); i++) {
147  TR << pose.pdb_info()->remarks().at(i).num << " " << pose.pdb_info()->remarks().at(i).value << std::endl;
148  if ( i > 2 ) { TR << "TOO MANY REMARKS!" << std::endl; continue; }
149  SurfVectors[i]=pose.pdb_info()->remarks().at(i).value;
150  }
151 
152 
153  surface_docking::SurfaceParametersOP surfaceParameters =
154  new surface_docking::SurfaceParameters(SurfVectors[0],SurfVectors[1],SurfVectors[2]);
156 
157  // grabing the information attached to the pose to save temporarily
158  surface_docking::SurfaceParameters & surfaceVectors_tmp=
159  *( static_cast< surface_docking::SurfaceParameters * >
161 
162  // Creating a job compatible with JD2
165  job_outputter()->output_name( job ) );
166 
167  //Testing
168  TR<<"Total Residue"<<pose.total_residue()<<std::endl;
169 
170  // Setting up the foldTree
171  setupFoldTree(pose);
172  // Copying the pdb_info((
173  core::pose::PDBInfoOP pose_pdbinfo = pose.pdb_info();
174  // getting info about the surface vectors from remarks
175 
177  simple_moves::SwitchResidueTypeSetMover to_all_atom( "fa_standard" );
178 
179  TR<<"Applying surfaceOrient Mover"<<std::endl;
182  sf->apply(pose);
183 
184  //split the pose into separate chains
185  utility::vector1< pose::PoseOP > singlechain_poses;
186  singlechain_poses = pose.split_by_chain();
187  assert( singlechain_poses.size() == 2);
188  singlechain_poses[ 2 ]->set_new_energies_object( new core::scoring::Energies ); // replace the SurfaceEnergies object
189 
190  // singlechain_poses[2] contains the protein; can be made generic
191  // for multiple proteins too
192  TR<<"CentroidRelaxed Started................"<<std::endl;
193  to_centroid.apply( *singlechain_poses[2] );
194  // Starting abinitio protocol
195  abinitio(*singlechain_poses[2]);
196  CalcSecondayStruct(*singlechain_poses[2]);
197  TR<<"SS After Abinitio()"<<SecStruct_<<std::endl;
200  centroidrelax->set_nmoves(10);
201  centroidrelax->apply(*singlechain_poses[2]);
202  CalcSecondayStruct(*singlechain_poses[2]);
203  TR<<"SS After CentroidRelax:"<<SecStruct_<<std::endl;
204  TR<<"CentroidRelaxed Done................"<<std::endl;
205  to_all_atom.apply(*singlechain_poses[2]);
206  CalcSecondayStruct(*singlechain_poses[2]);
207  TR<<"SS After to_all_atom:"<<SecStruct_<<std::endl;
208  pose.copy_segment((*singlechain_poses[2]).total_residue(),
209  (*singlechain_poses[2]),
210  (*singlechain_poses[1]).total_residue()+1,1);
211  setupFoldTree(pose);
212  // re-attach the information to the pose
213  pose.data().set(core::pose::datacache::CacheableDataType::SURFACE_PARAMS,&surfaceVectors_tmp);
214  // re-attach pdb_info to pose
215  pose.pdb_info(pose_pdbinfo);
216  // setting the secondary structure info
217  SetSecondayStruct(pose);
218  TR<<"Secondary Structure:"<<pose.secstruct()<<std::endl;
219  // added on Jun 22, to see if to_full atom is introducing high ene structures
220  pack::task::PackerTaskOP my_task_fullatom
221  ( pack::task::TaskFactory::create_packer_task( pose ));
222 
223  // allow repacking for only the protein side chains!
224  for ( Size ii = 1; ii <= pose.total_residue(); ++ii ) {
225  if (ii < first_protein_residue) {
226  my_task_fullatom->nonconst_residue_task( ii ).prevent_repacking();
227  } else {
228  my_task_fullatom->nonconst_residue_task( ii ).restrict_to_repacking();
229  }
230  }
231  protocols::simple_moves::PackRotamersMoverOP side_chain_pack_fullatom
233  (*score_sidechain_pack_)(pose);
234  TR << " Score Before Sidechain Packing:" << (*score_sidechain_pack_)(pose) << std::endl;
235  side_chain_pack_fullatom->apply(pose);
236  (*score_sidechain_pack_)(pose);
237  TR << " Score After Sidechain Packing:" << (*score_sidechain_pack_)(pose) << std::endl;
238  TR<<"Packing Sidechain Done................"<<std::endl;
239  //Fullatom Relax starts!
240  TR<<"FullatomeRelaxed Started................"<<std::endl;
241  sf->apply(pose);
242  // Moving the protein away from the surface
243  FaSlideAwayFromSurface MoveProteinAway( pose.num_jump() );
244  MoveProteinAway.apply(pose);
245 
247  if ( basic::options::option[ basic::options::OptionKeys::run::benchmark ] ) {
248  allatomrelax->set_nmoves(3);
249  } else {
250  allatomrelax->set_nmoves(6);
251  }
252 
253  core::Size lj_ramp_cycle=5; // inside the constructor
254  // set the random number
255  core::Real lj_increment = ( 1.0 - 0.02 )/ lj_ramp_cycle;
256  for (Size i=1;i<=lj_ramp_cycle;++i) {
257  TR<<"FullatomRelax Execution Number:"<<i<<std::endl;
258  if ( basic::options::option[ basic::options::OptionKeys::run::benchmark ] ) {
259  allatomrelax->set_smallmovesize(3);
260  } else {
261  allatomrelax->set_smallmovesize(30/i);
262  }
263 
264  allatomrelax->set_ljrepulsion_weight((0.02+i*lj_increment));
265  allatomrelax->set_ecounter(i); // when value of i matches the random number
266  // in the allatomrelax, protein is slide into the surface
267  allatomrelax->apply(pose);
268  }
269  // Final Side Chain re-packing using rtmin; adopted from Dave's protocol
270  TR<<"FullatomeRelaxed Done................"<<std::endl;
271  sf->apply(pose);
272  TR<<"Packing Sidechains Started................"<<std::endl;
273  pack::task::PackerTaskOP my_task( pack::task::TaskFactory::create_packer_task( pose ));
274 
275  // allow repacking for only the protein side chains!
276  for ( Size ii = 1; ii <= pose.total_residue(); ++ii ) {
277  if (ii < first_protein_residue ){
278  my_task->nonconst_residue_task( ii ).prevent_repacking();
279  } else {
280  my_task->nonconst_residue_task( ii ).restrict_to_repacking();
281  }
282 
283  }
286  (*score_sidechain_pack_)(pose);
287  TR << " Score Before Sidechain Packing:" << (*score_sidechain_pack_)(pose) << std::endl;
288  side_chain_pack->apply(pose);
289  (*score_sidechain_pack_)(pose);
290  TR << " Score After Sidechain Packing:" << (*score_sidechain_pack_)(pose) << std::endl;
291  TR<<"Packing Sidechain Done................"<<std::endl;
292 
293  // Side Chain Packing done
295  TR<<"Secondary Structure in Solution:"<<allatomrelax->getSecondayStruct()<<std::endl;
296  TR<<"Secondary Structure on Surface:"<<SecStruct_<<std::endl;
297  job->add_string_string_pair("SolState_SecondaryStructure:",allatomrelax->getSecondayStruct());
298  job->add_string_string_pair("Adsorbed_SecondaryStructure:",SecStruct_);
299  JobDistributor::get_instance()->job_outputter()->other_pose( job,pose, "Surface_");
300 }
301 
303  SecStruct_="";
304  core::scoring::dssp::Dssp dssp( pose );
305  dssp.insert_ss_into_pose( pose );
306 
307  for ( Size ii = 1; ii <= pose.total_residue(); ++ii ) {
308  SecStruct_+=pose.secstruct(ii);
309  }
310 }
311 
313  SecStruct_="";
314  // creating a new pose and splitting!
315  //split the pose into separate chains
316  pose::PoseOP pose_tmp=new pose::Pose(pose);
317  utility::vector1< pose::PoseOP > singlechain_poses;
318  singlechain_poses = pose_tmp->split_by_chain();
319  core::scoring::dssp::Dssp dssp( *singlechain_poses[2] );
320  dssp.insert_ss_into_pose( *singlechain_poses[2] );
321  for ( Size ii = 1; ii <= singlechain_poses[2]->total_residue(); ++ii ) {
322  SecStruct_+=singlechain_poses[2]->secstruct(ii);
323  }
324 }
325 
327  Size index=0;
328  for ( Size ii = pose.num_jump()+1; ii <= pose.total_residue(); ++ii ) {
329  pose.set_secstruct(ii,SecStruct_[index]);
330  index=index+1;
331  }
332 }
333 
335  using namespace core;
336  using namespace basic::options;
337  //ClassicAbinitio
338  TR << "starting ClassicAbinitio...." << std::endl;
340  std::string frag_large_file = option[ OptionKeys::in::file::frag9 ]();
341  std::string frag_small_file = option[ OptionKeys::in::file::frag3 ]();
342  TR<<"Loading Fragment 9:"<<std::endl;
344  fragset_large->read_fragment_file(frag_large_file);
345  TR<<"Loading Fragment 3:"<<std::endl;
347  fragset_small->read_fragment_file(frag_small_file);
349  movemap->set_bb_true_range(1,pose.total_residue());
350  protocols::abinitio::ClassicAbinitio abinitio(fragset_small,fragset_large,movemap);
351  abinitio.set_score_weight(scoring::rg,0);
352  abinitio.init(pose);
353  abinitio.apply(pose);
354 
355 }
356 
358  return "SurfaceDockingProtocol";
359 }
360 
361 } //surfaceDockingProtocol
362 
363 } //protocol
364 
365