bpp-seq  2.2.0
CodonSiteTools.h
Go to the documentation of this file.
1 //
2 // File CodonSiteTools.h
3 // Author : Sylvain Glémin
4 // Last modification : November 2005
5 //
6 
7 /*
8 Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
9 
10 This software is a computer program whose purpose is to provide classes
11 for sequences 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 _CODONSITETOOLS_H_
41 #define _CODONSITETOOLS_H_
42 
43 #include "SymbolListTools.h"
44 #include "Site.h"
45 #include "Alphabet/CodonAlphabet.h"
47 
48 #include <Bpp/Exceptions.h>
49 
50 // From the STL:
51 #include <map>
52 
53 namespace bpp
54 {
55 
61  public SymbolListTools
62 {
63  public:
65  virtual ~CodonSiteTools() {}
66 
67  public:
68 
76  static bool hasGapOrStop(const Site& site, const GeneticCode& gCode) throw (AlphabetException);
77 
85  static bool hasStop(const Site& site, const GeneticCode& gCode) throw (AlphabetException);
86 
94  static bool isMonoSitePolymorphic(const Site& site) throw (AlphabetException, EmptySiteException);
95 
105  static bool isSynonymousPolymorphic(const Site& site, const GeneticCode& gCode)
107 
123  static Site* generateCodonSiteWithoutRareVariant(const Site& site, const GeneticCode& gCode, double freqmin)
125 
126 
134  static size_t numberOfDifferences(int i, int j, const CodonAlphabet& ca);
135 
148  static double numberOfSynonymousDifferences(int i, int j, const GeneticCode& gCode, bool minchange=false);
149 
171  static double piSynonymous(const Site& site, const GeneticCode& gCode, bool minchange = false)
173 
194  static double piNonSynonymous(const Site& site, const GeneticCode& gCode, bool minchange = false)
196 
197 
210  static double numberOfSynonymousPositions(int i, const GeneticCode& gCode, double ratio = 1.0) throw (Exception);
211 
228  static double meanNumberOfSynonymousPositions(const Site& site, const GeneticCode& gCode, double ratio = 1)
230 
257  static size_t numberOfSubsitutions(const Site& site, const GeneticCode& gCode, double freqmin = 0.)
259 
277  static size_t numberOfNonSynonymousSubstitutions(const Site& site, const GeneticCode& gCode, double freqmin = 0.)
279 
316  static std::vector<size_t> fixedDifferences(const Site& siteIn, const Site& siteOut, int i, int j, const GeneticCode& gCode)
318 
326  static bool isFourFoldDegenerated(const Site& site, const GeneticCode& gCode);
327 
328 };
329 
330 } //end of namespace bpp.
331 
332 #endif //_CONDONSITETOOLS_H_
333 
static size_t numberOfNonSynonymousSubstitutions(const Site &site, const GeneticCode &gCode, double freqmin=0.)
Return the number of Non Synonymous subsitutions per codon site.
static size_t numberOfSubsitutions(const Site &site, const GeneticCode &gCode, double freqmin=0.)
Return the number of subsitutions per codon site.
static bool isMonoSitePolymorphic(const Site &site)
Method to know if a polymorphic codon site is polymorphic at only one site.
Utilitary functions for codon sites.
This alphabet is used to deal NumericAlphabet.
static bool isFourFoldDegenerated(const Site &site, const GeneticCode &gCode)
static double numberOfSynonymousPositions(int i, const GeneticCode &gCode, double ratio=1.0)
Return the number of synonymous positions of a codon.
STL namespace.
static double meanNumberOfSynonymousPositions(const Site &site, const GeneticCode &gCode, double ratio=1)
Return the mean number of synonymous positions per codon site.
static double piNonSynonymous(const Site &site, const GeneticCode &gCode, bool minchange=false)
Compute the non-synonymous pi per codon site.
static bool isSynonymousPolymorphic(const Site &site, const GeneticCode &gCode)
Method to know if polymorphism at a codon site is synonymous.
static size_t numberOfDifferences(int i, int j, const CodonAlphabet &ca)
Compute the number of differences between two codons.
Codon alphabet class.
Definition: CodonAlphabet.h:63
Utilitary functions dealing with both sites and sequences.
Exception sent when a empty site is found.
static bool hasStop(const Site &site, const GeneticCode &gCode)
Method to know if a codon site contains stop codon or not.
static Site * generateCodonSiteWithoutRareVariant(const Site &site, const GeneticCode &gCode, double freqmin)
generate a codon site without rare variants
The alphabet exception base class.
static double piSynonymous(const Site &site, const GeneticCode &gCode, bool minchange=false)
Compute the synonymous pi per codon site.
static bool hasGapOrStop(const Site &site, const GeneticCode &gCode)
Method to know if a codon site contains gap(s) or stop codons.
static double numberOfSynonymousDifferences(int i, int j, const GeneticCode &gCode, bool minchange=false)
Compute the number of synonymous differences between two codons.
The Site class.
Definition: Site.h:61
Exception thrown when two alphabets do not match.
Partial implementation of the Transliterator interface for genetic code object.
Definition: GeneticCode.h:79
virtual ~CodonSiteTools()
static std::vector< size_t > fixedDifferences(const Site &siteIn, const Site &siteOut, int i, int j, const GeneticCode &gCode)
Return a vector with the number of fixed synonymous and non-synonymous differences per codon site...