bpp-seq3  3.0.0
CodonSiteTools.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #ifndef BPP_SEQ_CODONSITETOOLS_H
6 #define BPP_SEQ_CODONSITETOOLS_H
7 
8 #include <Bpp/Exceptions.h>
9 
10 #include "Alphabet/CodonAlphabet.h"
12 #include "Site.h"
13 #include "SymbolListTools.h"
14 
15 // From the STL:
16 #include <map>
17 
18 namespace bpp
19 {
25  public SymbolListTools
26 {
27 public:
29  virtual ~CodonSiteTools() {}
30 
31 public:
38  static bool hasGapOrStop(const Site& site, const GeneticCode& gCode);
39 
46  static bool hasStop(const Site& site, const GeneticCode& gCode);
47 
53  static bool isMonoSitePolymorphic(const Site& site);
54 
61  static bool isSynonymousPolymorphic(const Site& site, const GeneticCode& gCode);
62 
75  static std::unique_ptr<Site> generateCodonSiteWithoutRareVariant(const Site& site, const GeneticCode& gCode, double freqmin);
76 
84  static size_t numberOfDifferences(int i, int j, const CodonAlphabet& ca);
85 
98  static double numberOfSynonymousDifferences(int i, int j, const GeneticCode& gCode, bool minchange = false);
99 
118  static double piSynonymous(const Site& site, const GeneticCode& gCode, bool minchange = false);
119 
137  static double piNonSynonymous(const Site& site, const GeneticCode& gCode, bool minchange = false);
138 
151  static double numberOfSynonymousPositions(int i, const GeneticCode& gCode, double ratio = 1.0);
152 
166  static double meanNumberOfSynonymousPositions(const Site& site, const GeneticCode& gCode, double ratio = 1);
167 
192  static size_t numberOfSubstitutions(const Site& site, const GeneticCode& gCode, double freqmin = 0.);
193 
208  static size_t numberOfNonSynonymousSubstitutions(const Site& site, const GeneticCode& gCode, double freqmin = 0.);
209 
243  static std::vector<size_t> fixedDifferences(const Site& siteIn, const Site& siteOut, int i, int j, const GeneticCode& gCode);
244 
252  static bool isFourFoldDegenerated(const Site& site, const GeneticCode& gCode);
253 };
254 } // end of namespace bpp.
255 #endif // BPP_SEQ_CODONSITETOOLS_H
Codon alphabet class.
Definition: CodonAlphabet.h:31
Utilitary functions for codon sites.
static double piNonSynonymous(const Site &site, const GeneticCode &gCode, bool minchange=false)
Compute the non-synonymous pi per codon site.
static double numberOfSynonymousPositions(int i, const GeneticCode &gCode, double ratio=1.0)
Return the number of synonymous positions of a codon.
static bool hasGapOrStop(const Site &site, const GeneticCode &gCode)
Method to know if a codon site contains gap(s) or stop codons.
static double piSynonymous(const Site &site, const GeneticCode &gCode, bool minchange=false)
Compute the synonymous pi per codon site.
static bool isFourFoldDegenerated(const Site &site, const GeneticCode &gCode)
static bool isSynonymousPolymorphic(const Site &site, const GeneticCode &gCode)
Method to know if polymorphism at a codon site is synonymous.
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.
static size_t numberOfSubstitutions(const Site &site, const GeneticCode &gCode, double freqmin=0.)
Return the number of substitutions per codon site.
static double numberOfSynonymousDifferences(int i, int j, const GeneticCode &gCode, bool minchange=false)
Compute the number of synonymous differences between two codons.
static std::unique_ptr< Site > generateCodonSiteWithoutRareVariant(const Site &site, const GeneticCode &gCode, double freqmin)
generate a codon site without rare variants
static size_t numberOfDifferences(int i, int j, const CodonAlphabet &ca)
Compute the number of differences between two codons.
static bool hasStop(const Site &site, const GeneticCode &gCode)
Method to know if a codon site contains stop codon or not.
static double meanNumberOfSynonymousPositions(const Site &site, const GeneticCode &gCode, double ratio=1)
Return the mean number of synonymous positions per codon site.
static size_t numberOfNonSynonymousSubstitutions(const Site &site, const GeneticCode &gCode, double freqmin=0.)
Return the number of Non Synonymous substitutions per codon site.
static bool isMonoSitePolymorphic(const Site &site)
Method to know if a polymorphic codon site is polymorphic at only one site.
virtual ~CodonSiteTools()
Partial implementation of the Transliterator interface for genetic code object.
Definition: GeneticCode.h:50
The Site class.
Definition: Site.h:73
Utilitary functions dealing with both sites and sequences.
This alphabet is used to deal NumericAlphabet.