OpenStructure
packing_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_PACKING_STATISTICS_HH
20 #define OST_QA_PACKING_STATISTICS_HH
21 
23 #include <ost/qa/histogram.hh>
24 #include <ost/qa/amino_acids.hh>
25 #include <ost/mol/entity_view.hh>
26 
27 namespace ost { namespace qa {
28 
34 typedef boost::shared_ptr<PackingStatistics> PackingStatisticsPtr;
36 public:
37  PackingStatistics(Real cutoff, int max_counts, int bucket_size);
39 
42  int GetBucketSize() const;
43 
46  int GetMaxCounts() const;
47 
49  Real GetCutoffDistance() const;
50 
55  void Extract(mol::EntityView view, const mol::EntityViewList& views);
56 
57  static PackingStatisticsPtr LoadFromFile(const String& filename);
58 
59  void SaveToFile(const String& filename);
60 
61  virtual bool VisitAtom(const mol::AtomHandle& atom);
62 
63  uint64_t GetCount(AminoAcid aa) const;
64  uint64_t GetCount(AminoAcid aa, int count) const;
65 
66  uint64_t GetTotalCount() const;
67  uint64_t GetCount(int count) const;
68 
69  template <typename DS>
70  void Serialize(DS& ds)
71  {
72  ds & cutoff_;
73  ds & max_counts_;
74  ds & bucket_size_;
75  ds & histogram_;
76  }
77 
81 
82 private:
83  mol::EntityView view_;
84  mol::EntityViewList views_;
85  PackingHistogram histogram_;
86 };
87 
88 }}
89 
90 #endif