Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RRProtocolReferenceStructure.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 src/protocols/rotamer_recovery/RRProtocolReferenceStructure.cc
11 /// @brief Preform the rotamer recovery against a reference structure
12 /// @author Matthew O'Meara (mattjomeara@gmail.com)
13 
14 // Unit Headers
16 
17 // Project Headers
20 
21 // Platform Headers
22 #include <basic/Tracer.hh>
24 #include <core/pose/Pose.hh>
26 #include <basic/resource_manager/ResourceManager.hh>
27 #include <basic/resource_manager/util.hh>
28 
29 // Utility Headers
30 #include <utility/exit.hh>
31 #include <utility/vector1.hh>
32 
33 // C++ Headers
34 #include <string>
35 #include <sstream>
36 
37 using std::string;
38 using std::stringstream;
39 using core::Size;
40 using core::pose::Pose;
44 using basic::Tracer;
45 
46 namespace protocols {
47 namespace rotamer_recovery {
48 
49 static Tracer TR("protocol.rotamer_recovery.RRProtocolReferenceStructure");
50 
52  reference_pose_(NULL)
53 {}
54 
56  PoseCOP reference_pose
57 ) :
58  reference_pose_(reference_pose)
59 {}
60 
62  RRProtocol(),
63  reference_pose_(src.reference_pose_)
64 {}
65 
67 
68 string
70  return "RRProtocolReferenceStructure";
71 }
72 
73 string
75  return "";
76 }
77 
78 void
80  PoseCOP reference_pose){
81  reference_pose_ = reference_pose;
82 }
83 
84 /// @details measure rotamer recovery for each residue
85 void
87  RRComparerOP comparer,
88  RRReporterOP reporter,
89  Pose const & pose,
90  ScoreFunction const &,
91  PackerTask const & packer_task
92 ) {
93  // Assume score_function.setup_for_scoring(pose) has already been called.
94 
95  using namespace basic::resource_manager;
96 
97  if(!reference_pose_){
98  if(ResourceManager::get_instance()->
99  has_resource_with_description("native")){
100  reference_pose_ = get_resource< Pose >("native");
101  } else {
102  stringstream err_msg;
103  err_msg
104  << "Attempting to run the Rotamer Recovery against a Reference Structure, "
105  << "but no pose with resource decription could be found.";
106  utility_exit_with_message(err_msg.str());
107  }
108  }
109 
110 
111  if(pose.total_residue() != reference_pose_->total_residue()){
112  stringstream err_msg;
113  err_msg
114  << "Attempting to run the Rotamer Recovery against Reference Structure protocol, "
115  << "but the saved structure has a different number of residues.";
116  utility_exit_with_message(err_msg.str());
117  }
118 
119  for(Size ii = 1; ii <= pose.total_residue(); ++ii){
120  if (!packer_task.pack_residue(ii)) continue;
122  comparer, reporter,
123  pose, *reference_pose_,
124  pose.residue(ii), reference_pose_->residue(ii) );
125  }
126 }
127 
128 } // rotamer_recovery
129 } // protocols