Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TerminusDistanceFilter.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/TerminusDistanceFilter.cc
11 /// @brief
12 /// @author Sarel Fleishman (sarelf@u.washington.edu), Jacob Corn (jecorn@u.washington.edu)
13 // Project Headers
14 
15 #include <ObjexxFCL/FArray1D.fwd.hh>
16 #include <ObjexxFCL/FArray1D.hh>
17 #include <ObjexxFCL/format.hh>
18 #include <basic/MetricValue.hh>
19 #include <basic/Tracer.hh>
20 #include <core/chemical/AA.hh>
30 #include <core/pose/PDBInfo.hh>
31 #include <core/pose/Pose.hh>
33 #include <core/scoring/Energies.hh>
39 #include <core/types.hh>
41 #include <map>
42 #include <numeric/random/random.hh>
53 #include <string>
54 #include <utility/exit.hh>
55 #include <utility/tag/Tag.hh>
56 #include <utility/vector0.hh>
57 #include <utility/vector1.hh>
58 
59 
60 namespace protocols {
61 namespace simple_filters {
62 
63 static basic::Tracer TR( "protocols.simple_filters.TerminusDistanceFilter" );
64 
67 
69 TerminusDistanceFilterCreator::keyname() const { return "TerminusDistance"; }
70 
72 
73 void
75 {
76  jump_num_ = tag->getOption<core::Size>( "jump_number", 1 );
77  distance_ = tag->getOption<core::Size>( "distance", 5 );
78 
79  TR<<"Distance From Terminus filter over jump number " << jump_num_ << " with cutoff " << distance_ << std::endl;
80 }
81 
82 bool
84  core::Real const dist( compute( pose ) );
85  TR<<"near terminus: "<<dist<<". " ;
86  bool const status = (dist <= distance_) ? (false) : (true);
87  if( status ) TR << "passing." << std::endl;
88  else TR << "failing." << std::endl;
89  return status;
90 }
91 
92 void
93 TerminusDistanceFilter::report( std::ostream & out, core::pose::Pose const & pose ) const {
94  core::Real const dist( compute( pose ) );
95  out<<"near terminus: "<< dist<<'\n';
96 }
97 
100  core::Real const dist( compute( pose ) );
101  return( dist );
102 }
103 
106  core::pose::Pose copy_pose = pose;
107  runtime_assert( copy_pose.num_jump() >= jump_num_ );
108 
109  // scoring is necessary for Interface to work reliably
111  (*scorefxn)(copy_pose);
112 
114  iface.distance( 8 );
115  iface.calculate( copy_pose );
116  core::Real min_dist(1000);
117 
118  for ( core::Size i=1; i <= pose.total_residue(); ++i ) {
119  core::Real dist(1000);
120  if( !iface.is_interface( i ) ) continue; // keep going if we're not at the interface
121 
122  core::Size const chain = copy_pose.residue( i ).chain();
123  core::Size const N_dist = i - copy_pose.conformation().chain_begin( chain );
124  core::Size const C_dist = copy_pose.conformation().chain_end( chain ) - i;
125  dist = ( N_dist <= C_dist ) ? ( N_dist) : ( C_dist ) ;
126  if( ( N_dist < distance_ ) || ( C_dist < distance_ ) ) {
127  return dist;
128  }
129  min_dist = ( dist < min_dist ) ? (dist) : (min_dist);
130  }
131  return( min_dist );
132 }
133 
134 
135 }
136 }