OpenStructure
torsion_statistics.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_QA_TORSION_STATISTICS_HH
20 #define OST_QA_TORSION_STATISTICS_HH
21 /*
22  Author: Pascal, Benkert, Marco Biasini
23 */
24 #include <ost/mol/entity_handle.hh>
25 #include <ost/qa/histogram.hh>
26 #include <ost/qa/amino_acids.hh>
27 #include <boost/shared_ptr.hpp>
28 
29 namespace ost { namespace qa {
30 
32 typedef boost::shared_ptr<TorsionStatistics> TorsionStatisticsPtr;
33 
41 public:
51  TorsionStatistics(int prev_torsion_bucket_size, int central_torsion_bucket_size,
52  int next_torsion_bucket_size);
55  void Extract(mol::EntityHandle entity);
56 
58  void Extract(mol::EntityView view);
59 
61  static TorsionStatisticsPtr LoadFromFile(const String& file_name);
62 
63  void SaveToFile(const String& file_name) const;
64 
67  uint64_t GetCount(const AminoAcidSet& central_aa,
68  Real prev_phi_angle, Real prev_psi_angle,
69  Real central_phi_angle, Real central_psi_angle,
70  Real next_phi_angle, Real next_psi_angle) const;
71 
72  uint64_t GetCount(Real prev_phi_angle, Real prev_psi_angle,
73  Real central_phi_angle, Real central_psi_angle,
74  Real next_phi_angle, Real next_psi_angle) const;
75 
76  uint64_t GetCount(const AminoAcidSet& central_aa) const;
77 
78  uint64_t GetCount() const;
79 
80 // /// \brief Get frequency of the amino acid aa.
81 // /// \return frequency in the range of [0, 1]
82 // Real GetFrequency(AminoAcid aa) const;
83 
84 
87  uint32_t GetTorsionBucketCountPrev() const;
88  int GetTorsionBucketSizePrev() const;
89  uint32_t GetTorsionBucketCountCentral() const;
90  int GetTorsionBucketSizeCentral() const;
91  uint32_t GetTorsionBucketCountNext() const;
92  int GetTorsionBucketSizeNext() const;
93 
94 
96  template <typename DS>
97  void Serialize(DS& ds)
98  {
99  ds & prev_torsion_bucket_size_;
100  ds & central_torsion_bucket_size_;
101  ds & next_torsion_bucket_size_;
102  ds & histogram_;
103  }
104 public:
105 
106  typedef MultiClassifier<uint32_t, int, Real, Real,
109 
110 
111 private:
114  uint64_t Accumulate(const IndexType& start, const IndexType& end) const;
115 
116  uint32_t IndexForAnglePrev(Real angle) const;
117  uint32_t IndexForAngleCentral(Real angle) const;
118  uint32_t IndexForAngleNext(Real angle) const;
119 
120  TorsionHistogram histogram_;
121  int prev_torsion_bucket_size_;
122  int central_torsion_bucket_size_;
123  int next_torsion_bucket_size_;
124 };
125 }}
126 
127 #endif
128 
129