bpp-seq3  3.0.0
EchinodermMitochondrialGeneticCode.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_ECHINODERMMITOCHONDRIALGENETICCODE_H
6 #define BPP_SEQ_GENETICCODE_ECHINODERMMITOCHONDRIALGENETICCODE_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  EchinodermMitochondrialGeneticCode(std::shared_ptr<const NucleicAlphabet> alphabet) :
24  GeneticCode(alphabet)
25  {
26  init_();
27  }
28 
30 
32  {
33  return new EchinodermMitochondrialGeneticCode(*this);
34  }
35 
36 public:
37  size_t getNumberOfStopCodons() const { return 2; }
38 
39  std::vector<int> getStopCodonsAsInt() const
40  {
41  return std::vector<int>({48, 50});
42  }
43 
44  std::vector<std::string> getStopCodonsAsChar() const
45  {
46  return std::vector<std::string>({"TAA", "TAG"});
47  }
48 
49  bool isStop(int state) const
50  {
51  // Test:
52  codonAlphabet_->intToChar(state); // throw exception if invalid state!
53  return state == 48 || state == 50;
54  }
55 
56  bool isStop(const std::string& state) const
57  {
58  int i = codonAlphabet_->charToInt(state);
59  return i == 48 || i == 50;
60  }
61 
62  bool isAltStart(int state) const
63  {
64  // Test:
65  codonAlphabet_->intToChar(state); // throw exception if invalid state!
66  return state == 46;
67  }
68 
69  bool isAltStart(const std::string& state) const
70  {
71  int i = codonAlphabet_->charToInt(state);
72  return i == 46;
73  }
74 
75 private:
76  void init_();
77 };
78 } // end of namespace bpp.
79 #endif // BPP_SEQ_GENETICCODE_ECHINODERMMITOCHONDRIALGENETICCODE_H
This class implements the Echinoderm and Faltworms Mitochondrial genetic code as describe on the NCBI...
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.
EchinodermMitochondrialGeneticCode(std::shared_ptr< const NucleicAlphabet > alphabet)
bool isAltStart(const std::string &state) const
Tells is a particular codon is an alternative start codon.
virtual EchinodermMitochondrialGeneticCode * clone() const
std::vector< std::string > getStopCodonsAsChar() const
bool isAltStart(int 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.