Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LimitHitsPerRotamerFilter.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/LimitHitsPerRotamerFilter.hh
12 /// @brief
13 /// @author Alex Zanghellini (zanghell@u.washington.edu)
14 /// @author Andrew Leaver-Fay (aleaverfay@gmail.com), porting to mini
15 
16 
17 // Unit headers
19 
20 // Package headers
22 #include <protocols/match/Hit.hh>
23 
24 // Utility headers
25 #include <utility/exit.hh>
26 #include <utility/OrderedTuple.hh>
27 // AUTO-REMOVED #include <utility/vector1.hh>
28 
29 // C++ headers
30 #include <map>
31 
32 namespace protocols {
33 namespace match {
34 namespace output {
35 
37  : StateAccumulatingMatchFilter("LimitHitsPerRotamerFilter")
38 {}
40  StateAccumulatingMatchFilter("LimitHitsPerRotamerFilter"),
41  n_geometric_constraints_( n_geometric_constraints )
42 {}
43 
44 void
46 {
47  n_geometric_constraints_ = n_csts;
48 
49 }
50 
51 void
53 {
55 }
56 
58 
59 /// @brief Returns true if the given match passes this filter
60 bool
62  match const & m
63 ) const
64 {
65  runtime_assert( m.size() == n_geometric_constraints_ );
66 
68  for ( Size ii = 1; ii <= n_geometric_constraints_; ++ii ) {
69  rot_vector[ ii ] = m[ ii ].scaffold_build_id();
70  rot_vector[ n_geometric_constraints_ + ii ] = m[ ii ].upstream_conf_id();
71  }
72 
73  RotamerComboCountMap::const_iterator iter = count_per_rotamer_combo_.find( rot_vector );
74  if ( iter == count_per_rotamer_combo_.end() ) {
75  return true;
76  } else {
77  return iter->second < limit_per_rotamer_combo_;
78  }
79 }
80 
81 /// @brief Note that a particular match has passed all the filters and will be output.
82 void
84  match const & m
85 )
86 {
87  runtime_assert( m.size() == n_geometric_constraints_ );
88 
90  for ( Size ii = 1; ii <= n_geometric_constraints_; ++ii ) {
91  rot_vector[ ii ] = m[ ii ].scaffold_build_id();
92  rot_vector[ n_geometric_constraints_ + ii ] = m[ ii ].upstream_conf_id();
93  }
94 
95  RotamerComboCountMap::iterator iter = count_per_rotamer_combo_.find( rot_vector );
96  if ( iter == count_per_rotamer_combo_.end() ) {
97  count_per_rotamer_combo_[ rot_vector ] = 1;
98  } else {
99  ++iter->second;
100  }
101 }
102 
103 /// @brief Erase all tracking data on which matches have already been output.
104 void
106 {
107  count_per_rotamer_combo_.clear();
108 }
109 
110 }
111 }
112 }