Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UpstreamCollisionFilter.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 // :noTabs=false:tabSize=4:indentSize=4:
4 //
5 // (c) Copyright Rosetta Commons Member Institutions.
6 // (c) This file is part of the Rosetta software suite and is made available under license.
7 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
8 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
9 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
10 
11 /// @file protocols/match/output/UpstreamCollisionFilter.hh
12 /// @brief Implementation for class to filter matches where the upstream residues collide.
13 /// @author Alex Zanghellini (zanghell@u.washington.edu)
14 /// @author Andrew Leaver-Fay (aleaverfay@gmail.com), porting to mini
15 
16 // Unit headers
18 
19 // Package headers
22 
23 // Project headers
25 #include <core/pose/Pose.hh>
30 
31 // Utility headers
32 #include <utility/pointer/ReferenceCount.hh>
33 
34 // C++ headers
35 #include <iostream>
36 
37 #include <protocols/match/Hit.hh>
38 #include <utility/vector1.hh>
39 
40 
41 namespace protocols {
42 namespace match {
43 namespace output {
44 
45 
47  std::string filter_name,
48  UpstreamHitCacherOP coordinate_cacher
49 ) :
50  MatchFilter( filter_name ),
51  cacher_( coordinate_cacher ),
52  filter_by_lj_( false ),
53  wfa_atr_( 0.8 ),
54  wfa_rep_( 0.44 ),
55  wfa_sol_( 0.6 ),
56  lj_cutoff_( 10 ),
57  tolerated_overlap_( 0.0 ),
58  empty_pose_( new core::pose::Pose ),
59  empty_sfxn_( new core::scoring::ScoreFunction ),
60  etable_energy_( 0 ),
61  bump_grid_( new BumpGrid )
62 {}
63 
65 
67 {
68  filter_by_lj_ = setting;
69  if ( filter_by_lj_ ) {
70  using namespace core::scoring;
71  using namespace core::scoring::etable;
72  using namespace core::scoring::methods;
73  EnergyMethodOptions eopts;
75  *(ScoringManager::get_instance()->etable( eopts.etable_type() )), eopts );
76  }
77 }
78 
80 {
81  lj_cutoff_ = setting;
82 }
83 
85 {
86  wfa_atr_ = setting;
87 }
88 
90 {
91  wfa_rep_ = setting;
92 }
93 
95 {
96  wfa_sol_ = setting;
97 }
98 
100 {
101  tolerated_overlap_ = setting;
102  bump_grid_->set_general_overlap_tolerance( tolerated_overlap_ );
103 }
104 
105 bool
107  return filter_by_lj_;}
108 
111  return wfa_atr_;}
112 
115  return wfa_rep_;}
116 
119  return wfa_sol_;}
120 
123  return lj_cutoff_;}
124 
127  return tolerated_overlap_;}
128 
131  return empty_pose_;}
132 
135  return empty_sfxn_;}
136 
139  return etable_energy_; }
140 
143  return bump_grid_; }
144 
145 
148  UpstreamHitCacherOP coordinate_cacher
149 ) :
150  parent( filter_name, coordinate_cacher )
151 {
152  std::cout << "Created UpstreamCollisionFilter" << std::endl;
153 }
154 
156 {}
157 
158 /// @brief Either sphere-overlap checks the atom pairs in the match residues, or
159 /// evaluates the Etable energies. Returns false if any atom pair collides more than
160 /// the cutoff threshold or if the residue pair energy exceeds the energy cutoff.
161 /// Returns true otherwise.
162 bool
164  match const & m
165 ) const
166 {
167  return passes_filter( match_dspos1( m, 1 ) );
168 }
169 
170 bool
172  match_dspos1 const & m
173 ) const
174 {
175  if ( filter_by_lj() ) {
176  using namespace core::scoring;
177  EnergyMap emap;
178  for ( Size ii = 1; ii < m.upstream_hits.size(); ++ii ) {
179  for ( Size jj = ii + 1; jj <= m.upstream_hits.size(); ++jj ) {
180  emap[ fa_atr ] = 0; emap[ fa_rep ] = 0; emap[ fa_sol ] = 0;
181  etable_energy()->residue_pair_energy(
182  *( cacher_->upstream_conformation_for_hit( ii, fake_hit( m.upstream_hits[ ii ] )) ),
183  *( cacher_->upstream_conformation_for_hit( jj, fake_hit( m.upstream_hits[ jj ] )) ),
184  *empty_pose(), *empty_sfxn(),
185  emap );
186  Real energy = wfa_atr() * emap[ fa_atr ] + wfa_rep() * emap[ fa_rep ] + wfa_sol() * emap[ fa_sol ];
187  if ( energy > lj_cutoff() ) return false;
188  }
189  }
190  return true;
191  } else {
192  for ( Size ii = 1; ii < m.upstream_hits.size(); ++ii ) {
193  core::conformation::ResidueCOP iires = cacher_->upstream_conformation_for_hit( ii, fake_hit( m.upstream_hits[ ii ] ) );
194  for ( Size jj = ii + 1; jj <= m.upstream_hits.size(); ++jj ) {
195  core::conformation::ResidueCOP jjres = cacher_->upstream_conformation_for_hit( jj, fake_hit( m.upstream_hits[ jj ] ) );
196  if( !passes_hardsphere_filter( *iires, *jjres ) ) return false;
197  } // jj loop over upstream_hits.size()
198  } //ii loop over upstream_hits.size()
199  return true;
200  }
201 }
202 
203 bool
205  core::Size geomcst_a,
206  core::Size geomcst_b,
207  Hit const & upstream_hit_a,
208  Hit const & upstream_hit_b
209 ) const
210 {
211  core::conformation::ResidueCOP resA = cacher_->upstream_conformation_for_hit( geomcst_a, upstream_hit_a );
212  core::conformation::ResidueCOP resB = cacher_->upstream_conformation_for_hit( geomcst_b, upstream_hit_b );
213  return passes_hardsphere_filter( *resA, *resB );
214 }
215 
216 
217 }
218 }
219 }