bpp-seq3  3.0.0
CiliateNuclearGeneticCode.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_GENETICCODE_CILIATENUCLEARGENETICCODE_H
6 #define BPP_SEQ_GENETICCODE_CILIATENUCLEARGENETICCODE_H
7 
8 
9 #include "../Alphabet/NucleicAlphabet.h"
10 #include "GeneticCode.h"
11 
12 namespace bpp
13 {
20  public virtual GeneticCode
21 {
22 public:
23  CiliateNuclearGeneticCode(std::shared_ptr<const NucleicAlphabet> alphabet) :
24  GeneticCode(alphabet)
25  {
26  init_();
27  }
28 
30 
32  {
33  return new CiliateNuclearGeneticCode(*this);
34  }
35 
36 public:
37  size_t getNumberOfStopCodons() const { return 1; }
38 
39  std::vector<int> getStopCodonsAsInt() const
40  {
41  return std::vector<int>({56});
42  }
43 
44  std::vector<std::string> getStopCodonsAsChar() const
45  {
46  return std::vector<std::string>({"TGA"});
47  }
48 
49  bool isStop(int state) const
50  {
51  // Test:
52  codonAlphabet_->intToChar(state); // throw exception if invalid state!
53  return state == 56;
54  }
55 
56  bool isStop(const std::string& state) const
57  {
58  return codonAlphabet_->charToInt(state) == 56;
59  }
60 
61  bool isAltStart(int state) const
62  {
63  // Test:
64  codonAlphabet_->intToChar(state); // throw exception if invalid state!
65  return state == 62 || state == 30;
66  }
67 
68  bool isAltStart(const std::string& state) const
69  {
70  int i = codonAlphabet_->charToInt(state);
71  return i == 62 || i == 30;
72  }
73 
74 private:
75  void init_();
76 };
77 } // end of namespace bpp.
78 #endif // BPP_SEQ_GENETICCODE_CILIATENUCLEARGENETICCODE_H
This class implements the mold, protozoan, and coelenterate mitochondrial code and the Mycoplasma/Spi...
bool isAltStart(int state) const
Tells is a particular codon is an alternative start codon.
virtual CiliateNuclearGeneticCode * clone() const
std::vector< int > getStopCodonsAsInt() const
bool isStop(int state) const
Tells is a particular codon is a stop codon.
bool isStop(const std::string &state) const
Tells is a particular codon is a stop codon.
std::vector< std::string > getStopCodonsAsChar() const
CiliateNuclearGeneticCode(std::shared_ptr< const NucleicAlphabet > alphabet)
bool isAltStart(const std::string &state) const
Tells is a particular codon is an alternative start codon.
Partial implementation of the Transliterator interface for genetic code object.
Definition: GeneticCode.h:50
std::shared_ptr< const CodonAlphabet > codonAlphabet_
Definition: GeneticCode.h:52
This alphabet is used to deal NumericAlphabet.