Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SidechainRmsdFilter.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/simple_filters/SidechainRmsdFilter.cc
11 /// @brief A filter based on automorphic sidechain RMSD
12 /// @author Noah Ollikainen
13 
16 
17 #include <utility/tag/Tag.hh>
20 #include <core/pose/selection.hh>
25 #include <core/pose/Pose.hh>
29 #include <core/chemical/AA.hh>
30 #include <core/scoring/rms_util.hh>
31 
32 // Utility Headers
33 #include <basic/Tracer.hh>
34 #include <basic/options/option.hh>
35 #include <basic/options/keys/in.OptionKeys.gen.hh>
36 
37 
38 namespace protocols {
39 namespace simple_filters {
40 
41 static basic::Tracer sidechain_rmsd_filter_tracer( "protocols.simple_filters.SidechainRmsdFilter" );
42 
45 
47 SidechainRmsdFilterCreator::keyname() const { return "SidechainRmsd"; }
48 
49 SidechainRmsdFilter::SidechainRmsdFilter() : filters::Filter( "SidechainRmsd" ) {}
50 
51 SidechainRmsdFilter::SidechainRmsdFilter( core::Size const res1, core::Size const res2, core::Real const rmsd_threshold ) :
52  Filter( "SidechainRmsd" ), res1_( res1 ), res2_( res2 ), rmsd_threshold_( rmsd_threshold ) {}
53 
55 
56 void
58 {
59  res1_ = core::pose::get_resnum( tag, pose, "res1_" );
60  res2_ = core::pose::get_resnum( tag, pose, "res2_" );
61  rmsd_threshold_ = tag->getOption<core::Real>("threshold", 1.0);
62  include_backbone_ = tag->getOption<bool>("include_backbone", false);
63 
64  if( tag->hasOption("reference_name") ){
66  }
67  else{
68  reference_pose_ = new core::pose::Pose( pose );
69  if ( basic::options::option[ basic::options::OptionKeys::in::file::native ].user() )
70  core::import_pose::pose_from_pdb( *reference_pose_, basic::options::option[ basic::options::OptionKeys::in::file::native ] );
71  }
72 
73  //residue_distance_filter_tracer<<"ResidueDistanceFilter with distance threshold of "<<distance_threshold_<<" between residues "<<res1_<<" and "<<res2_<<std::endl;
74 }
75 
76 bool
78  core::Real const rmsd( compute( pose ) );
79 
80  sidechain_rmsd_filter_tracer<<"Sidechain RMSD of residue "<<res1_<<" is "<<rmsd<<std::endl;
81  return( rmsd<=rmsd_threshold_ );
82 }
83 
84 void
85 SidechainRmsdFilter::report( std::ostream & out, core::pose::Pose const & pose ) const {
86  core::Real const rmsd( compute( pose ) );
87 
88  out<<"Sidechain RMSD of residue "<<res1_<<" is "<<rmsd<<'\n';
89 }
90 
93  core::Real const rmsd( compute( pose ) );
94 
95  return( rmsd );
96 }
99  core::conformation::Residue const res_res1( pose.conformation().residue( res1_ ) );
100  core::conformation::Residue const res_res2( reference_pose_->conformation().residue( res2_ ) );
101  core::Real rmsd (0.0);
102 
103  // make sure we're comparing the same amino acid type
104  runtime_assert( res_res1.aa() == res_res2.aa() );
105 
106  if( include_backbone_ ){
107  rmsd = core::scoring::automorphic_rmsd( res_res1, res_res2, false /*superimpose*/ );
108  } else {
109  core::chemical::ResidueTypeSet const & res1_set( res_res1.residue_type_set() );
110  core::chemical::ResidueType const & working_res1_type(
111  res1_set.get_residue_type_with_variant_added( res_res1.type(), "VIRTUAL_BB" ) );
112  core::conformation::ResidueOP working_res1 =
115  res_res1, *working_res1, pose.conformation() );
116 
117  core::chemical::ResidueTypeSet const & res2_set( res_res2.residue_type_set() );
118  core::chemical::ResidueType const & working_res2_type(
119  res2_set.get_residue_type_with_variant_added( res_res2.type(), "VIRTUAL_BB" ) );
120  core::conformation::ResidueOP working_res2 =
123  res_res2, *working_res2, reference_pose_->conformation() );
124 
125  rmsd = core::scoring::automorphic_rmsd(*working_res1, *working_res2, false /*superimpose*/);
126  }
127 
128  return( rmsd );
129 }
130 
132  return new SidechainRmsdFilter( *this );
133 }
134 
136  return new SidechainRmsdFilter();
137 }
138 
139 }
140 }