OpenStructure
torsion_potential.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_TORSION_POTENTIAL_HH
20 #define OST_QA_TORSION_POTENTIAL_HH
21 /*
22  This implementation of the torsion angle potential combines 3
23  torsion angle pairs with 1 residues in analogy to the combined
24  potential described by:
25  Pascal Benkert, Silvio C. E. Tosatto, Dietmar Schomburg
26  QMEAN: A comprehensive scoring function for model quality assessment
27  Proteins, 2008
28 
29  Author: Pascal, Benkert, Marco Biasini
30 */
32 #include <boost/shared_ptr.hpp>
33 #include <boost/enable_shared_from_this.hpp>
34 #include <vector>
35 #include <boost/scoped_ptr.hpp>
36 
37 namespace ost { namespace qa {
38 
39 typedef std::vector<AminoAcidSet> AminoAcidAlphabet;
40 
51 
61  template <typename DS>
62  void Serialize(DS& ds);
63 };
64 
66 typedef boost::shared_ptr<TorsionPotential> TorsionPotentialPtr;
67 
72  public boost::enable_shared_from_this<TorsionPotential> {
73 public:
79  static TorsionPotentialPtr Create(TorsionStatisticsPtr statistics,
80  const TorsionPotentialOpts& opts,
81  bool calculate_average_energy_flag);
83  static TorsionPotentialPtr LoadFromFile(const String& path);
84 
86  Real GetTotalEnergy(mol::EntityHandle entity);
87 
90  Real GetTotalEnergy(mol::EntityView view);
91 
93  int GetEnergyCounts() const;
94 
95 
96 
97  Real GetTorsionEnergy(AminoAcid central_aa, Real prev_phi, Real prev_psi,
98  Real central_phi, Real central_psi,
99  Real next_phi, Real next_psi) const {
100  int icenter=this->GetAAIndex(central_aa);
101  return energies_.Get(icenter, prev_phi, prev_psi,
102  central_phi, central_psi,
103  next_phi, next_psi);
104  }
105 
106 
110  void SaveToFile(const String& path);
111 
113  template <typename DS>
114  void Serialize(DS& ds);
115 
116 
117 public:
120  typedef MultiClassifier<float, int, Real, Real,
122 private:
123 
124  int GetAAIndex(AminoAcid aa) const;
125 
126  void Fill(const TorsionStatisticsPtr& stat,
127  bool calculate_average_energy_flag);
128 
129  TorsionPotentialOpts options_;
130  TorsionEnergies energies_;
131  int num_torsions_;
132 };
133 
134 
135 }}
136 
137 #endif