bpp-phyl  2.2.0
MvaFrequenciesSet.h
Go to the documentation of this file.
1 //
2 // File: MvaFrequenciesSet.h
3 // Created by: Mathieu Groussin
4 // Created on: Sat Jan 12 2013
5 //
6 
7 /*
8  Copyright or (c) or Copr. Bio++ Development Team, (November 16, 2004)
9 
10  This software is a computer program whose purpose is to provide classes
11  for phylogenetic data analysis.
12 
13  This software is governed by the CeCILL license under French law and
14  abiding by the rules of distribution of free software. You can use,
15  modify and/ or redistribute the software under the terms of the CeCILL
16  license as circulated by CEA, CNRS and INRIA at the following URL
17  "http://www.cecill.info".
18 
19  As a counterpart to the access to the source code and rights to copy,
20  modify and redistribute granted by the license, users are provided only
21  with a limited warranty and the software's author, the holder of the
22  economic rights, and the successive licensors have only limited
23  liability.
24 
25  In this respect, the user's attention is drawn to the risks associated
26  with loading, using, modifying and/or developing or reproducing the
27  software by the user in light of its specific status of free software,
28  that may mean that it is complicated to manipulate, and that also
29  therefore means that it is reserved for developers and experienced
30  professionals having in-depth computer knowledge. Users are therefore
31  encouraged to load and test the software's suitability as regards their
32  requirements in conditions enabling the security of their systems and/or
33  data to be ensured and, more generally, to use and operate it in the
34  same conditions as regards security.
35 
36  The fact that you are presently reading this means that you have had
37  knowledge of the CeCILL license and that you accept its terms.
38  */
39 
40 #ifndef _MVAFREQUENCIESSET_H_
41 #define _MVAFREQUENCIESSET_H_
42 
43 #include "ProteinFrequenciesSet.h"
44 #include "../Protein/Coala.h"
45 
46 namespace bpp
47 {
48 
58  public virtual ProteinFrequenciesSet,
60 {
61 public:
65  MvaFrequenciesSet(const ProteicAlphabet* alpha);
66 
67 #ifndef NO_VIRTUAL_COV
69 #else
70  Clonable*
71 #endif
72  clone() const { return new MvaFrequenciesSet(*this); }
73 
75  {
76  // AbstractParametrizable::operator=(af);
78  tPpalAxes_ = mfs.tPpalAxes_;
79  rowCoords_ = mfs.rowCoords_;
80  nbrOfAxes_ = mfs.nbrOfAxes_;
81  model_ = mfs.model_;
84  return *this;
85  }
86 
87 protected:
88  RowMatrix<double> tPpalAxes_;
89  RowMatrix<double> rowCoords_;
90  size_t nbrOfAxes_;
91  std::string model_;
92  std::vector<double> columnWeights_;
93  std::map<std::string,std::string> paramValues_;
94 
95 public:
96  const ProteicAlphabet* getAlphabet() const { return dynamic_cast<const ProteicAlphabet*>(AbstractFrequenciesSet::getAlphabet()); }
97 
98  void setTransposeMatrixOfPpalAxes(const RowMatrix<double>& matrix) { tPpalAxes_ = matrix; }
99  void setMatrixOfRowCoords(const RowMatrix<double>& matrix) { rowCoords_ = matrix; }
100  void setNbrOfAxes(const size_t& nAxes) { nbrOfAxes_ = nAxes; }
101  void setModelName(const std::string& modelName) { model_ = modelName; }
102  void setVectorOfColumnWeights(const std::vector<double>& cw) { columnWeights_ = cw; }
103  void setParamValues(std::map<std::string, std::string>& valuesSettings) {paramValues_ = valuesSettings;}
104 
105  void setFrequencies(const std::vector<double>& frequencies) throw (DimensionException, Exception);
106 
107  void defineParameters();
108  void fireParameterChanged(const ParameterList& parameters);
109  void updateFrequencies() throw (Exception);
110 
111  void initSet(CoalaCore* coala);
112 
113  void computeReversePCA(const std::vector<double>& positions, std::vector<double>& tmpFreqs) throw (Exception);
114  void computeCoordsFirstSpacePCA(std::vector<double>& tmpFreqs, std::vector<double>& freqs) throw (Exception);
115  void computeReverseCOA(const std::vector<double>& positions, std::vector<double>& tmpFreqs) throw (Exception);
116  void computeCoordsFirstSpaceCOA(std::vector<double>& tmpFreqs, std::vector<double>& freqs) throw (Exception);
117 
118 };
119 
120 
121 } // end of namespace bpp.
122 
123 #endif // _MVAFREQUENCIESSET_H_
124 
void computeCoordsFirstSpacePCA(std::vector< double > &tmpFreqs, std::vector< double > &freqs)
void fireParameterChanged(const ParameterList &parameters)
RowMatrix< double > tPpalAxes_
MvaFrequenciesSet * clone() const
void setVectorOfColumnWeights(const std::vector< double > &cw)
RowMatrix< double > rowCoords_
void computeReverseCOA(const std::vector< double > &positions, std::vector< double > &tmpFreqs)
STL namespace.
void setNbrOfAxes(const size_t &nAxes)
MvaFrequenciesSet(const ProteicAlphabet *alpha)
Constructor.
void computeCoordsFirstSpaceCOA(std::vector< double > &tmpFreqs, std::vector< double > &freqs)
const Alphabet * getAlphabet() const
std::map< std::string, std::string > paramValues_
Parametrize a set of state frequencies for proteins.
void computeReversePCA(const std::vector< double > &positions, std::vector< double > &tmpFreqs)
const ProteicAlphabet * getAlphabet() const
void setModelName(const std::string &modelName)
void setParamValues(std::map< std::string, std::string > &valuesSettings)
MvaFrequenciesSet & operator=(const MvaFrequenciesSet &mfs)
void initSet(CoalaCore *coala)
std::vector< double > columnWeights_
void setFrequencies(const std::vector< double > &frequencies)
Set the parameters in order to match a given set of frequencies.
void setTransposeMatrixOfPpalAxes(const RowMatrix< double > &matrix)
A frequencies set used to estimate frequencies at the root with the COaLA model. Frequencies at the r...
void setMatrixOfRowCoords(const RowMatrix< double > &matrix)
AbstractFrequenciesSet & operator=(const AbstractFrequenciesSet &af)
This class is the core class inherited by the Coala class. COaLA is a branch-heterogeneous amino-acid...
Definition: CoalaCore.h:66
Basic implementation of the FrequenciesSet interface.