bpp-seq3  3.0.0
RNY.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_RNY_H
6 #define BPP_SEQ_ALPHABET_RNY_H
7 
8 #include <string>
9 
10 #include "AbstractAlphabet.h"
11 #include "NucleicAlphabet.h"
12 
27 namespace bpp
28 {
29 class RNY : public AbstractAlphabet
30 {
31 private:
32  std::shared_ptr<const NucleicAlphabet> nuclalph_;
33 
34 public:
35  RNY(std::shared_ptr<const NucleicAlphabet> na);
36 
37  RNY(const RNY& bia) : AbstractAlphabet(bia), nuclalph_(bia.nuclalph_) {}
38 
39  RNY& operator=(const RNY& bia)
40  {
42  return *this;
43  }
44 
45  RNY* clone() const
46  {
47  return new RNY(*this);
48  }
49 
50  ~RNY() {}
51 
52 public:
53  int charToInt(const std::string& state) const;
54  std::string intToChar(int state) const;
55 
56  bool containsGap(const std::string& state) const;
57 
58  unsigned int getSize() const { return 36; }
59  unsigned int getNumberOfTypes() const { return 80; }
60  int getUnknownCharacterCode() const { return 350; }
61  bool isGap(int state) const;
62  bool isResolvedIn(int state1, int state2) const;
63  std::vector<int> getAlias(int state) const;
64  std::vector<std::string> getAlias(const std::string& state) const;
65  bool isUnresolved(int state) const;
66  bool isUnresolved(const std::string& state) const;
67 
68  std::string getAlphabetType() const { return "RNY(letter=" + nuclalph_->getAlphabetType() + ")"; }
69 
70  std::shared_ptr<const NucleicAlphabet> getLetterAlphabet() const
71  {
72  return nuclalph_;
73  }
74 
75 public:
86  std::string getRNY(const std::string&, const std::string&, const std::string&) const;
87 
88  int getRNY(int, int, int, const Alphabet&) const;
89 };
90 }
91 #endif // BPP_SEQ_ALPHABET_RNY_H
A partial implementation of the Alphabet interface.
AbstractAlphabet & operator=(const AbstractAlphabet &alph)
The Alphabet interface.
Definition: Alphabet.h:99
Definition: RNY.h:30
bool isGap(int state) const
Definition: RNY.cpp:409
bool containsGap(const std::string &state) const
Definition: RNY.cpp:414
unsigned int getNumberOfTypes() const
Get the number of distinct states in alphabet (e.g. return 15 for DNA alphabet). This is the number o...
Definition: RNY.h:59
std::string getAlphabetType() const
Identification method.
Definition: RNY.h:68
RNY(const RNY &bia)
Definition: RNY.h:37
std::shared_ptr< const NucleicAlphabet > nuclalph_
Definition: RNY.h:32
RNY * clone() const
Definition: RNY.h:45
bool isUnresolved(int state) const
Definition: RNY.cpp:424
std::vector< int > getAlias(int state) const
Get all resolved states that match a generic state.
Definition: RNY.cpp:153
int getUnknownCharacterCode() const
Definition: RNY.h:60
int charToInt(const std::string &state) const
Give the int description of a state given its string description.
Definition: RNY.cpp:431
std::string intToChar(int state) const
Give the string description of a state given its int description.
Definition: RNY.cpp:442
RNY(std::shared_ptr< const NucleicAlphabet > na)
Definition: RNY.cpp:17
std::string getRNY(const std::string &, const std::string &, const std::string &) const
Get the char code for a triplet given the char code of the three underlying positions.
Definition: RNY.cpp:297
std::shared_ptr< const NucleicAlphabet > getLetterAlphabet() const
Definition: RNY.h:70
~RNY()
Definition: RNY.h:50
bool isResolvedIn(int state1, int state2) const
Tells if a given (potentially unresolved) state can be resolved in another resolved state.
Definition: RNY.cpp:239
unsigned int getSize() const
Get the number of resolved states in the alphabet (e.g. return 4 for DNA alphabet)....
Definition: RNY.h:58
RNY & operator=(const RNY &bia)
Definition: RNY.h:39
This alphabet is used to deal NumericAlphabet.