bpp-seq3  3.0.0
NucleicAcidsReplication.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_NUCLEICACIDSREPLICATION_H
6 #define BPP_SEQ_NUCLEICACIDSREPLICATION_H
7 
8 
10 #include "Transliterator.h"
11 
12 // From the STL:
13 #include <map>
14 #include <memory>
15 
16 namespace bpp
17 {
33 {
34 private:
35  std::shared_ptr<const NucleicAlphabet> nuc1_, nuc2_;
36  mutable std::map<int, int> trans_;
37 
38 public:
40  std::shared_ptr<const NucleicAlphabet> nuc1,
41  std::shared_ptr<const NucleicAlphabet> nuc2);
42 
45  nuc1_(nar.nuc1_), nuc2_(nar.nuc2_), trans_(nar.trans_)
46  {}
47 
49  {
50  ReverseTransliteratorInterface::operator=(nar);
51  nuc1_ = nar.nuc1_;
52  nuc2_ = nar.nuc2_;
53  trans_ = nar.trans_;
54  return *this;
55  }
56 
58 
59 public:
60  std::shared_ptr<const Alphabet> getSourceAlphabet() const override { return nuc1_; }
61 
62  const Alphabet& sourceAlphabet() const override { return *nuc1_; }
63 
64  std::shared_ptr<const Alphabet> getTargetAlphabet() const override { return nuc2_; }
65 
66  const Alphabet& targetAlphabet() const override { return *nuc2_; }
67 
68  int translate(int state) const override;
69 
70  std::string translate(const std::string& state) const override;
71 
72  std::unique_ptr<Sequence> translate(const SequenceInterface& sequence) const override;
73 
74  int reverse(int state) const override;
75 
76  std::string reverse(const std::string& state) const override;
77 
78  std::unique_ptr<Sequence> reverse(const SequenceInterface& sequence) const override;
79 };
80 } // end of namespace bpp.
81 #endif // BPP_SEQ_NUCLEICACIDSREPLICATION_H
The Alphabet interface.
Definition: Alphabet.h:99
Replication between to nucleic acids.
const Alphabet & targetAlphabet() const override
Get the target alphabet.
std::shared_ptr< const NucleicAlphabet > nuc2_
std::shared_ptr< const Alphabet > getTargetAlphabet() const override
Get the target alphabet.
std::shared_ptr< const Alphabet > getSourceAlphabet() const override
Get the source alphabet.
int translate(int state) const override
Translate a given state coded as a int from source alphabet to target alphabet.
NucleicAcidsReplication(const NucleicAcidsReplication &nar)
int reverse(int state) const override
Translate a given state coded as a int from target alphabet to source alphabet.
const Alphabet & sourceAlphabet() const override
Get the source alphabet.
NucleicAcidsReplication(std::shared_ptr< const NucleicAlphabet > nuc1, std::shared_ptr< const NucleicAlphabet > nuc2)
std::shared_ptr< const NucleicAlphabet > nuc1_
NucleicAcidsReplication & operator=(const NucleicAcidsReplication &nar)
The same as previous, but can perform the reverse translation, eg: RNA -> DNA and DNA -> RNA;.
The sequence interface.
Definition: Sequence.h:34
This alphabet is used to deal NumericAlphabet.