00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef OST_QA_INTERACTION_STATISTICS_HH
00020 #define OST_QA_INTERACTION_STATISTICS_HH
00021
00022
00023
00024 #include <ost/mol/entity_view.hh>
00025 #include <ost/mol/entity_visitor.hh>
00026 #include <ost/qa/module_config.hh>
00027 #include <ost/qa/amino_acids.hh>
00028 #include <ost/qa/histogram.hh>
00029 #include <ost/qa/atom_types.hh>
00030
00031
00032
00033 namespace ost { namespace qa {
00034
00039 typedef Histogram<int, int, Real> InteractionHistogram;
00040 class InteractionStatistics;
00041 typedef boost::shared_ptr<InteractionStatistics> InteractionStatisticsPtr;
00042
00043 class DLLEXPORT_OST_QA InteractionStatistics : public mol::EntityVisitor {
00044 public:
00054 InteractionStatistics(Real lower_cutoff,
00055 Real upper_cutoff,
00056 Real bucket_size,
00057 int sequence_sep);
00058
00060 static InteractionStatisticsPtr LoadFromFile(const String& file_name);
00061
00062
00064 void Extract(mol::EntityView a, mol::EntityView b);
00065
00066 void SaveToFile(const String& file_name) const;
00067
00068
00070 Real GetDistanceBucketSize() const;
00071
00072 int GetSequenceSeparation() const;
00073
00074 Real GetUpperCutoff() const;
00075
00076 Real GetLowerCutoff() const;
00077
00080 uint64_t GetCount(Real distance) const;
00081
00084 uint64_t GetCount(atom::ChemType a, atom::ChemType b, Real distance) const;
00085
00088 uint64_t GetCount(atom::ChemType a, atom::ChemType b, int distance_bin) const;
00089
00092 uint64_t GetCount(atom::ChemType a, atom::ChemType b) const;
00093
00096 void Set(atom::ChemType a, atom::ChemType b, int distance_bin, int counts);
00097
00098
00104 void RepairCbetaStatistics();
00105
00106
00108 template <typename DS>
00109 void Serialize(DS& ds);
00110 public:
00111 virtual bool VisitResidue(const mol::ResidueHandle& r);
00112 virtual bool VisitAtom(const mol::AtomHandle& a);
00113
00114 inline bool isCbetaStaistics() {return isCbetaStatisticsFlag_;}
00115
00116
00117 private:
00118 InteractionStatistics();
00119
00120 Real lower_cutoff_;
00121 Real lower_sqr_;
00122 Real upper_cutoff_;
00123 Real upper_sqr_;
00124
00125 Real bucket_size_;
00126 int sequence_sep_;
00127 mol::EntityView view_a_;
00128 mol::EntityView view_b_;
00129 AminoAcid amino_acid_;
00130 InteractionHistogram histogram_;
00131
00132 bool isCbetaStatisticsFlag_;
00133 };
00134
00135 }}
00136 #endif