bpp-phyl  2.1.0
Bpp/Phyl/Model/Nucleotide/HKY85.h
Go to the documentation of this file.
00001 //
00002 // File: HKY85.h
00003 // Created by: Julien Dutheil
00004 // Created on: Thu Jan 22 16:17:39 2004
00005 //
00006 
00007 /*
00008 Copyright or © or Copr. CNRS, (November 16, 2004)
00009 
00010 This software is a computer program whose purpose is to provide classes
00011 for phylogenetic data analysis.
00012 
00013 This software is governed by the CeCILL  license under French law and
00014 abiding by the rules of distribution of free software.  You can  use, 
00015 modify and/ or redistribute the software under the terms of the CeCILL
00016 license as circulated by CEA, CNRS and INRIA at the following URL
00017 "http://www.cecill.info". 
00018 
00019 As a counterpart to the access to the source code and  rights to copy,
00020 modify and redistribute granted by the license, users are provided only
00021 with a limited warranty  and the software's author,  the holder of the
00022 economic rights,  and the successive licensors  have only  limited
00023 liability. 
00024 
00025 In this respect, the user's attention is drawn to the risks associated
00026 with loading,  using,  modifying and/or developing or reproducing the
00027 software by the user in light of its specific status of free software,
00028 that may mean  that it is complicated to manipulate,  and  that  also
00029 therefore means  that it is reserved for developers  and  experienced
00030 professionals having in-depth computer knowledge. Users are therefore
00031 encouraged to load and test the software's suitability as regards their
00032 requirements in conditions enabling the security of their systems and/or 
00033 data to be ensured and,  more generally, to use and operate it in the 
00034 same conditions as regards security. 
00035 
00036 The fact that you are presently reading this means that you have had
00037 knowledge of the CeCILL license and that you accept its terms.
00038 */
00039 
00040 #ifndef _HKY85_H_
00041 #define _HKY85_H_
00042 
00043 #include "NucleotideSubstitutionModel.h"
00044 #include "../AbstractSubstitutionModel.h"
00045 
00046 #include <Bpp/Numeric/Constraints.h>
00047 
00048 // From SeqLib:
00049 #include <Bpp/Seq/Alphabet/NucleicAlphabet.h>
00050 
00051 namespace bpp
00052 {
00053 
00179 class HKY85:
00180   public virtual NucleotideSubstitutionModel,
00181   public AbstractReversibleSubstitutionModel
00182 {
00183   private:
00184     double kappa_, k1_, k2_, r_, piA_, piC_, piG_, piT_, piY_, piR_, theta_, theta1_, theta2_;
00185     mutable double exp1_, exp21_, exp22_, l_;
00186     mutable RowMatrix<double> p_;
00187 
00188   public:
00189     HKY85(
00190       const NucleicAlphabet * alpha,
00191       double kappa = 1.,
00192       double piA = 0.25,
00193       double piC = 0.25,
00194       double piG = 0.25,
00195       double piT = 0.25);
00196   
00197     virtual ~HKY85() {}
00198 
00199 #ifndef NO_VIRTUAL_COV
00200     HKY85*
00201 #else
00202     Clonable*
00203 #endif
00204     clone() const { return new HKY85(*this); }
00205 
00206   public:
00207     double Pij_t    (int i, int j, double d) const;
00208     double dPij_dt  (int i, int j, double d) const;
00209     double d2Pij_dt2(int i, int j, double d) const;
00210     const Matrix<double> & getPij_t    (double d) const;
00211     const Matrix<double> & getdPij_dt  (double d) const;
00212     const Matrix<double> & getd2Pij_dt2(double d) const;
00213 
00214     std::string getName() const { return "HKY85"; }
00215 
00219   void setFreq(std::map<int, double>& freqs);
00220   
00221   void updateMatrices();
00222 };
00223 
00224 } //end of namespace bpp.
00225 
00226 #endif  //_HKY85_H_
00227 
 All Classes Namespaces Files Functions Variables Typedefs Friends