1Bio::Tools::CodonTable(U3s)er Contributed Perl DocumentatBiioon::Tools::CodonTable(3)
2
3
4
6 Bio::Tools::CodonTable - Codon table object
7
9 # This is a read-only class for all known codon tables. The IDs are
10 # the ones used by nucleotide sequence databases. All common IUPAC
11 # ambiguity codes for DNA, RNA and amino acids are recognized.
12
13 use Bio::Tools::CodonTable;
14
15 # defaults to ID 1 "Standard"
16 $myCodonTable = Bio::Tools::CodonTable->new();
17 $myCodonTable2 = Bio::Tools::CodonTable->new( -id => 3 );
18
19 # change codon table
20 $myCodonTable->id(5);
21
22 # examine codon table
23 print join (' ', "The name of the codon table no.", $myCodonTable->id(4),
24 "is:", $myCodonTable->name(), "\n");
25
26 # print possible codon tables
27 $tables = Bio::Tools::CodonTable->tables;
28 while ( ($id,$name) = each %{$tables} ) {
29 print "$id = $name\n";
30 }
31
32 # translate a codon
33 $aa = $myCodonTable->translate('ACU');
34 $aa = $myCodonTable->translate('act');
35 $aa = $myCodonTable->translate('ytr');
36
37 # reverse translate an amino acid
38 @codons = $myCodonTable->revtranslate('A');
39 @codons = $myCodonTable->revtranslate('Ser');
40 @codons = $myCodonTable->revtranslate('Glx');
41 @codons = $myCodonTable->revtranslate('cYS', 'rna');
42
43 # reverse translate an entire amino acid sequence into a IUPAC
44 # nucleotide string
45
46 my $seqobj = Bio::PrimarySeq->new(-seq => 'FHGERHEL');
47 my $iupac_str = $myCodonTable->reverse_translate_all($seqobj);
48
49 # boolean tests
50 print "Is a start\n" if $myCodonTable->is_start_codon('ATG');
51 print "Is a terminator\n" if $myCodonTable->is_ter_codon('tar');
52 print "Is a unknown\n" if $myCodonTable->is_unknown_codon('JTG');
53
55 Codon tables are also called translation tables or genetic codes since
56 that is what they represent. A bit more complete picture of the full
57 complexity of codon usage in various taxonomic groups is presented at
58 the NCBI Genetic Codes Home page.
59
60 CodonTable is a BioPerl class that knows all current translation tables
61 that are used by primary nucleotide sequence databases (GenBank, EMBL
62 and DDBJ). It provides methods to output information about tables and
63 relationships between codons and amino acids.
64
65 This class and its methods recognized all common IUPAC ambiguity codes
66 for DNA, RNA and animo acids. The translation method follows the
67 conventions in EMBL and TREMBL databases.
68
69 It is a nuisance to separate RNA and cDNA representations of nucleic
70 acid transcripts. The CodonTable object accepts codons of both type as
71 input and allows the user to set the mode for output when reverse
72 translating. Its default for output is DNA.
73
74 Note:
75
76 This class deals primarily with individual codons and amino acids.
77 However in the interest of speed you can translate longer sequence,
78 too. The full complexity of protein translation is tackled by
79 Bio::PrimarySeqI::translate.
80
81 The amino acid codes are IUPAC recommendations for common amino acids:
82
83 A Ala Alanine
84 R Arg Arginine
85 N Asn Asparagine
86 D Asp Aspartic acid
87 C Cys Cysteine
88 Q Gln Glutamine
89 E Glu Glutamic acid
90 G Gly Glycine
91 H His Histidine
92 I Ile Isoleucine
93 L Leu Leucine
94 K Lys Lysine
95 M Met Methionine
96 F Phe Phenylalanine
97 P Pro Proline
98 O Pyl Pyrrolysine (22nd amino acid)
99 U Sec Selenocysteine (21st amino acid)
100 S Ser Serine
101 T Thr Threonine
102 W Trp Tryptophan
103 Y Tyr Tyrosine
104 V Val Valine
105 B Asx Aspartic acid or Asparagine
106 Z Glx Glutamine or Glutamic acid
107 J Xle Isoleucine or Valine (mass spec ambiguity)
108 X Xaa Any or unknown amino acid
109
110 It is worth noting that, "Bacterial" codon table no. 11 produces an
111 polypeptide that is, confusingly, identical to the standard one. The
112 only differences are in available initiator codons.
113
114 NCBI Genetic Codes home page:
115 http://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi?mode=c
116
117 EBI Translation Table Viewer:
118 http://www.ebi.ac.uk/cgi-bin/mutations/trtables.cgi
119
120 Amended ASN.1 version with ids 16 and 21 is at:
121 ftp://ftp.ebi.ac.uk/pub/databases/geneticcode/
122
123 Thanks to Matteo diTomasso for the original Perl implementation of
124 these tables.
125
127 Mailing Lists
128 User feedback is an integral part of the evolution of this and other
129 Bioperl modules. Send your comments and suggestions preferably to the
130 Bioperl mailing lists Your participation is much appreciated.
131
132 bioperl-l@bioperl.org - General discussion
133 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
134
135 Support
136 Please direct usage questions or support issues to the mailing list:
137
138 bioperl-l@bioperl.org
139
140 rather than to the module maintainer directly. Many experienced and
141 reponsive experts will be able look at the problem and quickly address
142 it. Please include a thorough description of the problem with code and
143 data examples if at all possible.
144
145 Reporting Bugs
146 Report bugs to the Bioperl bug tracking system to help us keep track
147 the bugs and their resolution. Bug reports can be submitted via the
148 web:
149
150 http://bugzilla.open-bio.org/
151
153 Email: heikki-at-bioperl-dot-org
154
156 The rest of the documentation details each of the object methods.
157 Internal methods are usually preceded with a _
158
159 id
160 Title : id
161 Usage : $obj->id(3); $id_integer = $obj->id();
162 Function: Sets or returns the id of the translation table. IDs are
163 integers from 1 to 15, excluding 7 and 8 which have been
164 removed as redundant. If an invalid ID is given the method
165 returns 0, false.
166 Example :
167 Returns : value of id, a scalar, 0 if not a valid
168 Args : newvalue (optional)
169
170 name
171 Title : name
172 Usage : $obj->name()
173 Function: returns the descriptive name of the translation table
174 Example :
175 Returns : A string
176 Args : None
177
178 tables
179 Title : tables
180 Usage : $obj->tables() or Bio::Tools::CodonTable->tables()
181 Function: returns a hash reference where each key is a valid codon
182 table id() number, and each value is the corresponding
183 codon table name() string
184 Example :
185 Returns : A hashref
186 Args : None
187
188 translate
189 Title : translate
190 Usage : $obj->translate('YTR')
191 Function: Returns a string of one letter amino acid codes from
192 nucleotide sequence input. The imput can be of any length.
193
194 Returns 'X' for unknown codons and codons that code for
195 more than one amino acid. Returns an empty string if input
196 is not three characters long. Exceptions for these are:
197
198 - IUPAC amino acid code B for Aspartic Acid and
199 Asparagine, is used.
200 - IUPAC amino acid code Z for Glutamic Acid, Glutamine is
201 used.
202 - if the codon is two nucleotides long and if by adding
203 an a third character 'N', it codes for a single amino
204 acid (with exceptions above), return that, otherwise
205 return empty string.
206
207 Returns empty string for other input strings that are not
208 three characters long.
209
210 Example :
211 Returns : a string of one letter ambiguous IUPAC amino acid codes
212 Args : ambiguous IUPAC nucleotide string
213
214 translate_strict
215 Title : translate_strict
216 Usage : $obj->translate_strict('ACT')
217 Function: returns one letter amino acid code for a codon input
218
219 Fast and simple translation. User is responsible to resolve
220 ambiguous nucleotide codes before calling this
221 method. Returns 'X' for unknown codons and an empty string
222 for input strings that are not three characters long.
223
224 It is not recommended to use this method in a production
225 environment. Use method translate, instead.
226
227 Example :
228 Returns : A string
229 Args : a codon = a three nucleotide character string
230
231 revtranslate
232 Title : revtranslate
233 Usage : $obj->revtranslate('G')
234 Function: returns codons for an amino acid
235
236 Returns an empty string for unknown amino acid
237 codes. Ambiquous IUPAC codes Asx,B, (Asp,D; Asn,N) and
238 Glx,Z (Glu,E; Gln,Q) are resolved. Both single and three
239 letter amino acid codes are accepted. '*' and 'Ter' are
240 used for terminator.
241
242 By default, the output codons are shown in DNA. If the
243 output is needed in RNA (tr/t/u/), add a second argument
244 'RNA'.
245
246 Example : $obj->revtranslate('Gly', 'RNA')
247 Returns : An array of three lower case letter strings i.e. codons
248 Args : amino acid, 'RNA'
249
250 reverse_translate_all
251 Title : reverse_translate_all
252 Usage : my $iup_str = $cttable->reverse_translate_all($seq_object)
253 my $iup_str = $cttable->reverse_translate_all($seq_object,
254 $cutable,
255 15);
256 Function: reverse translates a protein sequence into IUPAC nucleotide
257 sequence. An 'X' in the protein sequence is converted to 'NNN'
258 in the nucleotide sequence.
259 Returns : a string
260 Args : a Bio::PrimarySeqI compatible object (mandatory)
261 a Bio::CodonUsage::Table object and a threshold if only
262 codons with a relative frequency above the threshold are
263 to be considered.
264
265 reverse_translate_best
266 Title : reverse_translate_best
267 Usage : my $str = $cttable->reverse_translate_best($seq_object,$cutable);
268 Function: Reverse translates a protein sequence into plain nucleotide
269 sequence (GATC), uses the most common codon for each amino acid
270 Returns : A string
271 Args : A Bio::PrimarySeqI compatible object and a Bio::CodonUsage::Table object
272
273 is_start_codon
274 Title : is_start_codon
275 Usage : $obj->is_start_codon('ATG')
276 Function: returns true (1) for all codons that can be used as a
277 translation start, false (0) for others.
278 Example : $myCodonTable->is_start_codon('ATG')
279 Returns : boolean
280 Args : codon
281
282 is_ter_codon
283 Title : is_ter_codon
284 Usage : $obj->is_ter_codon('GAA')
285 Function: returns true (1) for all codons that can be used as a
286 translation tarminator, false (0) for others.
287 Example : $myCodonTable->is_ter_codon('ATG')
288 Returns : boolean
289 Args : codon
290
291 is_unknown_codon
292 Title : is_unknown_codon
293 Usage : $obj->is_unknown_codon('GAJ')
294 Function: returns false (0) for all codons that are valid,
295 true (1) for others.
296 Example : $myCodonTable->is_unknown_codon('NTG')
297 Returns : boolean
298 Args : codon
299
300 _unambiquous_codons
301 Title : _unambiquous_codons
302 Usage : @codons = _unambiquous_codons('ACN')
303 Function:
304 Example :
305 Returns : array of strings (one letter unambiguous amino acid codes)
306 Args : a codon = a three IUPAC nucleotide character string
307
308 add_table
309 Title : add_table
310 Usage : $newid = $ct->add_table($name, $table, $starts)
311 Function: Add a custom Codon Table into the object.
312 Know what you are doing, only the length of
313 the argument strings is checked!
314 Returns : the id of the new codon table
315 Args : name, a string, optional (can be empty)
316 table, a string of 64 characters
317 startcodons, a string of 64 characters, defaults to standard
318
319
320
321perl v5.12.0 2010-04-29 Bio::Tools::CodonTable(3)