bpp-seq3  3.0.0
BinaryAlphabet.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_ALPHABET_BINARYALPHABET_H
6 #define BPP_SEQ_ALPHABET_BINARYALPHABET_H
7 
8 
9 #include "AbstractAlphabet.h"
10 
11 namespace bpp
12 {
19  public AbstractAlphabet
20 {
21 public:
22  // class constructor
24 
26 
28  {
30 
31  return *this;
32  }
33 
35  {
36  return new BinaryAlphabet(*this);
37  }
38 
39  // class destructor
40  virtual ~BinaryAlphabet() {}
41 
42 public:
43  unsigned int getSize() const { return 2; }
44  unsigned int getNumberOfTypes() const { return 2; }
45  std::string getAlphabetType() const { return "Binary"; }
46  int getUnknownCharacterCode() const { return 2; }
47  bool isUnresolved(int state) const { return state > 1; }
48  bool isUnresolved(const std::string& state) const { return charToInt(state) > 1; }
49 
50  bool isResolvedIn(int state1, int state2) const;
51 
52  std::vector<int> getAlias(int state) const;
53  std::vector<std::string> getAlias(const std::string& state) const;
54 };
55 } // end of namespace bpp.
56 #endif // BPP_SEQ_ALPHABET_BINARYALPHABET_H
A partial implementation of the Alphabet interface.
AbstractAlphabet & operator=(const AbstractAlphabet &alph)
int charToInt(const std::string &state) const
Give the int description of a state given its string description.
The BinaryAlphabet class, letters are 0 and 1.
BinaryAlphabet(const BinaryAlphabet &bia)
bool isUnresolved(int state) const
bool isResolvedIn(int state1, int state2) const
Tells if a given (potentially unresolved) state can be resolved in another resolved state.
bool isUnresolved(const std::string &state) const
BinaryAlphabet * clone() const
BinaryAlphabet & operator=(const BinaryAlphabet &bia)
virtual ~BinaryAlphabet()
int getUnknownCharacterCode() const
unsigned int getNumberOfTypes() const
Get the number of distinct states in alphabet (e.g. return 15 for DNA alphabet). This is the number o...
unsigned int getSize() const
Get the number of resolved states in the alphabet (e.g. return 4 for DNA alphabet)....
std::string getAlphabetType() const
Identification method.
std::vector< int > getAlias(int state) const
Get all resolved states that match a generic state.
This alphabet is used to deal NumericAlphabet.