Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ProteinUpstreamBuilder.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/upstream/ProteinUpstreamBuilder.hh
12 /// @brief
13 /// @author Alex Zanghellini (zanghell@u.washington.edu)
14 /// @author Andrew Leaver-Fay (aleaverfay@gmail.com), porting to mini
15 
16 #ifndef INCLUDED_protocols_match_upstream_ProteinUpstreamBuilder_hh
17 #define INCLUDED_protocols_match_upstream_ProteinUpstreamBuilder_hh
18 
19 // Unit headers
21 
22 // Package headers
24 //#include <protocols/match/downstream/ExternalGeomSampler.fwd.hh>
25 
29 // AUTO-REMOVED #include <protocols/match/upstream/UpstreamResTypeGeometry.fwd.hh>
30 
31 // AUTO-REMOVED #include <protocols/match/SixDHasher.fwd.hh>
32 
33 // Project headers
37 #include <core/types.hh>
38 
39 // Numeric headers
40 #include <numeric/HomogeneousTransform.hh>
41 #include <numeric/xyzVector.hh>
42 
43 // Utility headers
44 // AUTO-REMOVED #include <utility/fixedsizearray1.hh>
45 #include <utility/pointer/ReferenceCount.hh>
46 // AUTO-REMOVED #include <utility/vector1.hh>
47 
48 #include <utility/vector1.hh>
49 
50 
51 namespace protocols {
52 namespace match {
53 namespace upstream {
54 
55 /// @brief This class holds all of the data associated with the logic
56 /// for generating extra samples for a particular chi angle. There are
57 /// tons of ways concievable to build extra rotamers; the data in this class
58 /// is intended to group all of that data into one place. This class is
59 /// not responsible for building extra rotamer samples; that responsibility
60 /// is given to class FullChiSampleSet.
62 public:
63  typedef core::Real Real;
64  typedef core::Size Size;
66 
67 public:
70 
71  void set_strategy( ChiStrategy );
72 
73  void set_sample_level( ExtraRotSample setting );
74  void set_step_size( Real setting );
75  void set_sd_range( Real setting );
76  void set_n_samples_wi_sd_range( Size setting );
79 
80  ChiStrategy strategy() const;
82  Real step_size() const;
83  Real sd_range() const;
87 
88 
89 private:
97 };
98 
99 /// @brief A simple class that describes the geometry for a particular
100 /// residue type. It describes the coordinate frame geometry for the
101 /// fourth atom defining each chi dihedral. The fourth atom is called
102 /// the "chi tip" atom, as it's at the tip of the growing kinematic chain
103 /// when building chi i. This class also describes the location
104 /// of the atoms controlled by each chi which are not the chi-tip atoms;
105 /// it measures their location in the coordinate frame of the chi-tip atom.
106 ///
107 /// @details To generate the coordinate of the chi-tip atom, the
108 /// stored coordinate frame is multiplied
109 /// by the coordinate frame at the third atom after that coordinate frame
110 /// has been multipled by the chi-angle-z-axis rotation HT.
111 /*
112 class UpstreamResTypeGeometry : public utility::pointer::ReferenceCount
113 {
114 public:
115  typedef core::Size Size;
116  typedef core::Real Real;
117  typedef core::Vector Vector;
118  typedef numeric::HomogeneousTransform< Real > HTReal;
119 
120 public:
121  UpstreamResTypeGeometry();
122  UpstreamResTypeGeometry( core::chemical::ResidueType const & );
123 
124  void initialize_from_residue_type( core::chemical::ResidueType const & );
125 
126 public:
127 
128  /// @brief the name of the residue type used to generate this geometry
129  std::string const & name() const {
130  return restype_name_;
131  }
132 
133  /// @brief the number of atoms in this residue type
134  Size natoms() const {
135  return controlling_chi_for_atom_.size();
136  }
137 
138  Size nchi() const {
139  return chitip_atoms_.size();
140  }
141 
142  bool atom_controlled_by_any_chi( Size atomno ) const {
143  return controlling_chi_for_atom_[ atomno ] != 0;
144  }
145 
146  bool atom_is_chitip( Size atomno ) const {
147  return controlling_chi_for_atom_[ atomno ] != 0 && which_point_for_atom_[ atomno ] == 0;
148  }
149 
150  utility::vector1< Size > const &
151  controlling_chi_for_atom() const { return controlling_chi_for_atom_; }
152 
153  utility::vector1< Size > const &
154  which_point_for_atom() const { return which_point_for_atom_; }
155 
156  utility::vector1< Size > const &
157  chitip_atoms() const { return chitip_atoms_; }
158 
159  Size
160  chitip_atom( Size chi ) const {
161  return chitip_atoms_[ chi ];
162  }
163 
164  utility::vector1< HTReal > const &
165  ht_for_chitip_atoms() const { return ht_for_chitip_atoms_; }
166 
167  HTReal const &
168  ht_for_chitip_atom( Size chi ) const {
169  return ht_for_chitip_atoms_[ chi ];
170  }
171 
172  Size
173  n_nonchitip_atoms_for_chi( Size chi ) const {
174  return nonchitip_atoms_[ chi ].size();
175  }
176 
177  utility::vector1< utility::vector1< Size > > const &
178  nonchitip_atoms() const { return nonchitip_atoms_; }
179 
180  Size
181  nonchitip_atom( Size chi, Size which_nonchitip_atom_for_chi ) const {
182  return nonchitip_atoms_[ chi ][ which_nonchitip_atom_for_chi ];
183  }
184 
185  utility::vector1< utility::vector1< Vector > > const &
186  points_for_nonchitip_atoms() const { return points_for_nonchitip_atoms_; }
187 
188  utility::vector1< Vector > const &
189  points_for_nonchitip_atoms( Size chi ) const {
190  return points_for_nonchitip_atoms_[ chi ];
191  }
192 
193  /// @brief Convenience function: get the coordinate in the chitip frame
194  /// for a particular atom. The atom must be a non-chitip atom that is
195  /// not part of the backbone (it must be controlled by a chi angle).
196  Vector const &
197  point_for_nonchitip_atom( Size atom ) {
198  assert( atom_controlled_by_any_chi( atom ) && !atom_is_chitip( atom ) );
199  return points_for_nonchitip_atoms_[ controlling_chi_for_atom_[ atom ] ]
200  [ which_point_for_atom_[ atom ] ];
201  }
202 
203 
204 private:
205  /// Data
206 
207  std::string restype_name_;
208 
209  utility::vector1< Size > controlling_chi_for_atom_;
210  utility::vector1< Size > which_point_for_atom_;
211 
212  utility::vector1< Size > chitip_atoms_;
213  utility::vector1< HTReal > ht_for_chitip_atoms_;
214 
215 
216  utility::vector1< utility::vector1< Size > > nonchitip_atoms_;
217  utility::vector1< utility::vector1< Vector > > points_for_nonchitip_atoms_;
218 
219 };
220 */
221 
222 /// @brief Still sketchy on this class. It holds all of the data needed
223 /// for describing the geometry of the downstream partner relative to the upstream
224 /// partner for a single residue type. This class holds the data for deciding which
225 /// base rotamers to consider, how each base rotamer should be expanded to produce a
226 /// full set of chi rotamers, and how to orient the downstream partner relative to
227 /// this rotamer. It also holds the UpstreamResTypeGeometry object for the
228 /// restype being built.
230 {
231 public:
232  typedef core::Size Size;
233  typedef core::Real Real;
235 
236 public:
237 
238  BuildSet();
239  virtual ~BuildSet();
240  BuildSet( BuildSet const & );
241 
242  BuildSet const & operator = ( BuildSet const & rhs );
243 
244 public:
245  /// initialization
247 
248  void set_sample_strategy_for_chi( Size chi, SampleStrategyData const & data );
249 
251 
252 public:
253  /// accessors
254 
255  bool
256  has_restype() const {
257  return restype_.get() != 0;
258  }
259 
261  restype() const {
262  return *restype_;
263  }
264 
265  bool
266  backbone_only() const {
267  return backbone_only_;
268  }
269 
272  return *restype_geom_;
273  }
274 
275  Real
278  }
279 
280 
281  SampleStrategyData const &
283  return sample_strategy_for_chi_[ chi ];
284  }
285 
286  bool
288  return algorithm_.get() != 0;
289  }
290 
292  algorithm() const {
293  return *algorithm_;
294  }
295 
298  return *algorithm_;
299  }
300 
301  Size
302  nbonds_from_bb_atom( Size atom_index ) const {
303  return nbonds_from_bb_atom_[ atom_index ];
304  }
305 
307  atom_radius( Size atomno ) const {
308  return atom_radii_[ atomno ];
309  }
310 
311  void
313  core::Real cutoff );
314 
315  bool
316  check_fa_dun() const {
317  return check_fa_dun_; }
318 
319  core::Real
320  fa_dun_cutoff() const{
321  return fa_dun_cutoff_; }
322 
323 public:
325  bool backbone_only_; // true if only the geometry of the backbone is important
326 
330 
333 
335 
336  //in case we only want to build hits from rotamers below a certain fa_dun
339 
340 };
341 
343 public:
344  ///@brief Automatically generated virtual destructor for class deriving directly from ReferenceCount
345  virtual ~FullChiSampleSet();
346  typedef core::Size Size;
347  typedef core::Real Real;
348  typedef numeric::HomogeneousTransform< Real > HTReal;
352 
353 public:
354 
356  BuildSet const & build_set,
358  bool dry_run
359  );
360 
361 
364  assert( ! dry_run_ );
365  return n_samples_per_chi_;
366  }
367 
369  return num_chi_samples_total_;
370  }
371 
373  chi_samples( Size chi ) const {
374  assert( ! dry_run_ );
375  return chi_samples_[ chi ];
376  }
377 
378 
379  Real
380  chi_sample( Size chi, Size sample_id ) const {
381  assert( ! dry_run_ );
382  return chi_samples_[ chi ][ sample_id ];
383  }
384 
385  HTReal const &
386  frame( Size chi, Size sample_id ) const {
387  assert( ! dry_run_ );
388  assert( chi <= frames_.size() );
389  return frames_[ chi ][ sample_id ];
390  }
391 
392 private:
393 
394  void
395  expand_non_dunbrack_chi( Size chi, BuildSet const & build_set );
396 
397  void
399  Size chi,
400  ExtraRotSample behavior,
402  );
403 
404  void
406  Size chi,
407  SampleStrategyData const & stratdat,
409  );
410 
411  void
413  Size chi,
414  SampleStrategyData const & stratdat,
416  );
417 
418  void
419  create_hts_for_chi( Size chi );
420 
421  /// This doesn't belong in this class -- move to core.
422  static
424  ex_level_from_flags( Size chi );
425 
426 private:
427  bool const dry_run_;
432 
433 };
434 
435 
437 public:
439  typedef core::Real Real;
440  typedef numeric::HomogeneousTransform< Real > HTReal;
443 
444 public:
446  virtual ~ProteinUpstreamBuilder();
447 
449  clone() const;
450 
451  /// @brief Iterate across possible conformations for the upstream
452  /// half of the hit, and for each (non-coliding) conformation,
453  /// sample all external geometries specified by the external_sampler
454  /// to construct the three coordinates of the downstream sampler.
455  /// Return a list of hits.
456  virtual
457  std::list< Hit >
458  build(
459  ScaffoldBuildPoint const & build_point
460  ) const;
461 
462  /// @brief Regenerate the rotamer for a particular hit and give that rotamer
463  /// to the UpstreamResidueProcessor.
464  virtual
465  void
466  recover_hit(
467  Hit const & hit,
468  ScaffoldBuildPoint const & build_point,
469  UpstreamResidueProcessor & processor
470  ) const;
471 
472  /// @brief Regenerate a set of rotamers for a subset of hits bound by the
473  /// two input hit-list iterators.
474  virtual
475  void
476  recover_hits(
477  std::list< Hit >::const_iterator hits_begin,
478  std::list< Hit >::const_iterator hits_end,
479  ScaffoldBuildPoint const & build_point,
480  UpstreamResidueProcessor & processor
481  ) const;
482 
483  virtual
484  Size
485  n_restypes_to_build() const;
486 
487  virtual
489  restype( Size which_restype ) const;
490 
491  virtual bool compatible(
492  Hit const & my_hit,
493  ScaffoldBuildPoint const & build_point_mine,
494  UpstreamBuilder const & other,
495  Hit const & other_hit,
496  ScaffoldBuildPoint const & build_point_other,
497  bool first_dispatch = true
498  ) const;
499 
500  virtual bool compatible(
501  Hit const & my_hit,
502  ScaffoldBuildPoint const & build_point_mine,
503  ProteinUpstreamBuilder const & other,
504  Hit const & other_hit,
505  ScaffoldBuildPoint const & build_point_other,
506  bool first_dispatch = true
507  ) const;
508 
509  void
511  BuildSet const & build_set
512  );
513 
514  Size
515  n_build_sets() const {
516  return build_sets_.size();
517  }
518 
519  BuildSet const &
521 
522  BuildSet &
524 
525  void
526  set_sampler(
527  ProteinSCSamplerCOP sampler
528  );
529 
530  void set_use_input_sidechain( bool setting );
531 
532  //Kui Native 110809
533  void set_native_flag (bool native);
534 
535 private:
536 
537  /// @brief Copy the coordinates from the build_point object into the the rescoords
538  /// object, compute the coordinate frame at CBeta, copy the CB coordinate into the
539  /// rescoords object, and return the CBeta frame.
540  HTReal
542  Size build_set_id,
543  core::conformation::Residue & rescoords,
544  ScaffoldBuildPoint const & build_point
545  ) const;
546 
547  /// @brief Construct the coordinate frame at CBeta to match the residue type's geometry.
548  /// The input coordinates for the build point need not be ideal.
549  /// The returned coordinate frame is located at CBeta with the z axis pointing
550  /// along the calpha->cbeta bond vector, the y axis is in the N-CA-CB plane,
551  /// and the x axis being the crossproduct of y and z.
552  HTReal
554  Size build_set_id,
555  ProteinBackboneBuildPoint const & build_point
556  ) const;
557 
558  /// @brief Returns true if a particular atom coordinate for a rotamer rules out
559  /// that rotamer as yeilding a potential hit. Reasons to exclude a rotamer based
560  /// on atom placement: collision of that atom with the background, too long of a
561  /// distance that atom is from any other hit.
562  bool
564  Size build_set_id,
565  core::conformation::Residue const & rescoords,
566  Size atomno
567  ) const;
568 
569 private:
573  //Kui Native 110809
575 
576 };
577 
578 }
579 }
580 }
581 
582 #endif