bpp-phyl  2.2.0
AbstractCodonFitnessSubstitutionModel.h
Go to the documentation of this file.
1 //
2 // File: AbstractCodonFitnessSubstitutionModel.h
3 // Created by: Fanny Pouyet
4 // Created on: mars 2012
5 //
6 
7 /*
8  Copyright or © or Copr. Bio++ Development Team, (November 16, 2004)
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 _ABSTRACTCODONFITNESSSUBSTITUTIONMODEL_H_
40 # define _ABSTRACTCODONFITNESSSUBSTITUTIONMODEL_H_
41 
42 # include "CodonSubstitutionModel.h"
43 #include "../FrequenciesSet/CodonFrequenciesSet.h"
44 namespace bpp
45 {
66  public virtual CodonSubstitutionModel,
67  public virtual AbstractParameterAliasable
68  {
69  private:
71  std::string fitName_;
72  public:
73  AbstractCodonFitnessSubstitutionModel(FrequenciesSet* pfitset, const std::string& prefix);
75  AbstractParameterAliasable(model),
76  pfitset_(model.pfitset_->clone()),
77  fitName_(model.fitName_)
78  {}
79 
81  AbstractParameterAliasable::operator=(model);
82  if (pfitset_) delete pfitset_;
83  pfitset_ = model.pfitset_->clone();
84  fitName_ = model.fitName_ ;
85  return *this;
86  }
87 
89 
90  public:
91  void fireParameterChanged (const ParameterList& parameters);
92  void setFreq(std::map<int, double>& frequencies);
93  const FrequenciesSet& getFreq() const { return *pfitset_; }
94  void setNamespace (const std::string& prefix){
95  pfitset_->setNamespace(prefix + fitName_);
96  }
97 
98  double getCodonsMulRate(size_t i, size_t j) const;
99 
100  const FrequenciesSet* getFitness() const { return pfitset_;}
101 
102  };
103 } // end of namespace bpp
104 # endif
AbstractCodonFitnessSubstitutionModel & operator=(const AbstractCodonFitnessSubstitutionModel &model)
FrequenciesSet * clone() const =0
Parametrize a set of state frequencies.
AbstractCodonFitnessSubstitutionModel(FrequenciesSet *pfitset, const std::string &prefix)
Abstract class for modelling of ratios of substitution rates between codons, whatever they are synony...
void setFreq(std::map< int, double > &frequencies)
Set equilibrium frequencies.
Abstract class for codon models.
virtual CodonSubstitutionModel * clone() const =0
double getCodonsMulRate(size_t i, size_t j) const
Returns the multiplicative rate specific to two codons specified by their number. The respective gene...
AbstractCodonFitnessSubstitutionModel(const AbstractCodonFitnessSubstitutionModel &model)