bpp-phyl  2.1.0
Bpp/Phyl/Model/AbstractBiblioMixedSubstitutionModel.h
Go to the documentation of this file.
00001 //
00002 // File: AbstractBiblioMixedSubstitutionModel.h
00003 // Created by: Laurent Gueguen
00004 // Created on: lundi 18 juillet 2011, à 15h 17
00005 //
00006 
00007 /*
00008    Copyright or © or Copr. Bio++ Development Team, (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 _ABSTRACTBIBLIOMIXEDSUBSTITUTIONMODEL_H_
00041 #define _ABSTRACTBIBLIOMIXEDSUBSTITUTIONMODEL_H_
00042 
00043 #include "AbstractBiblioSubstitutionModel.h"
00044 #include "MixedSubstitutionModel.h"
00045 
00046 namespace bpp
00047 {
00053 class AbstractBiblioMixedSubstitutionModel :
00054   public virtual MixedSubstitutionModel,
00055   public AbstractBiblioSubstitutionModel
00056 {
00057 public:
00058   AbstractBiblioMixedSubstitutionModel(const std::string& prefix);
00059 
00060   AbstractBiblioMixedSubstitutionModel(const AbstractBiblioMixedSubstitutionModel& model);
00061 
00062   AbstractBiblioMixedSubstitutionModel& operator=(const AbstractBiblioMixedSubstitutionModel& model);
00063 
00064   virtual ~AbstractBiblioMixedSubstitutionModel();
00065 
00066 #ifndef NO_VIRTUAL_COV
00067   virtual AbstractBiblioMixedSubstitutionModel* clone() const = 0;
00068 #endif
00069 
00070 public:
00071   virtual const MixedSubstitutionModel& getMixedModel() const = 0;
00072 
00073   /*
00074      *@brief Returns the submodel from the mixture.
00075    *
00076    */
00077   const SubstitutionModel* getNModel(size_t i) const
00078   {
00079     return getMixedModel().getNModel(i);
00080   }
00081 
00082   SubstitutionModel* getNModel(size_t i)
00083   {
00084     return getMixedModel().getNModel(i);
00085   }
00086 
00090   double getNProbability(size_t i) const
00091   {
00092     return getMixedModel().getNProbability(i);
00093   }
00094 
00101   const std::vector<double>& getProbabilities() const
00102   {
00103     return getMixedModel().getProbabilities();
00104   }
00105 
00110   void setNProbability(size_t i, double prob)
00111   {
00112     getMixedModel().setNProbability(i, prob);
00113   }
00114 
00119   size_t getNumberOfModels() const
00120   {
00121     return getMixedModel().getNumberOfModels();
00122   }
00123 
00128   void setVRates(const Vdouble& vd)
00129   {
00130     getMixedModel().setVRates(vd);
00131   }
00132 
00137   void normalizeVRates()
00138   {
00139     getMixedModel().normalizeVRates();
00140   }
00141 
00146   const std::vector<double>& getVRates() const
00147   {
00148     return getMixedModel().getVRates();
00149   }
00150 
00154   double getNRate(size_t i) const
00155   {
00156     return getMixedModel().getNRate(i);
00157   }
00158 
00159   /*
00160      *@brief Returns the vector of numbers of the submodels in the
00161      *mixture that match a description.
00162    *
00163    */
00164   Vint getSubmodelNumbers(std::string& desc) const;
00165   
00166 private:
00167   virtual MixedSubstitutionModel& getMixedModel() = 0;
00168 
00169 };
00170 } // end of namespace bpp.
00171 
00172 #endif  // _AbstractBiblioMixedSubstitutionModel_H_
00173 
 All Classes Namespaces Files Functions Variables Typedefs Friends