bpp-seq  2.2.0
DNAToRNA.h
Go to the documentation of this file.
1 //
2 // File: DNAToRNA.h
3 // Created by: Julien Dutheil
4 // Created on: Sun Oct 12 14:39:29 2003
5 //
6 
7 /*
8 Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
9 
10 This software is a computer program whose purpose is to provide classes
11 for sequences analysis.
12 
13 This software is governed by the CeCILL license under French law and
14 abiding by the rules of distribution of free software. You can use,
15 modify and/ or redistribute the software under the terms of the CeCILL
16 license as circulated by CEA, CNRS and INRIA at the following URL
17 "http://www.cecill.info".
18 
19 As a counterpart to the access to the source code and rights to copy,
20 modify and redistribute granted by the license, users are provided only
21 with a limited warranty and the software's author, the holder of the
22 economic rights, and the successive licensors have only limited
23 liability.
24 
25 In this respect, the user's attention is drawn to the risks associated
26 with loading, using, modifying and/or developing or reproducing the
27 software by the user in light of its specific status of free software,
28 that may mean that it is complicated to manipulate, and that also
29 therefore means that it is reserved for developers and experienced
30 professionals having in-depth computer knowledge. Users are therefore
31 encouraged to load and test the software's suitability as regards their
32 requirements in conditions enabling the security of their systems and/or
33 data to be ensured and, more generally, to use and operate it in the
34 same conditions as regards security.
35 
36 The fact that you are presently reading this means that you have had
37 knowledge of the CeCILL license and that you accept its terms.
38 */
39 
40 #ifndef _DNATORNA_H_
41 #define _DNATORNA_H_
42 
43 #include "Transliterator.h"
44 #include "Alphabet/DNA.h"
45 #include "Alphabet/RNA.h"
46 #include "Alphabet/AlphabetTools.h"
47 
48 namespace bpp
49 {
50 
58 class DNAToRNA:
60 {
61  private:
62  const Alphabet* dna_, * rna_;
63 
64  public:
65  DNAToRNA(): AbstractReverseTransliterator(), dna_(&AlphabetTools::DNA_ALPHABET), rna_(&AlphabetTools::RNA_ALPHABET) {}
66 
68 
70  {
71  AbstractReverseTransliterator::operator=(d2r);
72  dna_ = d2r.dna_;
73  rna_ = d2r.rna_;
74  return *this;
75  }
76 
77  virtual ~DNAToRNA() {}
78 
79  public:
80  virtual const Alphabet* getSourceAlphabet() const { return dna_; }
81  virtual const Alphabet* getTargetAlphabet() const { return rna_; }
82  int translate(int state) const throw (BadIntException);
83  std::string translate(const std::string& state) const throw (BadCharException);
84  Sequence* translate(const Sequence& sequence) const throw (AlphabetMismatchException, Exception)
85  {
87  }
88  int reverse(int state) const throw (BadIntException);
89  std::string reverse(const std::string& state) const throw (BadCharException);
90  Sequence* reverse(const Sequence& sequence) const throw (AlphabetMismatchException, Exception)
91  {
93  }
94 
95 };
96 
97 } //end of namespace bpp.
98 
99 #endif //_DNATORNA_H_
100 
virtual int reverse(int state) const =0
Translate a given state coded as a int from target alphabet to source alphabet.
An alphabet exception thrown when trying to specify a bad char to the alphabet.
Sequence * translate(const Sequence &sequence) const
Translate a whole sequence from source alphabet to target alphabet.
Definition: DNAToRNA.h:84
int reverse(int state) const
Translate a given state coded as a int from target alphabet to source alphabet.
Definition: DNAToRNA.cpp:63
This alphabet is used to deal NumericAlphabet.
virtual const Alphabet * getSourceAlphabet() const
Get the source alphabet.
Definition: DNAToRNA.h:80
The Alphabet interface.
Definition: Alphabet.h:130
const Alphabet * rna_
Definition: DNAToRNA.h:62
Reverse iterator to convert RNA to DNA.
Definition: DNAToRNA.h:58
const Alphabet * dna_
Definition: DNAToRNA.h:62
int translate(int state) const
Translate a given state coded as a int from source alphabet to target alphabet.
Definition: DNAToRNA.cpp:47
Utilitary functions dealing with alphabets.
Definition: AlphabetTools.h:59
virtual const Alphabet * getTargetAlphabet() const
Get the target alphabet.
Definition: DNAToRNA.h:81
DNAToRNA & operator=(const DNAToRNA &d2r)
Definition: DNAToRNA.h:69
virtual int translate(int state) const =0
Translate a given state coded as a int from source alphabet to target alphabet.
The sequence interface.
Definition: Sequence.h:74
Sequence * reverse(const Sequence &sequence) const
Translate a whole sequence from target alphabet to source alphabet.
Definition: DNAToRNA.h:90
An alphabet exception thrown when trying to specify a bad int to the alphabet.
Exception thrown when two alphabets do not match.
virtual ~DNAToRNA()
Definition: DNAToRNA.h:77
Partial implementation of the ReverseTransliterator interface.
DNAToRNA(const DNAToRNA &d2r)
Definition: DNAToRNA.h:67