bpp-seq  2.2.0
SiteTools.h
Go to the documentation of this file.
1 //
2 // File SiteTools.h
3 // Author: Julien Dutheil
4 // Guillaume Deuchst
5 // Last modification : Friday August 8 2003
6 //
7 
8 /*
9  Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
10 
11  This software is a computer program whose purpose is to provide classes
12  for sequences analysis.
13 
14  This software is governed by the CeCILL license under French law and
15  abiding by the rules of distribution of free software. You can use,
16  modify and/ or redistribute the software under the terms of the CeCILL
17  license as circulated by CEA, CNRS and INRIA at the following URL
18  "http://www.cecill.info".
19 
20  As a counterpart to the access to the source code and rights to copy,
21  modify and redistribute granted by the license, users are provided only
22  with a limited warranty and the software's author, the holder of the
23  economic rights, and the successive licensors have only limited
24  liability.
25 
26  In this respect, the user's attention is drawn to the risks associated
27  with loading, using, modifying and/or developing or reproducing the
28  software by the user in light of its specific status of free software,
29  that may mean that it is complicated to manipulate, and that also
30  therefore means that it is reserved for developers and experienced
31  professionals having in-depth computer knowledge. Users are therefore
32  encouraged to load and test the software's suitability as regards their
33  requirements in conditions enabling the security of their systems and/or
34  data to be ensured and, more generally, to use and operate it in the
35  same conditions as regards security.
36 
37  The fact that you are presently reading this means that you have had
38  knowledge of the CeCILL license and that you accept its terms.
39  */
40 
41 #ifndef _SITETOOLS_H_
42 #define _SITETOOLS_H_
43 
44 #include "SymbolListTools.h"
45 #include "Site.h"
46 #include <Bpp/Exceptions.h>
47 
48 // From the STL:
49 #include <map>
50 
51 namespace bpp
52 {
57 class SiteTools :
58  public SymbolListTools
59 {
60 public:
61  SiteTools() {}
62  virtual ~SiteTools() {}
63 
64 public:
69  static bool hasGap(const Site& site);
70 
75  static bool isGapOnly(const Site& site);
76 
81  static bool isGapOrUnresolvedOnly(const Site& site);
82 
87  static bool hasUnknown(const Site& site);
88 
93  static bool isComplete(const Site& site);
94 
105  static bool isConstant(const Site& site, bool ignoreUnknown = false, bool unresolvedRaisesException = true) throw (EmptySiteException);
106 
112  static bool areSitesIdentical(const Site& site1, const Site& site2);
113 
128  static double variabilityShannon(const Site& site, bool resolveUnknowns) throw (EmptySiteException);
129 
143  static double variabilityFactorial(const Site& site) throw (EmptySiteException);
144 
162  static double mutualInformation(const Site& site1, const Site& site2, bool resolveUnknowns) throw (DimensionException,EmptySiteException);
163 
178  static double entropy(const Site& site, bool resolveUnknowns) throw (EmptySiteException) {
179  return variabilityShannon(site, resolveUnknowns);
180  }
181 
182 
199  static double jointEntropy(const Site& site1, const Site& site2, bool resolveUnknowns) throw (DimensionException,EmptySiteException);
200 
213  static double heterozygosity(const Site& site) throw (EmptySiteException);
214 
221  static size_t getNumberOfDistinctCharacters(const Site& site) throw (EmptySiteException);
222 
230  static bool hasSingleton(const Site& site) throw (EmptySiteException);
231 
240  static bool isParsimonyInformativeSite(const Site& site) throw (EmptySiteException);
241 
242 
249  static bool isTriplet(const Site& site) throw (EmptySiteException);
250 };
251 } // end of namespace bpp.
252 
253 #endif // _SITETOOLS_H_
254 
static double mutualInformation(const Site &site1, const Site &site2, bool resolveUnknowns)
Compute the mutual information between two sites.
Definition: SiteTools.cpp:222
static bool isConstant(const Site &site, bool ignoreUnknown=false, bool unresolvedRaisesException=true)
Tell if a site is constant, that is displaying the same state in all sequences that do not present a ...
Definition: SiteTools.cpp:141
static bool isParsimonyInformativeSite(const Site &site)
Tell if a site is a parsimony informative site.
Definition: SiteTools.cpp:374
static double entropy(const Site &site, bool resolveUnknowns)
Compute the entropy of a site. This is an alias of method variabilityShannon.
Definition: SiteTools.h:178
This alphabet is used to deal NumericAlphabet.
static bool hasUnknown(const Site &site)
Definition: SiteTools.cpp:95
static bool isGapOrUnresolvedOnly(const Site &site)
Definition: SiteTools.cpp:82
static bool isComplete(const Site &site)
Definition: SiteTools.cpp:108
static bool hasGap(const Site &site)
Definition: SiteTools.cpp:56
Utilitary functions dealing with both sites and sequences.
static double heterozygosity(const Site &site)
Compute the heterozygosity index of a site.
Definition: SiteTools.cpp:319
Exception sent when a empty site is found.
static size_t getNumberOfDistinctCharacters(const Site &site)
Give the number of distinct characters at a site.
Definition: SiteTools.cpp:333
static bool areSitesIdentical(const Site &site1, const Site &site2)
Definition: SiteTools.cpp:121
Utilitary methods dealing with sites.
Definition: SiteTools.h:57
static bool hasSingleton(const Site &site)
Tell if a site has singletons.
Definition: SiteTools.cpp:354
static bool isGapOnly(const Site &site)
Definition: SiteTools.cpp:69
static bool isTriplet(const Site &site)
Tell if a site has more than 2 distinct characters.
Definition: SiteTools.cpp:397
static double variabilityShannon(const Site &site, bool resolveUnknowns)
Compute the Shannon entropy index of a site.
Definition: SiteTools.cpp:202
The Site class.
Definition: Site.h:61
static double variabilityFactorial(const Site &site)
Compute the factorial diversity index of a site.
Definition: SiteTools.cpp:304
static double jointEntropy(const Site &site1, const Site &site2, bool resolveUnknowns)
Compute the joint entropy between two sites.
Definition: SiteTools.cpp:269
virtual ~SiteTools()
Definition: SiteTools.h:62