Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AverageDegreeFilter.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 sw=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 /// @author Sarel Fleishman (sarelf@uw.edu)
13 
14 #include <core/pose/Pose.hh>
17 #include <utility/tag/Tag.hh>
19 // AUTO-REMOVED #include <protocols/moves/DataMap.hh>
20 #include <basic/Tracer.hh>
24 
25 #include <utility/vector0.hh>
26 #include <utility/vector1.hh>
27 
28 
29 namespace protocols {
30 namespace protein_interface_design{
31 namespace filters {
32 
33 static basic::Tracer TR( "protocols.protein_interface_design.filters.AverageDegreeFilter" );
34 
35 ///@brief default ctor
37  parent( "AverageDegree" ),
38  task_factory_( NULL ),
39  threshold_( 0 ),
40  distance_threshold_( 10.0 )
41 {}
42 
45  return threshold_;
46 }
47 
48 void
50  threshold_ = t;
51 }
52 
55 {
56  return task_factory_;
57 }
58 
59 void
61 {
63 }
64 
65 bool
67 {
68  core::Real const average_degree( compute( pose ) );
69  return( average_degree >= threshold() );
70 }
71 
74  return distance_threshold_;
75 }
76 
77 void
80 }
81 
84  runtime_assert( task_factory() );
85  core::pack::task::PackerTaskCOP packer_task( task_factory()->create_task_and_apply_taskoperations( pose ) );
86  core::Size count_residues( 0 );
87  core::Size count_neighbors( 0 );
88  for( core::Size resi=1; resi<=pose.total_residue(); ++resi ){
89  if( packer_task->being_packed( resi ) ){
90  core::Size resi_neighbors( 0 );
91  ++count_residues;
92 /// which chain is resi on?
93  core::Size chain( 1 );
94  for( ; chain <= pose.conformation().num_chains(); ++chain )
95  if( pose.conformation().chain_begin( chain ) <= resi && pose.conformation().chain_end( chain ) >= resi ) break;
96  core::Size const chain_begin( pose.conformation().chain_begin( chain ) );
97  core::Size const chain_end( pose.conformation().chain_end( chain ) );
98  core::conformation::Residue const res_target( pose.conformation().residue( resi ) );
99  for( core::Size j=chain_begin; j<=chain_end; ++j ){
100  core::conformation::Residue const resj( pose.residue( j ) );
101  core::Real const distance( resj.xyz( resj.nbr_atom() ).distance( res_target.xyz( res_target.nbr_atom() ) ) );
102  if( distance <= distance_threshold() ){
103  ++count_neighbors;
104  ++resi_neighbors;
105  }
106  }
107  TR<<"Connectivity of "<<res_target.name3()<<resi<<" is "<<resi_neighbors<<std::endl;
108  }
109  }
110  return( (core::Real) count_neighbors / count_residues );
111 }
112 
115 {
116  return( compute( pose ) );
117 }
118 
119 void
120 AverageDegreeFilter::report( std::ostream & out, core::pose::Pose const & pose ) const
121 {
122  out<<"AverageDegreeFilter returns "<<compute( pose )<<std::endl;
123 }
124 
125 void
130  core::pose::Pose const & )
131 {
132  TR << "AverageDegreeFilter"<<std::endl;
134  threshold( tag->getOption< core::Real >( "threshold", 0 ) );
135  distance_threshold( tag->getOption< core::Real >( "distance_threshold", 8.0 ) );
136  TR<<"with options threshold: "<<threshold()<<" and distance_threshold "<<distance_threshold()<<std::endl;
137 }
138 
141  return new AverageDegreeFilter();
142 }
143 
145 
148  return new AverageDegreeFilter( *this );
149 }
150 
153 
155 AverageDegreeFilterCreator::keyname() const { return "AverageDegree"; }
156 
157 } // filters
158 } // protein_interface_design
159 } // protocols