bpp-phyl  2.1.0
Bpp/Phyl/Mapping/SubstitutionMappingTools.h
Go to the documentation of this file.
00001 //
00002 // File: SubstitutionMappingTools.h
00003 // Created by: Julien Dutheil
00004 // Created on: Wed Apr 5 13:04 2006
00005 //
00006 
00007 /*
00008 Copyright or © or Copr. Bio++ Development Team, (November 16, 2004, 2005, 2006)
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 _SUBSTITUTIONMAPPINGTOOLS_H_
00041 #define _SUBSTITUTIONMAPPINGTOOLS_H_
00042 
00043 #include "ProbabilisticSubstitutionMapping.h"
00044 #include "SubstitutionCount.h"
00045 #include "OneJumpSubstitutionCount.h"
00046 #include "../Likelihood/DRTreeLikelihood.h"
00047 
00048 namespace bpp
00049 {
00050 
00063 class SubstitutionMappingTools
00064 {
00065   public:
00066     SubstitutionMappingTools() {}
00067     virtual ~SubstitutionMappingTools() {}
00068     
00069   public:
00070     
00081     static ProbabilisticSubstitutionMapping* computeSubstitutionVectors(
00082       const DRTreeLikelihood& drtl,
00083       SubstitutionCount& substitutionCount,
00084       bool verbose = true) throw (Exception);
00085     
00106     static ProbabilisticSubstitutionMapping* computeSubstitutionVectorsNoAveraging(
00107       const DRTreeLikelihood& drtl,
00108       SubstitutionCount& substitutionCount,
00109       bool verbose = true) throw (Exception);
00110     
00129     static ProbabilisticSubstitutionMapping* computeSubstitutionVectorsNoAveragingMarginal(
00130       const DRTreeLikelihood& drtl,
00131       SubstitutionCount& substitutionCount,
00132       bool verbose = true) throw (Exception);
00133     
00149     static ProbabilisticSubstitutionMapping* computeSubstitutionVectorsMarginal(
00150       const DRTreeLikelihood& drtl,
00151       SubstitutionCount& substitutionCount,
00152       bool verbose = true) throw (Exception);
00153   
00154 
00162     static ProbabilisticSubstitutionMapping* computeOneJumpProbabilityVectors(
00163       const DRTreeLikelihood& drtl,
00164       bool verbose = true) throw (Exception)
00165     {
00166       OneJumpSubstitutionCount ojsm(0);
00167       return computeSubstitutionVectors(drtl, ojsm, 0);
00168     }
00169 
00181     static void writeToStream(
00182       const ProbabilisticSubstitutionMapping& substitutions,
00183       const SiteContainer& sites,
00184       size_t type,
00185       std::ostream& out)
00186       throw (IOException);
00187   
00196     static void readFromStream(std::istream& in, ProbabilisticSubstitutionMapping& substitutions, size_t type)
00197       throw (IOException);
00198 
00206     static std::vector<double> computeTotalSubstitutionVectorForSite(const SubstitutionMapping& smap, size_t siteIndex);
00207 
00219     static double computeNormForSite(const SubstitutionMapping& smap, size_t siteIndex);
00220     
00228     static std::vector<double> computeSumForBranch(const SubstitutionMapping& smap, size_t branchIndex);
00229  
00237     static std::vector<double> computeSumForSite(const SubstitutionMapping& smap, size_t siteIndex);
00238  };
00239 
00240 } //end of namespace bpp.
00241 
00242 #endif //_SUBSTITUTIONMAPPINGTOOLS_H_
00243 
 All Classes Namespaces Files Functions Variables Typedefs Friends