bpp-seq3  3.0.0
VertebrateMitochondrialGeneticCode.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_VERTEBRATEMITOCHONDRIALGENETICCODE_H
6 #define BPP_SEQ_GENETICCODE_VERTEBRATEMITOCHONDRIALGENETICCODE_H
7 
8 
9 #include "../Alphabet/NucleicAlphabet.h"
10 #include "GeneticCode.h"
11 
12 namespace bpp
13 {
19  public virtual GeneticCode
20 {
21 public:
22  VertebrateMitochondrialGeneticCode(std::shared_ptr<const NucleicAlphabet> alphabet) :
23  GeneticCode(alphabet)
24  {
25  init_();
26  }
27 
29 
31  {
32  return new VertebrateMitochondrialGeneticCode(*this);
33  }
34 
35 public:
36  size_t getNumberOfStopCodons() const { return 4; }
37 
38  std::vector<int> getStopCodonsAsInt() const
39  {
40  return std::vector<int>({8, 10, 48, 50});
41  }
42 
43  std::vector<std::string> getStopCodonsAsChar() const
44  {
45  return std::vector<std::string>({"AGA", "AGG", "TAA", "TAG"});
46  }
47 
48  bool isStop(int state) const
49  {
50  // Test:
51  codonAlphabet_->intToChar(state); // throw exception if invalid state!
52  return state == 48 || state == 50 || state == 8 || state == 10;
53  }
54 
55  bool isStop(const std::string& state) const
56  {
57  int i = codonAlphabet_->charToInt(state);
58  return i == 48 || i == 50 || i == 8 || i == 10;
59  }
60 
61  bool isAltStart(int state) const
62  {
63  // Test:
64  codonAlphabet_->intToChar(state); // throw exception if invalid state!
65  return state == 12 || state == 13 || state == 15 || state == 46;
66  }
67 
68  bool isAltStart(const std::string& state) const
69  {
70  int i = codonAlphabet_->charToInt(state);
71  return i == 12 || i == 13 || i == 15 || i == 46;
72  }
73 
74 private:
75  void init_();
76 };
77 } // end of namespace bpp.
78 #endif // BPP_SEQ_GENETICCODE_VERTEBRATEMITOCHONDRIALGENETICCODE_H
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 class implements the vertebrate mitochondrial genetic code as describe on the NCBI web site: htt...
bool isStop(const std::string &state) const
Tells is a particular codon is a stop codon.
bool isAltStart(const std::string &state) const
Tells is a particular codon is an alternative start codon.
virtual VertebrateMitochondrialGeneticCode * clone() const
std::vector< std::string > getStopCodonsAsChar() const
VertebrateMitochondrialGeneticCode(std::shared_ptr< const NucleicAlphabet > alphabet)
bool isAltStart(int state) const
Tells is a particular codon is an alternative start codon.
bool isStop(int state) const
Tells is a particular codon is a stop codon.
This alphabet is used to deal NumericAlphabet.