15 #include <boost/lexical_cast.hpp>
16 #include <boost/foreach.hpp>
17 #define foreach BOOST_FOREACH
26 #include <basic/MetricValue.hh>
27 #include <utility/tag/Tag.hh>
30 #include <utility/string_util.hh>
36 #include <utility/excn/Exceptions.hh>
41 namespace simple_filters {
43 static basic::Tracer
TR(
"protocols.simple_filters.InterfaceSasaFilter" );
54 lower_threshold_( 0.0 ),
55 upper_threshold_(100000000000.0),
56 hydrophobic_( false ),
66 lower_threshold_( lower_threshold ),
67 upper_threshold_(upper_threshold),
68 hydrophobic_( hydrophobic ),
73 if (sym_dof_names !=
"")
104 if(specified_jumps !=
"" && specified_sym_dof_names !=
"")
106 TR.Error <<
"Can not specify 'jump' and 'sym_dof_names' in InterfaceSasaFilter" << tag << std::endl;
107 throw utility::excn::EXCN_RosettaScriptsOption(
"Can not specify 'jump' and 'sym_dof_names' in InterfaceSasaFilter" );
109 else if(specified_jumps !=
"")
112 TR.Debug <<
"Reading jump list: " << specified_jumps << std::endl;
117 for(
core::Size i = 1; i <= jump_strings.size(); ++i)
119 jumps_.push_back( boost::lexical_cast<core::Size>(jump_strings[i]));
124 else if(specified_sym_dof_names !=
"")
126 TR.Debug <<
"Reading sym_dof_name list: " << specified_sym_dof_names << std::endl;
129 sym_dof_names_ = utility::string_split( specified_sym_dof_names,
',');
133 TR.Debug <<
"Defaulting to jump 1. " << std::endl;
138 hydrophobic_ = tag->getOption<
bool>(
"hydrophobic", false );
139 polar_ = tag->getOption<
bool>(
"polar", false );
143 TR.Error <<
"Polar and hydrophobic flags specified in Sasa filter: " << tag << std::endl;
144 throw utility::excn::EXCN_RosettaScriptsOption(
"Polar and hydrophobic flags specified in Sasa filter." );
149 TR.Error <<
"Only total sasa is supported across a jump other than 1. Remove polar and hydrophobic flags and try again: " << tag << std::endl;
150 throw utility::excn::EXCN_RosettaScriptsOption(
"Only total sasa is supported across a jump other than 1. Remove polar and hydrophobic flags and try again." );
153 TR.Debug <<
"Parsed Sasa Filter: <Sasa" <<
155 " upper_threshold=" << upper_threshold_ <<
157 std::copy(
jumps_.begin(),
jumps_.end(), std::ostream_iterator<core::Size>(TR.Debug,
","));
163 " polar=" << polar_ <<
167 utility::lua::LuaObject
const & def,
168 utility::lua::LuaObject
const & ,
169 utility::lua::LuaObject
const &
173 upper_threshold_ = def[
"upper_threshold"] ? def[
"upper_threshold"].to<
core::Real>() : 1000000;
174 jump( def[
"jump"] ? def[
"jump"].to<core::Size>() : 1 );
175 hydrophobic_ = def[
"hydrophobic"] ? def[
"hydrophobic"].to<
bool>() :
false;
176 polar_ = def[
"polar"] ? def[
"polar"].to<
bool>() :
false;
180 utility_exit_with_message(
"ERROR: presently, only total sasa is supported across a jump other than 1. Remove polar and hydrophobic flags and try again." );
185 TR <<
"Only reporting hydrophobic sasa\n";
188 TR <<
"Only reporting polar sasa\n";
197 TR<<
"sasa is "<<sasa<<
". ";
199 TR<<
"passing." <<std::endl;
203 TR<<
"failing."<<std::endl;
211 out<<
"Sasa= "<< sasa<<
'\n';
260 using namespace core::pose::metrics;
261 using basic::MetricValue;
262 using namespace core;
263 using namespace protocols::moves;
266 std::set<core::Size> sym_aware_jump_ids;
270 TR.Debug <<
"getting sym_aware_jump_id from " <<
sym_dof_names_[i] << std::endl;
279 TR.Debug <<
"getting sym_aware_jump_id from " <<
jumps_[i] << std::endl;
280 sym_aware_jump_ids.insert(
jumps_[i]);
287 for (
Size j = 1; j <= nslidedofs; j++)
291 runtime_assert( !sym_aware_jump_ids.empty() );
293 foreach (
Size sym_aware_jump_id, sym_aware_jump_ids)
295 TR.Debug <<
"Moving jump id: " << sym_aware_jump_id << std::endl;
298 translate->step_size( 1000.0 );
299 translate->apply( split_pose );
305 MetricValue< core::Real > mv_sasa;
307 pose.
metric(
"sasa",
"total_sasa", mv_sasa);
308 core::Real const bound_sasa( mv_sasa.value() );
309 TR.Debug <<
"Bound sasa: " << bound_sasa << std::endl;
311 split_pose.
metric(
"sasa",
"total_sasa", mv_sasa );
312 core::Real const unbound_sasa( mv_sasa.value() );
313 TR.Debug <<
"Unbound sasa: " << unbound_sasa << std::endl;
319 core::Real const buried_sasa( (unbound_sasa - bound_sasa) /(sym_info->subunits()));
321 TR.Debug <<
"Normalizing calculated sasa by subunits: " << sym_info->subunits() << std::endl;
322 TR.Debug <<
"Buried sasa: " << buried_sasa << std::endl;
324 return( buried_sasa );
326 core::Real const buried_sasa(unbound_sasa - bound_sasa);
328 TR.Debug <<
"Buried sasa: " << buried_sasa << std::endl;
329 return( buried_sasa );
333 MetricValue< id::AtomID_Map< core::Real > > atom_sasa;
334 pose.
metric(
"sasa_interface",
"delta_atom_sasa", atom_sasa );
335 core::Real polar_sasa( 0.0 ), hydrophobic_sasa( 0.0 );
337 for(
core::Size atomi( 1 ); atomi <= atom_sasa.value().n_atom( pos ); ++atomi ){
338 core::Real const atomi_delta_sasa( atom_sasa.value()( pos, atomi ) );
341 bool const is_polar( atom_type.is_donor() || atom_type.is_acceptor() || atom_type.is_polar_hydrogen() );
342 if( is_polar ) polar_sasa += atomi_delta_sasa;
343 else hydrophobic_sasa += atomi_delta_sasa;
347 if( polar_ )
return polar_sasa;
349 utility_exit_with_message(
"Execution should never have reached this point." );