00001 //------------------------------------------------------------------------------ 00002 // This file is part of the OpenStructure project <www.openstructure.org> 00003 // 00004 // Copyright (C) 2008-2010 by the OpenStructure authors 00005 // 00006 // This library is free software; you can redistribute it and/or modify it under 00007 // the terms of the GNU Lesser General Public License as published by the Free 00008 // Software Foundation; either version 3.0 of the License, or (at your option) 00009 // any later version. 00010 // This library is distributed in the hope that it will be useful, but WITHOUT 00011 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00012 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00013 // details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with this library; if not, write to the Free Software Foundation, Inc., 00017 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 //------------------------------------------------------------------------------ 00019 #ifndef OST_QA_PACKING_STATISTICS_HH 00020 #define OST_QA_PACKING_STATISTICS_HH 00021 00022 #include <ost/mol/entity_visitor.hh> 00023 #include <ost/qa/histogram.hh> 00024 #include <ost/qa/amino_acids.hh> 00025 #include <ost/mol/entity_view.hh> 00026 00027 namespace ost { namespace qa { 00028 00032 typedef Histogram<int, int> PackingHistogram; 00033 class PackingStatistics; 00034 typedef boost::shared_ptr<PackingStatistics> PackingStatisticsPtr; 00035 class DLLEXPORT_OST_QA PackingStatistics : public mol::EntityVisitor { 00036 public: 00037 PackingStatistics(Real cutoff, int max_counts, int bucket_size); 00038 PackingStatistics(); 00039 00042 int GetBucketSize() const; 00043 00046 int GetMaxCounts() const; 00047 00049 Real GetCutoffDistance() const; 00050 00055 void Extract(mol::EntityView view, const mol::EntityViewList& views); 00056 00057 static PackingStatisticsPtr LoadFromFile(const String& filename); 00058 00059 void SaveToFile(const String& filename); 00060 00061 virtual bool VisitAtom(const mol::AtomHandle& atom); 00062 00063 uint64_t GetCount(AminoAcid aa) const; 00064 uint64_t GetCount(AminoAcid aa, int count) const; 00065 00066 uint64_t GetTotalCount() const; 00067 uint64_t GetCount(int count) const; 00068 00069 template <typename DS> 00070 void Serialize(DS& ds) 00071 { 00072 ds & cutoff_; 00073 ds & max_counts_; 00074 ds & bucket_size_; 00075 ds & histogram_; 00076 } 00077 00078 Real cutoff_; 00079 int max_counts_; 00080 int bucket_size_; 00081 00082 private: 00083 mol::EntityView view_; 00084 mol::EntityViewList views_; 00085 PackingHistogram histogram_; 00086 }; 00087 00088 }} 00089 00090 #endif
1.5.8