Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AsymFoldandDockClaimer.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 // 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 AsymFoldandDockClaimer
10 /// @brief Fold-and-dock
11 /// @author Ingemar Andre
12 
13 // Unit Headers
18 
19 // Package Headers
21 #include <protocols/loops/Loop.hh>
22 #include <protocols/loops/Loops.hh>
26 #include <basic/Tracer.hh>
27 
28 // Utility header
29 #include <numeric/random/random.hh>
30 #include <core/pose/PDBInfo.hh>
31 #include <utility/excn/Exceptions.hh>
32 #include <basic/options/option.hh>
33 #include <basic/options/keys/fold_and_dock.OptionKeys.gen.hh>
34 #include <basic/options/keys/docking.OptionKeys.gen.hh>
35 // AUTO-REMOVED #include <core/io/pdb/pose_io.hh>
36 
37 
40 #include <utility/vector0.hh>
41 #include <utility/vector1.hh>
42 
43 
44 // Project Headers
45 
46 static basic::Tracer tr("protocols.topo_broker.asym_fold_and_dock",basic::t_info);
47 static numeric::random::RandomGenerator RG(24278357);
48 
49 namespace protocols {
50 namespace topology_broker {
51 
52 using namespace core;
53 
54 
56 
58  input_pose_(input_pose)
59 {
60  docking_local_refine_ = false;
61  chain_break_res_ = 0;
62 }
63 
64  //clone
67  return new AsymFoldandDockClaimer( *this );
68 }
69 
70 ///@brief type() is specifying the output name of the TopologyClaimer
73  return _static_type_name();
74 }
75 
78  return "AsymFoldandDockClaimer";
79 }
80 
81 void
83  moves::RandomMover& random_mover,
84  core::pose::Pose const& /*pose*/,
85  abinitio::StageID stageID, /*abinitio sampler stage */
86  core::scoring::ScoreFunction const& scorefxn,
87  core::Real /*progress progress within stage */
88 )
89 {
90  using namespace basic::options;
91  using namespace protocols::loops;
92  using namespace protocols::simple_moves;
93 
95  moves::MoverOP rb_trial_mover = (stageID==abinitio::STAGE_4) ?
97  new simple_moves::asym_fold_and_dock::AsymFoldandDockRbTrialMover( &scorefxn ); // smooth RB moves in stage 4
99  core::Real move_anchor_weight(1.0),
100  rb_weight(option[ OptionKeys::fold_and_dock::rigid_body_frequency ]()),
101  slide_weight(option[ OptionKeys::fold_and_dock::slide_contact_frequency ]());
102 
103  random_mover.add_mover( move_anchor_mover, move_anchor_weight );
104  random_mover.add_mover( rb_trial_mover, rb_weight );
105  random_mover.add_mover( slide_mover, slide_weight );
106 }
107 
108 bool AsymFoldandDockClaimer::read_tag( std::string tag, std::istream& is ) {
109  if ( tag == "loop_file" || tag == "LOOP_FILE" ) {
110  std::string file;
111  is >> file;
112  std::ifstream infile( file.c_str() );
113 
114  if (!infile.good()) {
115  utility_exit_with_message( "[ERROR] Error opening RBSeg file '" + file + "'" );
116  }
117  loops::PoseNumberedLoopFileReader loop_file_reader;
118  loops::SerializedLoopList loops = loop_file_reader.read_pose_numbered_loops_file(infile, file, false );
119  loops::Loops loop_defs = loops::Loops( loops ); // <==
120 // loop_defs = loop_defs.invert( input_pose_.total_residue() );
121  tr << "Flexible residues: " << loop_defs << std::endl;
122  moving_res_ = loop_defs;
123  } else if (tag == "CHAIN_BREAK_ASSYM_FND" || tag == "chain_break_assym_fnd" ) {
124  is >> chain_break_res_;
125  } else {
126  throw utility::excn::EXCN_BadInput( " Unknown tag, only LOOP, CHAIN_BREAK_ASSYM_FND definition is allowed at this stage");
127  }
128  return true;
129 }
130 
132  core::pose::Pose& pose,
133  DofClaims const& init_dofs,
134  DofClaims& /*failed_to_init*/ ) {
135 
136  using namespace loops;
137  using namespace kinematics;
138 
139  if ( moving_res_.size() == 0 ) throw utility::excn::EXCN_BadInput( " missing definition of moving residues, add a LOOP definition ");
140  if ( moving_res_.size() > 1 ) throw utility::excn::EXCN_BadInput( " Only one movable region possible at this stage ");
141  if ( chain_break_res_ == 0 ) throw utility::excn::EXCN_BadInput( " No chainbreak defined... ");
142 
143 /*
144  Size moving_end( 1 );
145  for ( Loops::const_iterator loop_it = moving_res_.begin(); loop_it != moving_res_.end(); ++loop_it ) {
146  moving_start_ = loop_it->start();
147  moving_end = loop_it->stop();
148  }
149 */
150 
151  // make a PDBInfo for the pose...
152  pose::PDBInfoOP pdb_info = new pose::PDBInfo( pose, true );
153 
155  for ( Size i=1; i<= pdb_info->nres(); ++i ) {
156  if ( i <= chain_break_res_ ) {
157  chain.push_back( 'A' );
158  } else {
159  chain.push_back( 'B' );
160  }
161  }
162 
163  pdb_info->set_chains( chain );
164  pose.pdb_info( pdb_info );
165 
166  docking_local_refine_ = basic::options::option[ basic::options::OptionKeys::docking::docking_local_refine ]();
167  bool slide ( !docking_local_refine_ );
168 
171  std::string chainID("A_B");
172  // If we don't have a docking jump we have to create it before calling setup_foldtree (strangely enough)
173  if ( pose.fold_tree().num_jump() == 0 ) {
174  FoldTree f(pose.fold_tree());
175  f.clear();
176  f.simple_tree( pose.total_residue() );
177  f.new_jump( 1, pose.total_residue() , chain_break_res_ );
178  pose.fold_tree( f );
179  }
180  protocols::docking::setup_foldtree( pose, chainID, dock.movable_jumps() );
182  dock_init.apply( pose );
183  // Setup the movemap
185  movemap->set_bb( true );
186  movemap->set_jump( true );
187 
188  for ( DofClaims::const_iterator it = init_dofs.begin(), eit = init_dofs.end();
189  it != eit; ++it ) {
190  if ( (*it)->owner()==this ) {
191  (*it)->toggle( *movemap, true );
192  }
193  }
194 
195 }
196 
198  // Set all cuts to real cuts. We don't want to close any of them...
199  loops::Loops loops;
200  loops::Loop single_loop;
201 
202  std::cout << input_pose_.fold_tree() << std::endl;
204  for ( Size i = 1; i <= cuts.size(); ++i ) {
205  new_claims.push_back( new CutClaim( this, cuts[i], DofClaim::INIT /* for now... eventually CAN_INIT ? */ ) );
206  }
207 }
208 
210 {
211  using namespace core::kinematics;
212 
213  core::Size nres ( pose.total_residue() );
214  // Does the chain start at a reasonable place in the sequence?
215  runtime_assert( chain_break_res > 1 && chain_break_res <= nres );
216 
217  // find the anchor
218  FoldTree f( pose.fold_tree() );
219  int jump_number(1);
220  for ( Size i=1; i<= f.num_jump(); ++i ) {
221  Size res( f.downstream_jump_residue( i ) );
222  if ( res > chain_break_res ) {
223  jump_number = i;
224  }
225  }
226  return jump_number;
227 }
228 
229 } //topology_broker
230 } //protocols