Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
InterfaceRecapitulationMover.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/protein_interface_design/DesignRepackMover.cc
11 /// @brief
12 /// @author Sarel Fleishman (sarelf@u.washington.edu), Jacob Corn (jecorn@u.washington.edu)
13 
14 // Unit headers
17 
18 // Package headers
21 
22 // Project Headers
23 #include <core/types.hh>
24 #include <core/pose/Pose.hh>
26 
31 #include <protocols/moves/Mover.hh>
33 #include <utility/tag/Tag.hh>
34 
35 #include <basic/Tracer.hh>
36 
37 // Utility Headers
38 
39 // Unit Headers
40 
41 // C++ headers
42 #include <map>
43 #include <string>
44 
45 #include <protocols/jd2/Job.hh>
46 #include <utility/vector0.hh>
47 #include <utility/vector1.hh>
48 
49 //Auto Headers
50 #include <utility/excn/Exceptions.hh>
52 
53 
54 
55 using namespace core;
56 
57 // option key includes
58 
59 using namespace core::scoring;
60 
61 static basic::Tracer TR( "protocols.protein_interface_design.movers.InterfaceRecapitulationMover" );
62 
63 
64 namespace protocols {
65 namespace protein_interface_design {
66 namespace movers {
67 
68 using namespace protocols::moves;
69 
71 InterfaceRecapitulationMoverCreator::keyname() const
72 {
73  return InterfaceRecapitulationMoverCreator::mover_name();
74 }
75 
77 InterfaceRecapitulationMoverCreator::create_mover() const {
79 }
80 
82 InterfaceRecapitulationMoverCreator::mover_name()
83 {
84  return "InterfaceRecapitulation";
85 }
86 
87 InterfaceRecapitulationMover::InterfaceRecapitulationMover() :
89  saved_pose_( NULL ),
90  design_mover_( NULL ),
91  design_mover2_( NULL ),
92  pssm_( false )
93  {}
94 
95 MoverOP
97 { return MoverOP( new InterfaceRecapitulationMover( *this ) ); }
98 
99 MoverOP
102 
105 {
106  return saved_pose_;
107 }
108 
109 void
111 {
112  saved_pose_ = pose;
113 }
114 
116 
117 void
119  runtime_assert( saved_pose_ );
120  runtime_assert( design_mover_ || design_mover2_ );
122  if( design_mover_ ){
123  design_mover_->apply( pose );
124  task = design_mover_->task();
125  }
126  else{
127  design_mover2_->apply( pose );
128  task = design_mover2_->task();
129  }
130  core::Size designable_positions( 0 );
131  for( Size i( 1 ); i<= pose.total_residue(); ++i )
132  if( task->being_designed( i ) ) ++designable_positions;
133 
136  if ( pssm_ && !rsd.load_pssm_data( jd->current_job()->input_tag() ) ){
137  pssm_ = false;
138  }
139 
140  if (!pssm_){
142  rsd.calculate( *get_reference_pose(), pose );
143  std::map< core::Size, std::string > const res_names1( rsd.res_name1() );
144  core::Size const mutated( res_names1.size() );
145  core::Real const rate( (core::Real) mutated / designable_positions );
146  TR<<"Your design mover mutated "<<mutated<<" positions out of "<<designable_positions<<" designable positions. Sequence recovery is: "<<1-rate<<std::endl;
147  }
148  else{
149  core::Real pssm = rsd.calculate( *get_reference_pose(), pose, task );
150  TR << "PSSM-Score: " << pssm << " at " << designable_positions << " designable positions. Mean score is " << pssm / (core::Real)designable_positions << std::endl;
151  }
152 
153 }
154 
158 }
159 
160 void
162  set_reference_pose( new core::pose::Pose( pose ) );
163  std::string const mover_name( tag->getOption<std::string>( "mover_name" ) );
164  std::map< std::string const, MoverOP >::const_iterator find_mover( movers.find( mover_name ));
165  bool const mover_found( find_mover != movers.end() );
166  if( mover_found ){
167  design_mover_ = dynamic_cast< simple_moves::DesignRepackMover * >( find_mover->second() );
168  if( !design_mover_ ){
169  design_mover2_ = dynamic_cast< protocols::simple_moves::PackRotamersMover * >( find_mover->second() );
170  if( !design_mover2_ )
171  throw utility::excn::EXCN_RosettaScriptsOption( "dynamic cast failed in tag in RecapitulateMover. Make sure that the mover is either PackRotamers or DesignRepackMover derived" );
172  }
173  pssm_ = tag->getOption<bool>( "pssm", false );
174  }
175 }
176 
177 } //movers
178 } //protein_interface_design
179 } //protocols