bpp-phyl  2.2.0
DSO78.h
Go to the documentation of this file.
1 //
2 // File: DSO78.h
3 // Created by: Julien Dutheil
4 // Created on: Tue Oct 05 18:49:44 2004
5 //
6 
7 /*
8  Copyright or © 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 _DSO78_H_
41 #define _DSO78_H_
42 
44 #include "../AbstractSubstitutionModel.h"
45 #include "../FrequenciesSet/ProteinFrequenciesSet.h"
46 
47 // From SeqLib:
48 #include <Bpp/Seq/Alphabet/ProteicAlphabet.h>
49 
50 namespace bpp
51 {
52 
66  class DSO78 :
67  public virtual ProteinSubstitutionModel,
69  {
70  private:
72 
73  public:
79  DSO78(const ProteicAlphabet* alpha);
80 
89  DSO78(const ProteicAlphabet* alpha, ProteinFrequenciesSet* freqSet, bool initFreqs=false);
90 
91  DSO78(const DSO78& model) :
92  AbstractParameterAliasable(model),
93  //AbstractSubstitutionModel(model),
95  freqSet_(dynamic_cast<ProteinFrequenciesSet *>(model.freqSet_->clone()))
96  {}
97 
98  DSO78& operator=(const DSO78& model)
99  {
100  AbstractParameterAliasable::operator=(model);
103  if (freqSet_) delete freqSet_;
104  freqSet_ = dynamic_cast<ProteinFrequenciesSet *>(model.freqSet_->clone());
105  return *this;
106  }
107 
108  virtual ~DSO78() { delete freqSet_; }
109 
110 #ifndef NO_VIRTUAL_COV
111  DSO78*
112 #else
113  Clonable*
114 #endif
115  clone() const { return new DSO78(*this); }
116 
117  public:
118  std::string getName() const
119  {
120  if (freqSet_->getNamespace().find("DSO78+F.")!=std::string::npos)
121  return "DSO78+F";
122  else
123  return "DSO78";
124  }
125 
126  void fireParameterChanged(const ParameterList& parameters)
127  {
128  freqSet_->matchParametersValues(parameters);
131  }
132 
134  {
135  delete freqSet_;
136  freqSet_ = dynamic_cast<ProteinFrequenciesSet*>(freqSet.clone());
137  resetParameters_();
138  addParameters_(freqSet_->getParameters());
139  }
140 
141  const FrequenciesSet* getFrequenciesSet() const { return freqSet_; }
142 
143  void setFreqFromData(const SequenceContainer& data, double pseudoCount = 0);
144 
145  };
146 
147 } //end of namespace bpp.
148 
149 #endif //_DSO78_H_
150 
virtual void fireParameterChanged(const ParameterList &parameters)
Tells the model that a parameter value has changed.
Specialized interface for protein substitution model.
virtual const std::vector< double > getFrequencies() const =0
Vdouble freq_
The vector of equilibrium frequencies.
Parametrize a set of state frequencies.
ProteinFrequenciesSet * clone() const =0
AbstractSubstitutionModel & operator=(const AbstractSubstitutionModel &model)
Partial implementation of the ReversibleSubstitutionModel interface.
void setFrequenciesSet(const ProteinFrequenciesSet &freqSet)
Definition: DSO78.h:133
DSO78(const DSO78 &model)
Definition: DSO78.h:91
virtual ~DSO78()
Definition: DSO78.h:108
DSO78 & operator=(const DSO78 &model)
Definition: DSO78.h:98
const FrequenciesSet * getFrequenciesSet() const
If the model owns a FrequenciesSet, returns a pointer to it, otherwise return 0.
Definition: DSO78.h:141
Parametrize a set of state frequencies for proteins.
void setFreqFromData(const SequenceContainer &data, double pseudoCount=0)
Set equilibrium frequencies equal to the frequencies estimated from the data.
Definition: DSO78.cpp:80
DSO78 * clone() const
Definition: DSO78.h:115
void fireParameterChanged(const ParameterList &parameters)
Tells the model that a parameter value has changed.
Definition: DSO78.h:126
DSO78(const ProteicAlphabet *alpha)
Build a simple DSO78 model, with original equilibrium frequencies.
Definition: DSO78.cpp:53
std::string getName() const
Get the name of the model.
Definition: DSO78.h:118
The Dayhoff, Schwartz and Orcutt substitution model for proteins.
Definition: DSO78.h:66
ProteinFrequenciesSet * freqSet_
Definition: DSO78.h:71