00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef OST_QA_TORSION_STATISTICS_HH
00020 #define OST_QA_TORSION_STATISTICS_HH
00021
00022
00023
00024 #include <ost/mol/entity_handle.hh>
00025 #include <ost/qa/histogram.hh>
00026 #include <ost/qa/amino_acids.hh>
00027 #include <boost/shared_ptr.hpp>
00028
00029 namespace ost { namespace qa {
00030
00031 class TorsionStatistics;
00032 typedef boost::shared_ptr<TorsionStatistics> TorsionStatisticsPtr;
00033
00040 class DLLEXPORT_OST_QA TorsionStatistics {
00041 public:
00051 TorsionStatistics(int prev_torsion_bucket_size, int central_torsion_bucket_size,
00052 int next_torsion_bucket_size);
00053 TorsionStatistics();
00055 void Extract(mol::EntityHandle entity);
00056
00058 void Extract(mol::EntityView view);
00059
00061 static TorsionStatisticsPtr LoadFromFile(const String& file_name);
00062
00063 void SaveToFile(const String& file_name) const;
00064
00067 uint64_t GetCount(const AminoAcidSet& central_aa,
00068 Real prev_phi_angle, Real prev_psi_angle,
00069 Real central_phi_angle, Real central_psi_angle,
00070 Real next_phi_angle, Real next_psi_angle) const;
00071
00072 uint64_t GetCount(Real prev_phi_angle, Real prev_psi_angle,
00073 Real central_phi_angle, Real central_psi_angle,
00074 Real next_phi_angle, Real next_psi_angle) const;
00075
00076 uint64_t GetCount(const AminoAcidSet& central_aa) const;
00077
00078 uint64_t GetCount() const;
00079
00080
00081
00082
00083
00084
00087 uint32_t GetTorsionBucketCountPrev() const;
00088 int GetTorsionBucketSizePrev() const;
00089 uint32_t GetTorsionBucketCountCentral() const;
00090 int GetTorsionBucketSizeCentral() const;
00091 uint32_t GetTorsionBucketCountNext() const;
00092 int GetTorsionBucketSizeNext() const;
00093
00094
00096 template <typename DS>
00097 void Serialize(DS& ds)
00098 {
00099 ds & prev_torsion_bucket_size_;
00100 ds & central_torsion_bucket_size_;
00101 ds & next_torsion_bucket_size_;
00102 ds & histogram_;
00103 }
00104 public:
00105
00106 typedef MultiClassifier<uint32_t, int, Real, Real,
00107 Real, Real, Real, Real> TorsionHistogram;
00108 typedef TorsionHistogram::IndexType IndexType;
00109
00110
00111 private:
00114 uint64_t Accumulate(const IndexType& start, const IndexType& end) const;
00115
00116 uint32_t IndexForAnglePrev(Real angle) const;
00117 uint32_t IndexForAngleCentral(Real angle) const;
00118 uint32_t IndexForAngleNext(Real angle) const;
00119
00120 TorsionHistogram histogram_;
00121 int prev_torsion_bucket_size_;
00122 int central_torsion_bucket_size_;
00123 int next_torsion_bucket_size_;
00124 };
00125 }}
00126
00127 #endif
00128
00129