bpp-seq3  3.0.0
AscidianMitochondrialGeneticCode.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_ASCIDIANMITOCHONDRIALGENETICCODE_H
6 #define BPP_SEQ_GENETICCODE_ASCIDIANMITOCHONDRIALGENETICCODE_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  AscidianMitochondrialGeneticCode(std::shared_ptr<const NucleicAlphabet> alphabet) :
23  GeneticCode(alphabet)
24  {
25  init_();
26  }
27 
29 
31  {
32  return new AscidianMitochondrialGeneticCode(*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 == 8 || state == 10 || state == 48 || state == 50;
53  }
54 
55  bool isStop(const std::string& state) const
56  {
57  return isStop(codonAlphabet_->charToInt(state));
58  }
59 
60  bool isAltStart(int state) const
61  {
62  // Test:
63  codonAlphabet_->intToChar(state); // throw exception if invalid state!
64  return state == 12 || state == 46 || state == 62;
65  }
66 
67  bool isAltStart(const std::string& state) const
68  {
69  int i = codonAlphabet_->charToInt(state);
70  return i == 12 || i == 46 || i == 62;
71  }
72 
73 private:
74  void init_();
75 };
76 } // end of namespace bpp.
77 #endif // BPP_SEQ_GENETICCODE_ASCIDIANMITOCHONDRIALGENETICCODE_H
This class implements the ascidian mitochondrial genetic code as describe on the NCBI web site: http:...
bool isStop(const std::string &state) const
Tells is a particular codon is a stop codon.
AscidianMitochondrialGeneticCode(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.
virtual AscidianMitochondrialGeneticCode * clone() const
bool isAltStart(const std::string &state) const
Tells is a particular codon is an alternative start codon.
std::vector< std::string > getStopCodonsAsChar() const
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.