Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DownstreamAlgorithm.hh
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/downstream/DownstreamAlgorithm.hh
12 /// @brief Declaration for the base-class algorithm that creates hits
13 /// from an upstream builder, while managing the logic of their
14 /// creation. Furthermore, the downstream algorithm manages update
15 /// of hits from previous rounds should they loose their potential
16 /// to result in matches.
17 /// @author Alex Zanghellini (zanghell@u.washington.edu)
18 /// @author Andrew Leaver-Fay (aleaverfay@gmail.com), porting to mini
19 
20 #ifndef INCLUDED_protocols_match_downstream_DownstreamAlgorithm_hh
21 #define INCLUDED_protocols_match_downstream_DownstreamAlgorithm_hh
22 
23 // Unit headers
25 
26 // Package headers
29 
32 // AUTO-REMOVED #include <protocols/match/downstream/ExternalGeomSampler.hh>
33 // AUTO-REMOVED #include <protocols/match/Hit.hh>
34 
35 // Project headers
36 #include <core/types.hh>
37 // AUTO-REMOVED #include <core/chemical/ResidueType.fwd.hh>
39 
40 // Utility headers
41 #include <utility/pointer/ReferenceCount.hh>
42 
43 // C++ headers
44 #include <list>
45 // AUTO-REMOVED #include <string>
46 
47 #include <core/id/AtomID.fwd.hh>
49 
50 namespace protocols {
51 namespace match {
52 namespace downstream {
53 
54 /// @brief A class for an algorithm. Given a conformation of the upstream partner,
55 /// the algorithm is responsible for producing a set of hits.
57 {
58 public:
59  typedef core::Size Size;
61 
62 public:
66 
67  virtual ~DownstreamAlgorithm();
68 
69  virtual
71  clone() const = 0;
72 
73  /// @brief Main driver function for hit generation. The algorithm
74  /// is responsible for generating hits at all scaffold build points that
75  /// are valid for this geometric constraint. The base class provides an
76  /// iterate-across-all-positions-and-splice-together-hit-lists implementation,
77  /// however, derived classes may overload this function. The base class
78  /// function is parallelizable with OpenMP. The returned hit list must be in sorted
79  /// order by 1) hit.scaffold_build_id() and then by 2) hit.upstream_conf_id().
80  virtual
81  std::list< Hit >
83  Matcher & matcher
84  );
85 
86 
87  /// @brief Reset appropriate Matcher data to spawn the deletion of hits from other rounds
88  /// following either hit generation by this geometric constraint, or
89  /// following hit generation by another geometric constraint which caused the deletion
90  /// of hits from this geometric constraint. The classic match algorithm, for example,
91  /// resets the occupied-space hash so that other classic-match algorithms can delete their
92  /// non-viable hits in subsequent calls to respond_to_peripheral_hitlist_change.
93  virtual
94  void
95  respond_to_primary_hitlist_change( Matcher & matcher, Size round_just_completed );
96 
97  /// @brief Following the change in the number of hits of some other round -- either
98  /// from the conclusion of that round in which a new set of hits has been generated,
99  /// or from the cascading change to the hits from round A which were deleted after the
100  /// conclusion of round B.
101  virtual
102  void
104 
105 
106  /// @brief Return a set of hits given a conformation of an upstream residue.
107  /// This method must be bit-wise constant and parallelizable in derived classes.
108  virtual
109  std::list< Hit >
110  build(
111  Size const scaffold_build_point_id,
112  Size const upstream_conf_id,
113  core::conformation::Residue const & upstream_residue
114  ) const = 0;
115 
116  /// @brief This method returns 'false' if the hits generated by this
117  /// DownstreamAlgorithm store the 6-dimensional coordinate
118  /// of the downstream partner in hit.second(), and therefore
119  /// intend for the Matcher to find matches for this algorithm's hits by
120  /// hashing the 6-dimensional coordinate. This method returns 'true'
121  /// if the DownstreamAlgorithm does not use hit.second to store a
122  /// point in 6D and instead intends the Matcher to find matches
123  /// by querying this DownstreamAlgorithm's hits_to_include_with_partial_match
124  /// method.
125  virtual
126  bool
127  upstream_only() const = 0;
128 
129  /// @brief This method returns 'true' if the Real6 portion of the returned
130  /// hits are "original" descriptions of the downstream coordinates,
131  /// and not merely duplicates of the downstream coordinates from previous
132  /// rounds. This method returns 'false' if the downstream portion
133  /// of the returned hits are duplications of previous-round geometries or
134  /// if the hits returned by this class do not describe the geometry of
135  /// the downstream coordinates
136  virtual
137  bool
138  generates_primary_hits() const = 0;
139 
140  /// @brief Called at the conclusion of matching, the Matcher signals
141  /// to the downstream algorithm that it's time to prepare for
142  /// match generation; if the downstream algorithm needs to enumerate
143  /// compatible hits in response to the invokation of its
144  /// hits_to_include_with_partial_match method, then now is the time
145  /// to prepare for those calls. Base class has a noop implementation.
146  virtual
147  void
149 
150  /// @brief This method is invoked by the Matcher as it enumerates matches should
151  /// this class return "true" in it's upstream_only.
152  /// method. The Matcher will enumerate matches placing hits into the match
153  /// for all of the geometric-constraints which describe the downstream partner's
154  /// 6D coordinates in their hits, and then for all other geometric constraints
155  /// in ascending order. The hits for upstream residues 1 to geom_cst_id() - 1
156  /// are all valid; the hit for geom-cst i, given that i > geom_cst_id() - 1 is
157  /// valid if and only if the downstream algorithm for geom-cst i returns true
158  /// in it's upstream_only().
159  /// The Hit const * list should point at the Matcher's hits. Between prepare-for-match
160  /// enumeration and note_match_enumeration_completed, the Matcher provides
161  /// a guarantee to the downstream algorithm that it's hit lists have not changed,
162  /// and therefore all Hit *'s remain valid.
163  /// The Matcher is providing a "match_dspos1 const &" instead of a "match const &"
164  /// because this DownstreamAlgorithm should not be examining the 6D coordinates of
165  /// the downstream partner according to other geometric constraints, and because
166  /// the Matcher's match_dspos1-enumeration technique could not readily construct
167  /// a match, the Matcher's match-enumeration technique can readily construct a
168  /// match_dspos1. Data in the input match_dspos1 relating to the downstream
169  /// partner is undefined.
170  virtual
172  hits_to_include_with_partial_match( match_dspos1 const & m ) const = 0;
173 
174  void
176 
177  void
180  );
181 
182  virtual
183  Size
185 
186  Size
187  geom_cst_id() const;
188 
189  void
191  DownstreamBuilderOP dsbuilder
192  );
193 
195  get_dsbuilder() const;
196 
197  bool
199  core::conformation::Residue const & us_res /*upstream*/,
200  core::conformation::Residue const & ds_res /*downstream*/,
201  utility::vector1< core::id::AtomID > const & ds_atoms,
202  utility::vector1< core::Size > const & catalytic_atoms
203  ) const;
204 
205 // virtual
206 // void
207 // initialize_upstream_residue(
208 // core::conformation::Residue const& us_res /*upstream residue*/
209 // );
210 
211 protected:
212 
213  BumpGrid const &
214  bbgrid() const {
215  return *bbgrid_;
216  }
217 
218  bool
220  return active_site_grid_ != 0;
221  }
222 
223  ActiveSiteGrid const &
225  return *active_site_grid_;
226  }
227 
228  /// @brief Non-virtual, const method for generating hits by first iterating across all build points
229  /// and then invoking upstream_builder->build( build_point_i ) and splicing together the results.
230  /// This method is invoked by default if the derived class does not override build_hits_at_all_positions.
231  std::list< Hit >
233  Matcher const & matcher
234  ) const;
235 
236 
237 private:
238  Size geom_cst_id_; // which geometric constraint is this a downstream-algorithm for?
242 
243 };
244 
245 }
246 }
247 }
248 
249 #endif