Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AntibodyModeler.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
6 // (c) under license. The Rosetta software is developed by the contributing
7 // (c) members of the Rosetta Commons. For more information, see
8 // (c) http://www.rosettacommons.org. Questions about this can be addressed to
9 // (c) University of Washington UW TechTransfer,email:license@u.washington.edu.
10 
11 /// @author Aroop Sircar ( aroopsircar@yahoo.com )
12 
13 
14 // AUTO-REMOVED #include <core/chemical/ChemicalManager.hh>
16 
19 // AUTO-REMOVED #include <core/fragment/FragID.hh>
20 #include <core/fragment/FragSet.hh>
21 #include <core/fragment/Frame.hh>
22 // AUTO-REMOVED #include <core/fragment/FrameIterator.hh>
24 // AUTO-REMOVED #include <core/io/pdb/pose_io.hh>
25 // AUTO-REMOVED #include <core/io/silent/SilentStruct.hh>
26 // AUTO-REMOVED #include <core/io/silent/SilentStructFactory.hh>
29 #include <basic/options/option.hh>
30 #include <basic/options/keys/antibody.OptionKeys.gen.hh>
31 #include <basic/options/keys/constraints.OptionKeys.gen.hh>
32 #include <basic/options/keys/in.OptionKeys.gen.hh>
33 // AUTO-REMOVED #include <basic/options/keys/out.OptionKeys.gen.hh>
34 #include <basic/options/keys/run.OptionKeys.gen.hh>
40 // AUTO-REMOVED #include <core/pack/task/operation/OptH.hh>
45 #include <core/pose/Pose.hh>
46 #include <core/pose/PDBInfo.hh>
47 #include <core/pose/util.hh>
53 // AUTO-REMOVED #include <core/scoring/constraints/ConstraintFactory.hh>
54 // AUTO-REMOVED #include <core/scoring/constraints/ConstraintIO.hh>
56 #include <basic/Tracer.hh>
57 #include <basic/datacache/BasicDataCache.hh>
58 #include <basic/datacache/DiagnosticData.hh>
59 
60 #include <ObjexxFCL/format.hh>
61 #include <ObjexxFCL/string.functions.hh>
62 using namespace ObjexxFCL::fmt;
63 
65 // AUTO-REMOVED #include <protocols/simple_moves/FragmentMover.hh>
70 //#include <protocols/evaluation/PoseEvaluator.hh>
71 //#include <protocols/evaluation/RmsdEvaluator.hh>
72 // AUTO-REMOVED #include <protocols/jd2/JobDistributor.hh>
73 // AUTO-REMOVED #include <protocols/jd2/Job.hh>
74 // AUTO-REMOVED #include <protocols/jd2/JobOutputter.hh>
76 #include <protocols/loops/Loop.hh>
77 #include <protocols/loops/Loops.hh>
84 #include <protocols/moves/Mover.hh>
92 
94 #include <utility/vector0.hh>
95 #include <utility/vector1.hh>
96 
97 using basic::T;
98 using basic::Error;
99 using basic::Warning;
100 
101 static basic::Tracer TR("protocols.AntibodyModeler");
102 
103 namespace protocols {
104 namespace antibody {
105 // Aroop's Magic number, do not change it
106 // (and dont try and use it anywhere else)
107 // static numeric::random::RandomGenerator RG(22849821);
108 
109 using namespace core;
110 
111 // default constructor
112 AntibodyModeler::AntibodyModeler() : Mover(),
113  init_for_input_yet_( false )
114 {
115  Mover::type( "AntibodyModeler" );
116  set_default();
118 }
119 
120 // default destructor
122 
123 //clone
125  return( new AntibodyModeler() );
126 }
127 
129  TR << "Setting up default settings" << std::endl;
130  model_h3_ = true;
131  snugfit_ = true;
132  native_present_ = false;
133  graft_l1_ = true;
134  graft_l2_ = true;
135  graft_l3_ = true;
136  graft_h1_ = true;
137  graft_h2_ = true;
138  graft_h3_ = false;
139  benchmark_ = false;
140  camelid_ = false;
141  camelid_constraints_ = false;
142 
143 }
144 
146  using namespace basic::options;
147  using namespace basic::options::OptionKeys;
148  TR << "Reading Options" << std::endl;
149  model_h3_ = option[ OptionKeys::antibody::model_h3 ]();
150  snugfit_ = option[ OptionKeys::antibody::snugfit ]();
151  native_present_ = option[ OptionKeys::in::file::native ].user();
152  if( native_present_ )
153  native_filename_ = option[ OptionKeys::in::file::native ]();
154  graft_l1_ = option[ OptionKeys::antibody::graft_l1 ]();
155  graft_l2_ = option[ OptionKeys::antibody::graft_l2 ]();
156  graft_l3_ = option[ OptionKeys::antibody::graft_l3 ]();
157  graft_h1_ = option[ OptionKeys::antibody::graft_h1 ]();
158  graft_h2_ = option[ OptionKeys::antibody::graft_h2 ]();
159  graft_h3_ = option[ OptionKeys::antibody::graft_h3 ]();
160  benchmark_ = option[ OptionKeys::run::benchmark ]();
161  camelid_ = option[ OptionKeys::antibody::camelid ]();
162  camelid_constraints_ = option[ OptionKeys::antibody::
163  camelid_constraints ]();
164  cst_weight_ = option[ OptionKeys::constraints::cst_weight ]();
165  if( camelid_ ) {
166  graft_l1_ = false;
167  graft_l2_ = false;
168  graft_l3_ = false;
169  snugfit_ = false;
170  }
172  model_h3_ = false;
173 
174 }
175 
177  TR << "setting up Snug Dock fold tree" << std::endl;
178  TR << "Snug Dock Fold Tree: " << std::endl;
179  TR << pose_in.fold_tree() << std::endl;
180  return;
181 }
182 
184  init_for_input_yet_ = true;
185 
186  // read native_pose
187  if ( native_present_ ) {
190  }
191  else
193 
195 
196  if( model_h3_ ) {
197  // Read standard Rosetta fragments file
199 
200  // Read in CDR H3 C-terminal fragment file
203  camelid_);
204  }
205 
206  return;
207 } // init_on_new_input
208 
209 
211  using namespace core;
212  using namespace chemical;
213  using namespace id;
214  using namespace fragment;
215  using namespace scoring;
216  using namespace core::scoring::constraints;
217  using namespace protocols::moves;
218 
219  if( model_h3_ && ( cst_weight_ != 0.00 ) ) {
222  cdr_constraint->apply( pose_in );
223  }
224  // utility::exit( EXIT_FAILURE, __FILE__, __LINE__);
225 
226  start_pose_ = pose_in;
227 
229 
230  pose::set_ss_from_phipsi( pose_in );
231 
232  // display constraints and return
233  if( camelid_constraints_ ) {
235  return;
236  }
237 
238  // Junk
239  /*
240  Size tag = 0;
241  for( Size i = antibody_in_.cdrh_[3][2] - 4;
242  i <= antibody_in_.cdrh_[3][2] + 1; i++ ) {
243 
244  Real phi = pose_in.phi( i );
245  Real psi = pose_in.psi( i );
246  Real omega = pose_in.omega( i );
247  Real size = (antibody_in_.cdrh_[3][2] - antibody_in_.cdrh_[3][1])+1;
248 
249  if( i == (antibody_in_.cdrh_[3][2] + 1) ) {
250  std::cout << "OUTPUT: n+1, " << antibody_in_.Fv.pdb_info()->number(i)
251  << antibody_in_.Fv.pdb_info()->icode(i) << ", "
252  << antibody_in_.Fv.residue(i).name1()
253  << ", " << omega << ", " << phi
254  << ", " << psi << ", " << size << std::endl;
255  }
256  else if( i == antibody_in_.cdrh_[3][2] ) {
257  std::cout << "OUTPUT: n, " << antibody_in_.Fv.pdb_info()->number(i)
258  << antibody_in_.Fv.pdb_info()->icode(i)
259  << ", " << antibody_in_.Fv.residue(i).name1()
260  << ", " << omega << ", " << phi
261  << ", " << psi << ", " << size << std::endl;
262  }
263  else {
264  std::cout << "OUTPUT: n-" << antibody_in_.cdrh_[3][2] - i
265  << ", " << antibody_in_.Fv.pdb_info()->number(i)
266  << antibody_in_.Fv.pdb_info()->icode(i)
267  << ", "<< antibody_in_.Fv.residue(i).name1()
268  << ", " << omega << ", " << phi
269  << ", " << psi << ", " << size << std::endl;
270  }
271  }
272  return;
273  */
274  // End Junk
275 
276  SequenceMoverOP model_antibody ( new SequenceMover() );
277 
278  GraftMoverOP graft_move( new GraftMover() );
279  graft_move->enable_graft_l1( graft_l1_ );
280  graft_move->enable_graft_l2( graft_l2_ );
281  graft_move->enable_graft_l3( graft_l3_ );
282  graft_move->enable_graft_h1( graft_h1_ );
283  graft_move->enable_graft_h2( graft_h2_ );
284  graft_move->enable_graft_h3( graft_h3_ );
285  graft_move->enable_benchmark_mode( benchmark_ );
286  graft_move->set_camelid( camelid_ );
287  graft_move->set_native_pose( new pose::Pose ( native_pose_ ) );
288  model_antibody->add_mover( graft_move );
289 
290  if ( model_h3_ ) {
291  CDRH3ModelerOP model_cdrh3( new CDRH3Modeler( offset_frags_ ) );
292  model_cdrh3->enable_benchmark_mode( benchmark_ );
293  model_cdrh3->set_camelid( camelid_ );
294  model_cdrh3->model_h3( model_h3_ );
295  model_cdrh3->store_H3_cter_fragment( H3_base_library_ );
296  model_cdrh3->set_native_pose( new pose::Pose ( native_pose_ ) );
297  model_cdrh3->set_centroid_loop_building( true );
298  model_cdrh3->set_fullatom_loop_building( true );
299  model_antibody->add_mover( model_cdrh3 );
300  }
301 
302  model_antibody->apply( antibody_in_.Fv );
303 
304  if ( !camelid_ && snugfit_ ) {
306  relax_cdrs();
309 
310  // align Fv to native.Fv
311  pose::Pose native_pose;
312  if( get_native_pose() )
313  native_pose = *get_native_pose();
314  else
315  native_pose = antibody_in_.Fv;
316  antibody::Antibody native_ab( native_pose, camelid_ );
317  antibody_in_.align_to_native( native_ab );
318  }
319  else if ( model_h3_ )
320  relax_cdrs();
321 
322  pose_in = antibody_in_.Fv;
323 
324  // remove cutpoints variants for all cdrs
325  // "true" forces removal of variants even from non-cutpoints
326  loops::remove_cutpoint_variants( pose_in, true );
327 
328  // Define CDR H3 loop
329  Size frag_size = (antibody_in_.cdrh_[3][2]-antibody_in_.cdrh_[3][1]) + 3;
330  Size cutpoint = antibody_in_.cdrh_[3][1] + int( frag_size / 2 );
331  loops::Loop cdr_h3( antibody_in_.cdrh_[3][1], antibody_in_.cdrh_[3][2],
332  cutpoint, 0, false );
333 
334  // Fold Tree
335  simple_one_loop_fold_tree( pose_in, cdr_h3 );
336 
337  // Redefining CDR H3 cutpoint variants
338  loops::add_single_cutpoint_variant( pose_in, cdr_h3 );
339 
340  // score functions
343  create_score_function( "standard", "score12" );
344  scorefxn->set_weight( core::scoring::chainbreak, 1.0 );
345  scorefxn->set_weight( core::scoring::overlap_chainbreak, 10./3. );
346  scorefxn->set_weight( core::scoring::atom_pair_constraint, 1.00 );
347 
348  // add scores to map for outputting constraint score
349  ( *scorefxn )( pose_in );
351  Real constraint_score = score_map_[ "atom_pair_constraint" ];
352 
353  // removing constraint score
354  scorefxn->set_weight( core::scoring::atom_pair_constraint, 0.00 );
355  // add scores to map for output
356  ( *scorefxn )( pose_in );
358 
359  score_map_[ "AA_H3" ] = global_loop_rmsd( pose_in, native_pose_, "h3" );
360  score_map_[ "AB_H2" ] = global_loop_rmsd( pose_in, native_pose_, "h2" );
361  score_map_[ "AB_H1" ] = global_loop_rmsd( pose_in, native_pose_, "h1" );
362  if( !camelid_ ) {
363  score_map_[ "AC_L3" ] = global_loop_rmsd( pose_in, native_pose_, "l3");
364  score_map_[ "AD_L2" ] = global_loop_rmsd( pose_in, native_pose_, "l2");
365  score_map_[ "AE_L1" ] = global_loop_rmsd( pose_in, native_pose_, "l1");
366  }
367  score_map_[ "AF_constraint" ] = constraint_score;
368 
369  //using pose::datacache::CacheableDataType::SCORE_MAP;
370  pose_in.data().set( core::pose::datacache::CacheableDataType::SCORE_MAP, new basic::datacache::
371  DiagnosticData(score_map_));
372 }// end apply
373 
376  return "AntibodyModeler";
377 }
378 
379 void
381  using namespace chemical;
382  using namespace id;
383  using namespace fragment;
384  using namespace core::scoring;
385 
386  if ( !model_h3_ )
387  return;
388 
389  // fragment initialization
391 
393 
394  Size frag_size = (antibody_in_.cdrh_[3][2]-antibody_in_.cdrh_[3][1]) + 3;
395  Size cutpoint = antibody_in_.cdrh_[3][1] + int( frag_size / 2 );
396  setup_simple_fold_tree( antibody_in_.cdrh_[3][1] - 1, cutpoint,
397  antibody_in_.cdrh_[3][2] + 1,
399  antibody_in_.Fv );
400 
401  FragSetOP offset_3mer_frags;
402  // a fragset of same type should be able to handle everything
403  offset_3mer_frags = frag_libs[2]->empty_clone();
404  FrameList loop_3mer_frames;
405  Size offset = 0;
406  frag_libs[2]->region_simple( 1, frag_size, loop_3mer_frames );
407  for ( FrameList::const_iterator it = loop_3mer_frames.begin(),
408  eit = loop_3mer_frames.end(); it!=eit; ++it ) {
409  FrameOP short_frame = (*it)->clone_with_frags();
410  offset++;
411  short_frame->shift_to( ( antibody_in_.cdrh_[3][1] - 2 ) + offset );
412  offset_3mer_frags->add( short_frame );
413  }
414 
415  FragSetOP offset_9mer_frags;
416  // a fragset of same type should be able to handle everything
417  offset_9mer_frags = frag_libs[1]->empty_clone();
418  FrameList loop_9mer_frames;
419  offset = 0;
420  frag_libs[1]->region_simple( 1, frag_size, loop_9mer_frames );
421  for ( FrameList::const_iterator it = loop_9mer_frames.begin(),
422  eit = loop_9mer_frames.end(); it!=eit; ++it ) {
423  FrameOP short_frame = (*it)->clone_with_frags();
424  offset++;
425  short_frame->shift_to( ( antibody_in_.cdrh_[3][1] - 2 ) + offset );
426  offset_9mer_frags->add( short_frame );
427  }
428 
429  offset_frags_.push_back( offset_9mer_frags );
430  offset_frags_.push_back( offset_3mer_frags );
431 
432  return;
433 } // read_and_store_fragments
434 
435 void
437  Size jumppoint1,
438  Size cutpoint,
439  Size jumppoint2,
440  Size nres,
441  pose::Pose & pose_in ) {
442 
443  using namespace kinematics;
444 
445  TR << "ABM Setting up simple fold tree" << std::endl;
446 
447  FoldTree f;
448  f.clear();
449 
450  f.add_edge( 1, jumppoint1, Edge::PEPTIDE );
451  f.add_edge( jumppoint1, cutpoint, Edge::PEPTIDE );
452  f.add_edge( cutpoint + 1, jumppoint2, Edge::PEPTIDE );
453  f.add_edge( jumppoint2, nres, Edge::PEPTIDE );
454  f.add_edge( jumppoint1, jumppoint2, 1 );
455  f.reorder( 1 );
456 
457  pose_in.fold_tree( f );
458 
459  TR << "ABM Done: Setting up simple fold tree" << std::endl;
460 
461 } // setup_simple_fold_tree
462 
463 ///////////////////////////////////////////////////////////////////////////
464 /// @begin relax_cdrs
465 ///
466 /// @brief relaxes all cdrs simultaneously
467 ///
468 /// @detailed based on the all_cdrs loop definiton, minimizes only those
469 /// regions. A standard dfpmin is utilized with score12 and chain
470 /// -break and chain-overlap set. The allow_bb/chi arrays are
471 /// changed accordingly but then are reset to their initial
472 /// states before exiting the routine. Similarly the fold tree
473 /// and jump movements are restored to their initial states
474 ///
475 /// @param[out]
476 ///
477 /// @global_read
478 ///
479 /// @global_write
480 ///
481 /// @remarks
482 ///
483 /// @references
484 ///
485 /// @authors Aroop 02/15/2010
486 ///
487 /// @last_modified 02/15/2010
488 ///////////////////////////////////////////////////////////////////////////
489 void
491 {
492  using namespace pack;
493  using namespace pack::task;
494  using namespace pack::task::operation;
495  using namespace protocols;
496  using namespace protocols::toolbox::task_operations;
497  using namespace protocols::moves;
498  // Storing initial fold tree
499  kinematics::FoldTree const input_tree( antibody_in_.Fv.fold_tree() );
500 
501  // changing to all cdr fold tree
503 
504  // adding cutpoint variants for chainbreak score computation
506 
507  Size const nres = antibody_in_.Fv.total_residue();
508 
509  //setting MoveMap
510  kinematics::MoveMapOP allcdr_map;
511  allcdr_map = new kinematics::MoveMap();
512  allcdr_map->clear();
513  allcdr_map->set_chi( false );
514  allcdr_map->set_bb( false );
515  utility::vector1< bool> is_flexible( nres, false );
516  bool include_neighbors( false );
518  include_neighbors, is_flexible );
519  allcdr_map->set_bb( is_flexible );
520  include_neighbors = true;
522  include_neighbors, is_flexible );
523  allcdr_map->set_chi( is_flexible );
524  for( Size ii = 1; ii <= antibody_in_.all_cdr_loops.num_loop(); ii++ )
525  allcdr_map->set_jump( ii, false );
526 
527  // score functions
530  create_score_function( "standard", "score12" );
531  scorefxn->set_weight( core::scoring::chainbreak, 10. / 3. );
532  scorefxn->set_weight( core::scoring::overlap_chainbreak, 10. / 3. );
533 
534  Real min_tolerance = 0.1;
535  if( benchmark_ ) min_tolerance = 1.0;
536  std::string min_type = std::string( "dfpmin_armijo_nonmonotone" );
537  bool nb_list = true;
539  scorefxn, min_type, min_tolerance, nb_list );
540  all_cdr_min_mover->apply( antibody_in_.Fv );
541 
542  if( !benchmark_ ) {
545  ( *scorefxn )( antibody_in_.Fv );
546  tf_->push_back( new RestrictToInterface( is_flexible ) );
547  repack->task_factory( tf_ );
548  repack->apply( antibody_in_.Fv );
549 
551  scorefxn, tf_ );
552  rtmin->apply( antibody_in_.Fv );
553  }
554 
555  // Restoring pose fold tree
556  antibody_in_.Fv.fold_tree( input_tree );
557 
558  return;
559 } // relax_cdrs
560 
561 ///////////////////////////////////////////////////////////////////////////
562 /// @begin all_cdr_VL_VH_fold_tree
563 ///
564 /// @brief change to all CDR and VL-VH dock fold tree
565 ///
566 /// @detailed
567 ///
568 /// @param[out]
569 ///
570 /// @global_read
571 ///
572 /// @global_write
573 ///
574 /// @remarks
575 ///
576 /// @references
577 ///
578 /// @authors Aroop 07/13/2010
579 ///
580 /// @last_modified 07/13/2010
581 ///////////////////////////////////////////////////////////////////////////
582 void
584  pose::Pose & pose_in,
585  const loops::Loops & loops_in ) {
586 
587  using namespace kinematics;
588 
589  Size nres = pose_in.total_residue();
590  core::pose::PDBInfoCOP pdb_info = pose_in.pdb_info();
591  char second_chain = 'H';
592  Size rb_cutpoint(0);
593 
594  for ( Size i = 1; i <= nres; ++i ) {
595  if( pdb_info->chain( i ) == second_chain) {
596  rb_cutpoint = i-1;
597  break;
598  }
599  }
600 
601  Size jump_pos1 ( geometry::residue_center_of_mass( pose_in, 1,
602  rb_cutpoint ) );
603  Size jump_pos2 ( geometry::residue_center_of_mass( pose_in,rb_cutpoint+1,
604  nres ) );
605 
606  // make sure rb jumps do not reside in the loop region
607  for( loops::Loops::const_iterator it= loops_in.begin(),
608  it_end = loops_in.end(); it != it_end; ++it ) {
609  if ( jump_pos1 >= ( it->start() - 1 ) &&
610  jump_pos1 <= ( it->stop() + 1) )
611  jump_pos1 = it->stop() + 2;
612  if ( jump_pos2 >= ( it->start() - 1 ) &&
613  jump_pos2 <= ( it->stop() + 1) )
614  jump_pos2 = it->start() - 2;
615  }
616 
617  // make a simple rigid-body jump first
618  setup_simple_fold_tree(jump_pos1,rb_cutpoint,jump_pos2,nres, pose_in );
619 
620  // add the loop jump into the current tree,
621  // delete some old edge accordingly
622  FoldTree f( pose_in.fold_tree() );
623 
624  for( loops::Loops::const_iterator it=loops_in.begin(),
625  it_end=loops_in.end(); it != it_end; ++it ) {
626  Size const loop_start ( it->start() );
627  Size const loop_stop ( it->stop() );
628  Size const loop_cutpoint ( it->cut() );
629  Size edge_start(0), edge_stop(0);
630  //bool edge_found = false;
631  const FoldTree & f_const = f;
632  Size const num_jump = f_const.num_jump();
633  for( FoldTree::const_iterator it2=f_const.begin(),
634  it2_end=f_const.end(); it2 !=it2_end; ++it2 ) {
635  edge_start = std::min( it2->start(), it2->stop() );
636  edge_stop = std::max( it2->start(), it2->stop() );
637  if ( ! it2->is_jump() && loop_start > edge_start
638  && loop_stop < edge_stop ) {
639  //edge_found = true; // set but never used ~Labonte
640  goto L100;
641  }
642  }
643 
644 
645  L100:
646  f.delete_unordered_edge( edge_start, edge_stop, Edge::PEPTIDE);
647  f.add_edge( loop_start-1, loop_stop+1, num_jump+1 );
648  f.add_edge( edge_start, loop_start-1, Edge::PEPTIDE );
649  f.add_edge( loop_start-1, loop_cutpoint, Edge::PEPTIDE );
650  f.add_edge( loop_cutpoint+1, loop_stop+1, Edge::PEPTIDE );
651  f.add_edge( loop_stop+1, edge_stop, Edge::PEPTIDE );
652  }
653 
654  f.reorder(1);
655  pose_in.fold_tree(f);
656 
657  return;
658 
659 } // all_cdr_VL_VH_fold_tree
660 
661 ///////////////////////////////////////////////////////////////////////////
662 /// @begin repulsive_ramp
663 ///
664 /// @brief ramping up the fullatom repulsive weight slowly to allow the
665 /// partners to relieve clashes and make way for each other
666 ///
667 /// @detailed This routine is specially targetted to the coupled
668 /// optimization of docking partners and the loop region. The
669 /// loop modelling & all previous steps involve mainly
670 /// centroid mode .On switching on fullatom mode, one is bound
671 /// to end up with clashes.To relieve the clashes, it is
672 /// essential to slowly dial up the repulsive weight instead of
673 /// turning it on to the maximum value in one single step
674 ///
675 /// @param[in] input pose which is assumed to have a docking fold tree
676 ///
677 /// @global_read fa_rep : fullatom repulsive weight
678 ///
679 /// @global_write fa_rep ( It is reset to the original value at the end )
680 ///
681 /// @remarks A particular portion is commented out,which can be
682 /// uncommented if one uses a low resolution homology model.
683 /// Check details in the beginning of the commented out region
684 ///
685 /// @references
686 ///
687 /// @authors Aroop 07/13/2010
688 ///
689 /// @last_modified 07/13/2010
690 ///////////////////////////////////////////////////////////////////////////
691 void
693  pose::Pose & pose_in,
694  loops::Loops loops_in ) {
695 
696  Size nres = pose_in.total_residue();
697 
698  //setting MoveMap
699  kinematics::MoveMapOP cdr_dock_map;
700  cdr_dock_map = new kinematics::MoveMap();
701  cdr_dock_map->clear();
702  cdr_dock_map->set_chi( false );
703  cdr_dock_map->set_bb( false );
704  utility::vector1< bool> is_flexible( nres, false );
705  bool include_neighbors( false );
706  select_loop_residues( pose_in, loops_in, include_neighbors, is_flexible);
707  cdr_dock_map->set_bb( is_flexible );
708  include_neighbors = true;
709  select_loop_residues( pose_in, loops_in, include_neighbors, is_flexible);
710  cdr_dock_map->set_chi( is_flexible );
711  cdr_dock_map->set_jump( 1, true );
712  for( Size ii = 2; ii <= loops_in.num_loop() + 1; ii++ )
713  cdr_dock_map->set_jump( ii, false );
714 
715 
716  // score functions
719  create_score_function( "docking", "docking_min" );
720  scorefxn->set_weight( core::scoring::chainbreak, 1.0 );
721  scorefxn->set_weight( core::scoring::overlap_chainbreak, 10./3. );
722 
723  // score functions
724  core::scoring::ScoreFunctionOP pack_scorefxn;
726  create_score_function( "standard" );
727 
728  // remove cutpoints variants for all cdrs
729  // "true" forces removal of variants even from non-cutpoints
730  loops::remove_cutpoint_variants( pose_in, true );
731 
732  using namespace core::chemical;
733  for ( loops::Loops::const_iterator it = loops_in.begin(),
734  it_end = loops_in.end(); it != it_end; ++it ) {
737  }
738  // add scores to map
739  ( *scorefxn )( pose_in );
740 
741  // dampen fa_rep weight
742  Real rep_weight_max = scorefxn->get_weight( core::scoring::fa_rep );
743  Size rep_ramp_cycles(3);
744  Size cycles(4);
745  Real minimization_threshold(15.0);
746  //Real func_tol(1.0);
747  //mjo commenting out 'nb_list' because it is unused and causes a warning
748  //bool nb_list( true );
749  if( benchmark_ ) {
750  rep_ramp_cycles = 1;
751  cycles = 1;
752  minimization_threshold = 150.0;
753  //func_tol = 10.0; // set but never used ~Labonte
754  }
755 
756  Real rep_ramp_step = (rep_weight_max - 0.02) / Real(rep_ramp_cycles-1);
757  for ( Size i = 1; i <= rep_ramp_cycles; i++ ) {
758  Real rep_weight = 0.02 + rep_ramp_step * Real(i-1);
759  scorefxn->set_weight( core::scoring::fa_rep, rep_weight );
760  snugfit_MC_min ( pose_in, cdr_dock_map, cycles, minimization_threshold,
761  scorefxn, pack_scorefxn, is_flexible);
762  }
763 
764  return;
765 } // repulsive_ramp
766 
767 void
769  pose::Pose & pose_in,
770  kinematics::MoveMapOP cdr_dock_map,
771  Size cycles,
772  Real minimization_threshold,
774  core::scoring::ScoreFunctionOP pack_scorefxn,
775  utility::vector1< bool> is_flexible ) {
776 
777  using namespace moves;
778  bool nb_list = true;
779  Size nres = pose_in.total_residue();
780 
781  protocols::simple_moves::MinMoverOP min_mover = new protocols::simple_moves::MinMover( cdr_dock_map, scorefxn,
782  "dfpmin_armijo_nonmonotone", minimization_threshold, nb_list );
783 
784  //set up rigid body movers
786  *cdr_dock_map, 2.0, 0.1 , rigid::partner_downstream, true );
787 
788  setup_packer_task( pose_in );
789  //set up sidechain movers for rigid body jump and loop & neighbors
790  utility::vector1_size rb_jump;
791  rb_jump.push_back( 1 );
792  using namespace core::pack::task;
793  using namespace core::pack::task::operation;
794  // selecting movable c-terminal residues
795  ObjexxFCL::FArray1D_bool loop_residues( nres, false );
796  for( Size i = 1; i <= nres; i++ )
797  loop_residues( i ) = is_flexible[ i ]; // check mapping
798  using namespace protocols::toolbox::task_operations;
799  tf_->push_back( new RestrictToInterface( rb_jump, loop_residues ) );
800 
802  pack_scorefxn, tf_ );
803  SequenceMoverOP rb_mover = new SequenceMover;
804  rb_mover->add_mover( rb_perturb );
805  rb_mover->add_mover( pack_rottrial );
806  JumpOutMoverOP rb_mover_min = new JumpOutMover( rb_mover, min_mover,
807  scorefxn, minimization_threshold );
808 
809  Real temperature = 0.8;
810  MonteCarloOP mc = new MonteCarlo( pose_in, *scorefxn, temperature );
811  TrialMoverOP rb_mover_min_trial = new TrialMover( rb_mover_min, mc);
812  RepeatMoverOP first_mcm_cycles = new RepeatMover( rb_mover_min_trial,
813  cycles );
814  first_mcm_cycles->apply( pose_in );
815 
816  return;
817 
818 } // snugfit_MC_min
819 
820 void
822  pose::Pose & pose_in,
823  loops::Loops loops_in ) {
824 
825  using namespace moves;
826  bool nb_list = true;
827  Size nres = pose_in.total_residue();
828 
829  //MC move
830  Real trans_mag ( 0.1 );
831  Real rot_mag ( 5.0 );
832 
833  // rb minimization
834  std::string min_type = "dfpmin_armijo_nonmonotone";
835  Real min_threshold ( 15.0 ); /* score unit */
836 
837  // score functions
838  using namespace core::scoring;
841  create_score_function( "docking", "docking_min" );
842  scorefxn->set_weight( core::scoring::chainbreak, 1.0 );
843  scorefxn->set_weight( core::scoring::overlap_chainbreak, 10./3. );
844 
845  // score functions
846  core::scoring::ScoreFunctionOP pack_scorefxn;
848  create_score_function( "standard" );
849 
850  // remove cutpoints variants for all cdrs
851  // "true" forces removal of variants even from non-cutpoints
852  loops::remove_cutpoint_variants( pose_in, true );
853 
854  using namespace core::chemical;
855  for ( loops::Loops::const_iterator it = loops_in.begin(),
856  it_end = loops_in.end(); it != it_end; ++it ) {
859  }
860 
861  //setting MoveMap
862  kinematics::MoveMapOP cdr_dock_map;
863  cdr_dock_map = new kinematics::MoveMap();
864  cdr_dock_map->clear();
865  cdr_dock_map->set_chi( false );
866  cdr_dock_map->set_bb( false );
867  utility::vector1< bool> is_flexible( nres, false );
868  bool include_neighbors( false );
869  select_loop_residues( pose_in, loops_in, include_neighbors, is_flexible);
870  cdr_dock_map->set_bb( is_flexible );
871  include_neighbors = true;
872  select_loop_residues( pose_in, loops_in, include_neighbors, is_flexible);
873  cdr_dock_map->set_chi( is_flexible );
874  cdr_dock_map->set_jump( 1, true );
875  for( Size ii = 2; ii <= loops_in.num_loop() + 1; ii++ )
876  cdr_dock_map->set_jump( ii, false );
877 
878 
879  //set up minimizer movers
880  protocols::simple_moves::MinMoverOP min_mover = new protocols::simple_moves::MinMover( cdr_dock_map, scorefxn, min_type,
881  min_threshold, nb_list );
882 
883  //set up rigid body movers
885  *cdr_dock_map, rot_mag, trans_mag, rigid::partner_downstream, true );
886 
887  setup_packer_task( pose_in );
888  //set up sidechain movers for rigid body jump and loop & neighbors
889  utility::vector1_size rb_jump;
890  rb_jump.push_back( 1 );
891  using namespace core::pack::task;
892  using namespace core::pack::task::operation;
893  // selecting movable c-terminal residues
894  ObjexxFCL::FArray1D_bool loop_residues( nres, false );
895  for( Size i = 1; i <= nres; i++ )
896  loop_residues( i ) = is_flexible[ i ]; // check mapping
897  using namespace protocols::toolbox::task_operations;
898  tf_->push_back( new RestrictToInterface( rb_jump, loop_residues ) );
899 
900 
901 
903  pack_scorefxn, tf_ );
904 
906  pack_scorefxn );
907  pack_interface_repack->task_factory(tf_);
908 
909  Real temperature = 0.8;
910  MonteCarloOP mc = new MonteCarlo( pose_in, *scorefxn, temperature );
911 
912  TrialMoverOP pack_interface_trial = new TrialMover(pack_interface_repack,
913  mc );
914 
917  TrialMoverOP scmin_trial = new TrialMover( scmin_mover, mc );
918 
919  SequenceMoverOP rb_mover = new SequenceMover;
920  rb_mover->add_mover( rb_perturb );
921  rb_mover->add_mover( pack_rottrial );
922 
923  JumpOutMoverOP rb_mover_min = new JumpOutMover( rb_mover, min_mover,
924  scorefxn, min_threshold);
925  TrialMoverOP rb_mover_min_trial = new TrialMover( rb_mover_min, mc );
926 
927  SequenceMoverOP repack_step = new SequenceMover;
928  repack_step->add_mover( rb_mover_min_trial );
929  repack_step->add_mover( pack_interface_trial );
930  repack_step->add_mover( scmin_trial );
931 
932  CycleMoverOP rb_mover_min_trial_repack = new CycleMover;
933  for ( Size i=1; i < 8; ++i )
934  rb_mover_min_trial_repack->add_mover( rb_mover_min_trial );
935  rb_mover_min_trial_repack->add_mover( repack_step );
936 
937  //set up initial repack mover
938  SequenceMoverOP initial_repack = new SequenceMover;
939  initial_repack->add_mover( pack_interface_trial );
940  initial_repack->add_mover( scmin_trial );
941 
942  //set up initial and final min_trial movers for docking
943  TrialMoverOP minimize_trial = new TrialMover( min_mover, mc );
944 
945  //set up mcm cycles and mcm_repack cycles
946  RepeatMoverOP mcm_four_cycles = new RepeatMover( rb_mover_min_trial, 4 );
947 
948  Size cycles = 3;
949  if ( benchmark_ )
950  cycles = 1;
951  RepeatMoverOP mcm_final_cycles = new RepeatMover(
952  rb_mover_min_trial_repack, cycles );
953 
954  SequenceMoverOP snugfit_mcm = new SequenceMover;
955  snugfit_mcm->add_mover( initial_repack );
956  snugfit_mcm->add_mover( minimize_trial );
957  snugfit_mcm->add_mover( mcm_four_cycles );
958  snugfit_mcm->add_mover( mcm_final_cycles );
959  snugfit_mcm->add_mover( minimize_trial );
960 
961  snugfit_mcm->apply ( pose_in );
962 
963  return;
964 } // snugfit_mcm_protocol
965 
966 void
968  pose::Pose & pose_in ) {
969  using namespace pack::task;
970  using namespace pack::task::operation;
971 
972  if( init_task_factory_ ) {
974  TR << "AbModeler Reinitializing Packer Task" << std::endl;
975  return;
976  }
977  else
978  tf_ = new TaskFactory;
979 
980  TR << "AbModeler Setting Up Packer Task" << std::endl;
981 
982  tf_->push_back( new OperateOnCertainResidues( new PreventRepackingRLT,
983  new ResidueLacksProperty("PROTEIN") ) );
984  tf_->push_back( new InitializeFromCommandline );
985  tf_->push_back( new IncludeCurrent );
986  tf_->push_back( new RestrictToRepacking );
987  tf_->push_back( new NoRepackDisulfides );
988 
989  // incorporating Ian's UnboundRotamer operation.
990  // note that nothing happens if unboundrot option is inactive!
993  unboundrot->initialize_from_command_line();
994  operation::AppendRotamerSetOP unboundrot_operation =
995  new operation::AppendRotamerSet( unboundrot );
996  tf_->push_back( unboundrot_operation );
997  // adds scoring bonuses for the "unbound" rotamers, if any
999 
1001 
1002  TR << "AbModeler Done: Setting Up Packer Task" << std::endl;
1003 
1004 } // setup_packer_task
1005 
1006 Real
1008  const pose::Pose & pose_in,
1009  const pose::Pose & native_pose,
1010  std::string cdr_type
1011 ) {
1012 
1013  using namespace scoring;
1014 
1015  Size loop_start( 1 );
1016  Size loop_end( antibody_in_.Fv.total_residue() );
1017  if( cdr_type == "l1" ) {
1018  loop_start = antibody_in_.cdrl_[1][1];
1019  loop_end = antibody_in_.cdrl_[1][2];
1020  } else if( cdr_type == "l2" ) {
1021  loop_start = antibody_in_.cdrl_[2][1];
1022  loop_end = antibody_in_.cdrl_[2][2];
1023  } else if( cdr_type == "l3" ) {
1024  loop_start = antibody_in_.cdrl_[3][1];
1025  loop_end = antibody_in_.cdrl_[3][2];
1026  } else if( cdr_type == "h1" ) {
1027  loop_start = antibody_in_.cdrh_[1][1];
1028  loop_end = antibody_in_.cdrh_[1][2];
1029  } else if( cdr_type == "h2" ) {
1030  loop_start = antibody_in_.cdrh_[2][1];
1031  loop_end = antibody_in_.cdrh_[2][2];
1032  } else if( cdr_type == "h3" ) {
1033  loop_start = antibody_in_.cdrh_[3][1];
1034  loop_end = antibody_in_.cdrh_[3][2];
1035  }
1036 
1037  using ObjexxFCL::FArray1D_bool;
1038  FArray1D_bool superpos_partner ( pose_in.total_residue(), false );
1039 
1040  for ( Size i = loop_start; i <= loop_end; ++i )
1041  superpos_partner(i) = true;
1042 
1043  using namespace core::scoring;
1044  Real rmsG = rmsd_no_super_subset( native_pose, pose_in,
1045  superpos_partner, is_protein_CA );
1046  return ( rmsG );
1047 } // global_loop_rmsd
1048 
1049 void
1051 
1052  // Detecting di-sulfide bond
1053 
1054  Size H1_Cys(0), H3_Cys(0);
1055 
1056  if( antibody_in_.Fv.residue( antibody_in_.Fv.pdb_info()->pdb2pose( 'H',
1057  32 ) ).name3() == "CYS" )
1058  H1_Cys = antibody_in_.Fv.pdb_info()->pdb2pose( 'H', 32 );
1059  else if( antibody_in_.Fv.residue( antibody_in_.Fv.pdb_info()->pdb2pose(
1060  'H', 33 ) ).name3() == "CYS" )
1061  H1_Cys = antibody_in_.Fv.pdb_info()->pdb2pose( 'H', 33 );
1062 
1063  for( Size ii = antibody_in_.cdrh_[3][1]; ii <= antibody_in_.cdrh_[3][2];
1064  ii++ )
1065  if( antibody_in_.Fv.residue(ii).name3() == "CYS" )
1066  H3_Cys = ii;
1067 
1068  if( ( H1_Cys != 0 ) && ( H3_Cys != 0 ) )
1069  TR << "CONSTRAINTS: "
1070  << "AtomPair CA " << H1_Cys << " CA " << H3_Cys
1071  << " BOUNDED 4.0 6.1 0.6 BOND; mean 5.6 sd 0.6" << std::endl;
1072 
1073  // Specifying extended kink
1074 
1075  Size hfr_46(0), h3_closest(0);
1076  hfr_46 = antibody_in_.Fv.pdb_info()->pdb2pose( 'H', 46 );
1077  if( antibody_in_.extended_ )
1078  h3_closest = antibody_in_.cdrh_[3][2] - 5;
1079  if( h3_closest != 0 )
1080  TR << "CONSTRAINTS: "
1081  << "AtomPair CA " << hfr_46 << " CA " << h3_closest
1082  << " BOUNDED 6.5 9.1 0.7 DISTANCE; mean 8.0 sd 0.7" << std::endl;
1083 
1084  return;
1085 } // display_constraint_residues
1086 
1087 
1088 
1089 } // end antibody
1090 } // end protocols
1091