Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RRComparerAutomorphicRMSD.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/RRComparerAutomorphicRMSD.cc
11 /// @author Matthew O'Meara (mattjomeara@gmail.com)
12 /// Adapted from:
13 /// and apps/pilot/chrisk/rotamer_repack.cc (Chris King)
14 
15 
16 // Unit Headers
19 
20 // Project Headers
23 #include <core/chemical/AA.hh>
24 
28 #include <core/scoring/rms_util.hh>
29 #include <basic/Tracer.hh>
30 
31 // C++ Headers
32 #include <string>
33 #include <sstream>
34 
35 #include <core/pose/Pose.hh>
36 #include <utility/vector1.hh>
37 
38 
39 using std::string;
40 using std::stringstream;
41 using std::endl;
42 using core::Size;
43 using core::Real;
51 using core::pose::Pose;
53 using basic::Tracer;
54 
55 namespace protocols {
56 namespace rotamer_recovery {
57 
58 static Tracer TR("protocol.moves.RRComparerAutomorphicRMSD");
59 
61  include_backbone_atoms_( false ),
62  recovery_threshold_( .05 )
63 {}
64 
66  RRComparer(),
67  include_backbone_atoms_( src.include_backbone_atoms_ ),
68  recovery_threshold_( src.recovery_threshold_ )
69 {}
70 
72 
73 bool
75  Pose const & pose1,
76  Pose const & pose2,
77  Residue const & res1,
78  Residue const & res2,
79  Real & score,
80  bool & recovered
81 ) {
82 
83  if( res1.aa() != res2.aa() || res1.nheavyatoms() != res2.nheavyatoms()) {
84  TR << "Cannot measure rotamer recovery of residue " << res1.seqpos() << " because" << endl;
85  TR << "\nresidue 1 has type '" << res1.type().name() << "'" << endl;
86  TR << "\nresidue 2 has type '" << res2.type().name() << "'" << endl;
87  TR << "\nMake sure the protocol to generate the conformations did not 'design' the sequence identity too." << endl;
88  score = -1; recovered = false; return false;
89  }
90 
91  // TODO: Can this restriction be relaxed? What about using 'is_polymer()'?
92  if( res1.aa() > num_canonical_aas ){
93  TR << "WARNING: trying to compare rotamer bins for non-canonical amino acid '" << res1.name() << "'" << endl;
94  score = -1; recovered = false; return false;
95  }
96 
98  score = automorphic_rmsd( res1, res2, false /*superimpose*/ );
99  recovered = (score <= get_recovery_threshold() );
100  } else {
101  ResidueTypeSet const & res1_set( res1.residue_type_set() );
102  ResidueType const & working_res1_type(
103  res1_set.get_residue_type_with_variant_added( res1.type(), "VIRTUAL_BB" ) );
104  ResidueOP working_res1 = ResidueFactory::create_residue( working_res1_type );
106  res1, *working_res1, pose1.conformation() );
107 
108  ResidueTypeSet const & res2_set( res2.residue_type_set() );
109  ResidueType const & working_res2_type(
110  res2_set.get_residue_type_with_variant_added( res2.type(), "VIRTUAL_BB" ) );
111  ResidueOP working_res2 = ResidueFactory::create_residue( working_res2_type );
113  res2, *working_res2, pose2.conformation() );
114 
115  score = automorphic_rmsd(*working_res1, *working_res2, false /*superimpose*/);
116  recovered = (score <= get_recovery_threshold() );
117  }
118  return true;
119 }
120 
121 string
123  return "RRComparerAutomorphicRMSD";
124 }
125 
126 string
128  stringstream ret;
129  ret << "include_backbone_atoms:" << get_include_backbone_atoms()
130  << ",recovery_threshold:" << get_recovery_threshold();
131  return ret.str();
132 }
133 
134 void
136  bool const include_backbone_atoms
137 ) {
138  include_backbone_atoms_ = include_backbone_atoms;
139 }
140 
141 bool
144 }
145 
146 void
148  Real const recovery_threshold
149 ) {
150  recovery_threshold_ = recovery_threshold;
151 }
152 
153 Real
155  return recovery_threshold_;
156 }
157 
158 } // rotamer_recovery
159 } // protocols