Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
InterfaceBindingEnergyDensityFilter.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/InterfaceBindingEnergyDensityFilter.cc
11 /// @brief Implementation of the binding-energy-density filter
12 /// @author Andrew Leaver-Fay (aleaverfay@gmail.com)
13 
14 // Unit headers
17 
18 // Package headers
22 
23 // Project headers
24 
25 //#include <core/pose/Pose.hh>
26 //#include <core/id/AtomID_Map.hh>
27 //#include <core/conformation/Residue.hh>
28 //#include <core/chemical/AtomType.hh>
29 //#include <basic/MetricValue.hh>
30 
31 // Project headers
32 #include <core/types.hh>
33 
34 // Utility headers
35 #include <utility/tag/Tag.hh>
36 
37 // Basic headers
38 #include <utility/excn/Exceptions.hh>
39 #include <basic/Tracer.hh>
40 
41 namespace protocols {
42 namespace simple_filters {
43 
44 static basic::Tracer TR( "protocols.simple_filters.InterfaceBindingEnergyDensityFilter" );
45 
48 
50 InterfaceBindingEnergyDensityFilterCreator::keyname() const { return "InterfaceBindingEnergyDensityFilter"; }
51 
52 
54  Filter( "InterfaceBindingEnergyDensityFilter" ),
55  sasa_filter_( 0 ),
56  ddG_filter_( 0 ),
57  upper_threshold_( 0.0 )
58 {}
59 
61  InterfaceSasaFilterOP sasa_filter,
62  DdgFilterOP ddG_filter,
63  core::Real threshold
64 ):
65  Filter( "InterfaceBindingEnergyDensityFilter" ),
66  sasa_filter_( sasa_filter ),
67  ddG_filter_( ddG_filter ),
68  upper_threshold_( threshold )
69 {}
70 
71 
75 
77 
80  return new InterfaceBindingEnergyDensityFilter( *this );
81 }
82 
85  return new InterfaceSasaFilter;
86 }
87 
88 void
90  utility::tag::TagPtr const tag,
92  filters::Filters_map const & filters_map,
93  moves::Movers_map const &,
94  core::pose::Pose const &
95 )
96 {
97  if ( ! tag->hasOption("sasa_filter") ) {
98  throw utility::excn::EXCN_RosettaScriptsOption( "InterfaceBindingEnergyDensityFilter requires the sasa_filter option" );
99  }
100  if ( ! tag->hasOption("ddG_filter") ) {
101  throw utility::excn::EXCN_RosettaScriptsOption( "InterfaceBindingEnergyDensityFilter requires the ddG_filter option" );
102  }
103 
104  std::string sasa_filter_name = tag->getOption< std::string> ("sasa_filter");
105  filters::Filters_map::const_iterator sasaiter = filters_map.find( sasa_filter_name );
106  if ( sasaiter == filters_map.end() ) {
107  throw utility::excn::EXCN_RosettaScriptsOption( "Could not locate requested sasa_filter with name " + sasa_filter_name + " in the Filters_map." );
108  }
109  filters::FilterOP sasafilter_baseptr = sasaiter->second;
110  sasa_filter_ = dynamic_cast< InterfaceSasaFilter * > ( sasafilter_baseptr() );
111  if ( ! sasa_filter_ ) {
112  throw utility::excn::EXCN_RosettaScriptsOption( "Dynamic cast of filter " + sasa_filter_name + " to type InterfaceSasaFilter failed" );
113  }
114 
115  std::string ddG_filter_name = tag->getOption< std::string> ("ddG_filter");
116  filters::Filters_map::const_iterator ddGiter = filters_map.find( ddG_filter_name );
117  if ( ddGiter == filters_map.end() ) {
118  throw utility::excn::EXCN_RosettaScriptsOption( "Could not locate requested ddG_filter with name " + ddG_filter_name + " in the Filters_map." );
119  }
120  filters::FilterOP ddGfilter_baseptr = ddGiter->second;
121  ddG_filter_ = dynamic_cast< DdgFilter * > ( ddGfilter_baseptr() );
122  if ( ! ddG_filter_ ) {
123  throw utility::excn::EXCN_RosettaScriptsOption( "Dynamic cast of filter " + ddG_filter_name + " to type DdgFilter failed" );
124  }
125 
126  upper_threshold_ = tag->getOption< core::Real > ("threshold", -0.015 );
127 
128 }
129 
130 bool
132  core::Real const sasa( sasa_filter_->compute( pose ) );
133  core::Real const ddG( ddG_filter_->compute( pose ) );
134 
135  core::Real const binding_energy_density( ddG / sasa );
136 
137  TR << "SASA is "<<sasa<<". ddG is "<<ddG <<". Ratio is " << binding_energy_density << ". ";
138  if( binding_energy_density <= upper_threshold_ ){
139  TR<<"passing." <<std::endl;
140  return true;
141  }
142  else {
143  TR<<"failing."<<std::endl;
144  return false;
145  }
146 }
147 
148 void
149 InterfaceBindingEnergyDensityFilter::report( std::ostream & out, core::pose::Pose const & pose ) const {
150  core::Real const sasa( sasa_filter_->compute( pose ) );
151  core::Real const ddG( ddG_filter_->compute( pose ) );
152  core::Real const binding_energy_density( ddG / sasa );
153 
154  out << "SASA is "<<sasa<<". ddG is "<<ddG <<". Ratio is " << binding_energy_density << ". ";
155 }
156 
159  core::Real const sasa( sasa_filter_->compute( pose ) );
160  core::Real const ddG( ddG_filter_->compute( pose ) );
161  core::Real const binding_energy_density( ddG / sasa );
162 
163  return binding_energy_density;
164 }
165 
168  core::Real const sasa( sasa_filter_->compute( pose ) );
169  core::Real const ddG( ddG_filter_->compute( pose ) );
170  core::Real const binding_energy_density( ddG / sasa );
171 
172  return binding_energy_density;
173 }
174 
175 }
176 }