1 """Code to translate DNA or RNA into proteins (DEPRECATED).
2
3 Instead of Bio.Translate, for translation you are now encouraged to use the
4 Seq object's translate method, or the translate function in the Bio.Seq
5 module. Translate-to-stop functionality is via an optional argument.
6
7 Bio.Seq does not offer any back-translation function like the one here. It
8 was concluded that a since a simple back-translation giving a Seq or python
9 string could only capture some of the possible back translations, there were
10 no practical uses for such a method/function.
11
12 This module is now deprecated, and will be removed in a future release of
13 Biopython.
14 """
15 import warnings
16 warnings.warn("Bio.Translate and Bio.Transcribe are deprecated, and will be "\
17 "removed in a future release of Biopython. Please use the "\
18 "functions or object methods defined in Bio.Seq instead "\
19 "(described in the tutorial). If you want to continue to use "\
20 "this code, please get in contact with the Biopython developers "\
21 "via the mailing lists to avoid its permanent removal from "
22 +"Biopython.", \
23 DeprecationWarning)
24
25 from Bio import Alphabet, Seq
26 from Bio.Data import CodonTable
27
30 self.table = table
31 self._encoded = {}
32
34 return "Translator object\n" + str(self.table)
35
60
81
101
115
116 unambiguous_dna_by_name = {}
117 for key, value in CodonTable.unambiguous_dna_by_name.items():
118 unambiguous_dna_by_name[key] = Translator(value)
119 unambiguous_dna_by_id = {}
120 for key, value in CodonTable.unambiguous_dna_by_id.items():
121 unambiguous_dna_by_id[key] = Translator(value)
122
123 unambiguous_rna_by_name = {}
124 for key, value in CodonTable.unambiguous_rna_by_name.items():
125 unambiguous_rna_by_name[key] = Translator(value)
126 unambiguous_rna_by_id = {}
127 for key, value in CodonTable.unambiguous_rna_by_id.items():
128 unambiguous_rna_by_id[key] = Translator(value)
129
130
131 ambiguous_dna_by_name = {}
132 for key, value in CodonTable.ambiguous_dna_by_name.items():
133 ambiguous_dna_by_name[key] = Translator(value)
134 ambiguous_dna_by_id = {}
135 for key, value in CodonTable.ambiguous_dna_by_id.items():
136 ambiguous_dna_by_id[key] = Translator(value)
137
138 ambiguous_rna_by_name = {}
139 for key, value in CodonTable.ambiguous_rna_by_name.items():
140 ambiguous_rna_by_name[key] = Translator(value)
141 ambiguous_rna_by_id = {}
142 for key, value in CodonTable.ambiguous_rna_by_id.items():
143 ambiguous_rna_by_id[key] = Translator(value)
144