bpp-phyl  2.2.0
MixedSubstitutionModel.h
Go to the documentation of this file.
1 //
2 // File: MixedSubstitutionModel.h
3 // Created by: Laurent Gueguen
4 //
5 
6 /*
7  Copyright or © or Copr. Bio++ Development Team, (November 16, 2004)
8 
9  This software is a computer program whose purpose is to provide classes
10  for phylogenetic data analysis.
11 
12  This software is governed by the CeCILL license under French law and
13  abiding by the rules of distribution of free software. You can use,
14  modify and/ or redistribute the software under the terms of the CeCILL
15  license as circulated by CEA, CNRS and INRIA at the following URL
16  "http://www.cecill.info".
17 
18  As a counterpart to the access to the source code and rights to copy,
19  modify and redistribute granted by the license, users are provided only
20  with a limited warranty and the software's author, the holder of the
21  economic rights, and the successive licensors have only limited
22  liability.
23 
24  In this respect, the user's attention is drawn to the risks associated
25  with loading, using, modifying and/or developing or reproducing the
26  software by the user in light of its specific status of free software,
27  that may mean that it is complicated to manipulate, and that also
28  therefore means that it is reserved for developers and experienced
29  professionals having in-depth computer knowledge. Users are therefore
30  encouraged to load and test the software's suitability as regards their
31  requirements in conditions enabling the security of their systems and/or
32  data to be ensured and, more generally, to use and operate it in the
33  same conditions as regards security.
34 
35  The fact that you are presently reading this means that you have had
36  knowledge of the CeCILL license and that you accept its terms.
37 */
38 
39 #ifndef _MIXEDSUBSTITUTIONMODEL_H_
40 #define _MIXEDSUBSTITUTIONMODEL_H_
41 
42 #include "SubstitutionModel.h"
43 // #include <Bpp/Seq/Alphabet.all>
44 
45 #include <vector>
46 #include <string>
47 #include <map>
48 #include <cstring> // C lib for string copy
49 
50 namespace bpp
51 {
60  public virtual SubstitutionModel
61  {
62  public:
64 
66 
67  virtual MixedSubstitutionModel* clone() const = 0;
68 
69  public:
70 
74  virtual const SubstitutionModel* getNModel(size_t i) const = 0;
75 
76  virtual SubstitutionModel* getNModel(size_t i) = 0;
77 
82  virtual double getNProbability(size_t i) const = 0;
83 
84  virtual const std::vector<double>& getProbabilities() const = 0;
85 
90  virtual void setNProbability(size_t i, double prob) = 0;
91 
92  virtual size_t getNumberOfModels() const = 0;
93 
98  virtual const std::vector<double>& getVRates() const = 0;
99 
104  virtual double getNRate(size_t i) const = 0;
105 
116  virtual void setVRates(const Vdouble& vd) = 0;
117 
123  virtual void normalizeVRates() = 0;
124 
125  /*
126  *@brief Returns the vector of numbers of the submodels in the
127  *mixture that match a description.
128  *
129  */
130 
131  virtual Vint getSubmodelNumbers(std::string& desc) const = 0;
132 
133 
134  };
135 } // end of namespace bpp.
136 
137 #endif // _MIXEDSUBSTITUTIONMODEL_H_
Interface for all substitution models.
virtual Vint getSubmodelNumbers(std::string &desc) const =0
virtual double getNProbability(size_t i) const =0
Returns the probability of a specific model from the mixture.
virtual const std::vector< double > & getVRates() const =0
Returns the rates of the submodels.
virtual void normalizeVRates()=0
Normalizes the rates of the submodels so that the mean rate of the mixture equals rate_...
virtual void setNProbability(size_t i, double prob)=0
Sets the probability of a specific model from the mixture.
virtual const std::vector< double > & getProbabilities() const =0
virtual void setVRates(const Vdouble &vd)=0
Sets the rates of the submodels to be proportional to a given vector, and normalizes them so that the...
virtual double getNRate(size_t i) const =0
Returns the rate of a specific submodel.
virtual size_t getNumberOfModels() const =0
virtual const SubstitutionModel * getNModel(size_t i) const =0
Returns a specific model from the mixture.
virtual MixedSubstitutionModel * clone() const =0
Interface for Substitution models, defined as a mixture of "simple" substitution models.