OpenStructure
interaction_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_INTERACTION_STATISTICS_HH
20 #define OST_QA_INTERACTION_STATISTICS_HH
21 /*
22  Author: Marco Biasini
23  */
24 #include <ost/mol/entity_view.hh>
26 #include <ost/qa/module_config.hh>
27 #include <ost/qa/amino_acids.hh>
28 #include <ost/qa/histogram.hh>
29 #include <ost/qa/atom_types.hh>
30 
31 
32 
33 namespace ost { namespace qa {
34 
41 typedef boost::shared_ptr<InteractionStatistics> InteractionStatisticsPtr;
42 
44 public:
54  InteractionStatistics(Real lower_cutoff,
55  Real upper_cutoff,
56  Real bucket_size,
57  int sequence_sep);
58 
60  static InteractionStatisticsPtr LoadFromFile(const String& file_name);
61 
62 
65 
66  void SaveToFile(const String& file_name) const;
67 
68 
70  Real GetDistanceBucketSize() const;
71 
72  int GetSequenceSeparation() const;
73 
74  Real GetUpperCutoff() const;
75 
76  Real GetLowerCutoff() const;
77 
80  uint64_t GetCount(Real distance) const;
81 
84  uint64_t GetCount(atom::ChemType a, atom::ChemType b, Real distance) const;
85 
88  uint64_t GetCount(atom::ChemType a, atom::ChemType b, int distance_bin) const;
89 
92  uint64_t GetCount(atom::ChemType a, atom::ChemType b) const;
93 
96  void Set(atom::ChemType a, atom::ChemType b, int distance_bin, int counts);
97 
99  template <typename DS>
100  void Serialize(DS& ds);
101 public:
102  virtual bool VisitResidue(const mol::ResidueHandle& r);
103  virtual bool VisitAtom(const mol::AtomHandle& a);
104 
105 private:
107 
108  Real lower_cutoff_;
109  Real lower_sqr_;
110  Real upper_cutoff_;
111  Real upper_sqr_;
112 
113  Real bucket_size_;
114  int sequence_sep_;
115  mol::EntityView view_a_;
116  mol::EntityView view_b_;
117  AminoAcid amino_acid_;
118  InteractionHistogram histogram_;
119 };
120 
121 }}
122 #endif