NAME
Bio::Tools::CodonTable - Codon table object
SYNOPSIS
# This is a read-only class for all known codon tables. The IDs are# the ones used by nucleotide sequence databases. All common IUPAC# ambiguity codes for DNA, RNA and amino acids are recognized.use Bio::Tools::CodonTable;# defaults to ID 1 "Standard"$myCodonTable = Bio::Tools::CodonTable->new();$myCodonTable2 = Bio::Tools::CodonTable->new( -id => 3 );# change codon table$myCodonTable->id(5);# examine codon tableprint join (' ', "The name of the codon table no.", $myCodonTable->id(4),"is:", $myCodonTable->name(), "\n");# print possible codon tables$tables = Bio::Tools::CodonTable->tables;while ( ($id,$name) = each %{$tables} ) {print "$id = $name\n";}# translate a codon$aa = $myCodonTable->translate('ACU');$aa = $myCodonTable->translate('act');$aa = $myCodonTable->translate('ytr');# reverse translate an amino acid@codons = $myCodonTable->revtranslate('A');@codons = $myCodonTable->revtranslate('Ser');@codons = $myCodonTable->revtranslate('Glx');@codons = $myCodonTable->revtranslate('cYS', 'rna');# reverse translate an entire amino acid sequence into a IUPAC# nucleotide stringmy $seqobj = Bio::PrimarySeq->new(-seq => 'FHGERHEL');my $iupac_str = $myCodonTable->reverse_translate_all($seqobj);# boolean testsprint "Is a start\n" if $myCodonTable->is_start_codon('ATG');print "Is a terminator\n" if $myCodonTable->is_ter_codon('tar');print "Is a unknown\n" if $myCodonTable->is_unknown_codon('JTG');
DESCRIPTION
Codon tables are also called translation tables or genetic codes since that is what they represent. A bit more complete picture of the full complexity of codon usage in various taxonomic groups is presented at the NCBI Genetic Codes Home page.
CodonTable is a BioPerl class that knows all current translation tables that are used by primary nucleotide sequence databases (GenBank, EMBL and DDBJ). It provides methods to output information about tables and relationships between codons and amino acids.
This class and its methods recognized all common IUPAC ambiguity codes for DNA, RNA and animo acids. The translation method follows the conventions in EMBL and TREMBL databases.
It is a nuisance to separate RNA and cDNA representations of nucleic acid transcripts. The CodonTable object accepts codons of both type as input and allows the user to set the mode for output when reverse translating. Its default for output is DNA.
Note:
This class deals primarily with individual codons and amino acids. However in the interest of speed you can translate longer sequence, too. The full complexity of protein translation is tackled by Bio::PrimarySeqI::translate.
The amino acid codes are IUPAC recommendations for common amino acids:
A Ala AlanineR Arg ArginineN Asn AsparagineD Asp Aspartic acidC Cys CysteineQ Gln GlutamineE Glu Glutamic acidG Gly GlycineH His HistidineI Ile IsoleucineL Leu LeucineK Lys LysineM Met MethionineF Phe PhenylalanineP Pro ProlineO Pyl Pyrrolysine (22nd amino acid)U Sec Selenocysteine (21st amino acid)S Ser SerineT Thr ThreonineW Trp TryptophanY Tyr TyrosineV Val ValineB Asx Aspartic acid or AsparagineZ Glx Glutamine or Glutamic acidJ Xle Isoleucine or Valine (mass spec ambiguity)X Xaa Any or unknown amino acid
It is worth noting that, "Bacterial" codon table no. 11 produces an polypeptide that is, confusingly, identical to the standard one. The only differences are in available initiator codons.
NCBI Genetic Codes home page:
(Last update of the Genetic Codes: Nov. 18, 2016)
https://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi?mode=c
ASN.1 version with ids 1 to 25 is at:
ftp://ftp.ncbi.nih.gov/entrez/misc/data/gc.prt
Thanks to Matteo diTomasso for the original Perl implementation of these tables.
FEEDBACK
Mailing Lists
User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing lists Your participation is much appreciated.
[email protected] - General discussionhttp://bioperl.org/wiki/Mailing_lists - About the mailing lists
Support
Please direct usage questions or support issues to the mailing list:
rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible.
Reporting Bugs
Report bugs to the Bioperl bug tracking system to help us keep track the bugs and their resolution. Bug reports can be submitted via the web:
https://github.com/bioperl/bioperl-live/issues
AUTHOR - Heikki Lehvaslaiho
Email: heikki-at-bioperl-dot-org
APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
id
Title : idUsage : $obj->id(3); $id_integer = $obj->id();Function: Sets or returns the id of the translation table. IDs areintegers from 0 (special ATG-only start) to 25, excluding7-8 and 17-20 which have been removed. If an invalid ID isgiven the method returns 1, the standard table.Example :Returns : value of id, a scalar, warn and fall back to 1 (standard table)if specified id is not validArgs : newvalue (optional)
name
Title : nameUsage : $obj->name()Function: returns the descriptive name of the translation tableExample :Returns : A stringArgs : None
tables
Title : tablesUsage : $obj->tables() or Bio::Tools::CodonTable->tables()Function: returns a hash reference where each key is a valid codontable id() number, and each value is the correspondingcodon table name() stringExample :Returns : A hashrefArgs : None
translate
Title : translateUsage : $obj->translate('YTR')Function: Returns a string of one letter amino acid codes fromnucleotide sequence input. The imput can be of any length.Returns 'X' for unknown codons and codons that code formore than one amino acid. Returns an empty string if inputis not three characters long. Exceptions for these are:- IUPAC amino acid code B for Aspartic Acid andAsparagine, is used.- IUPAC amino acid code Z for Glutamic Acid, Glutamine isused.- if the codon is two nucleotides long and if by addingan a third character 'N', it codes for a single aminoacid (with exceptions above), return that, otherwisereturn empty string.Returns empty string for other input strings that are notthree characters long.Example :Returns : a string of one letter ambiguous IUPAC amino acid codesArgs : ambiguous IUPAC nucleotide string
translate_strict
Title : translate_strictUsage : $obj->translate_strict('ACT')Function: returns one letter amino acid code for a codon inputFast and simple translation. User is responsible to resolveambiguous nucleotide codes before calling thismethod. Returns 'X' for unknown codons and an empty stringfor input strings that are not three characters long.It is not recommended to use this method in a productionenvironment. Use method translate, instead.Example :Returns : A stringArgs : a codon = a three nucleotide character string
revtranslate
Title : revtranslateUsage : $obj->revtranslate('G')Function: returns codons for an amino acidReturns an empty string for unknown amino acidcodes. Ambiguous IUPAC codes Asx,B, (Asp,D; Asn,N) andGlx,Z (Glu,E; Gln,Q) are resolved. Both single and threeletter amino acid codes are accepted. '*' and 'Ter' areused for terminator.By default, the output codons are shown in DNA. If theoutput is needed in RNA (tr/t/u/), add a second argument'RNA'.Example : $obj->revtranslate('Gly', 'RNA')Returns : An array of three lower case letter strings i.e. codonsArgs : amino acid, 'RNA'
reverse_translate_all
Title : reverse_translate_allUsage : my $iup_str = $cttable->reverse_translate_all($seq_object)my $iup_str = $cttable->reverse_translate_all($seq_object,$cutable,15);Function: reverse translates a protein sequence into IUPAC nucleotidesequence. An 'X' in the protein sequence is converted to 'NNN'in the nucleotide sequence.Returns : a stringArgs : a Bio::PrimarySeqI compatible object (mandatory)a Bio::CodonUsage::Table object and a threshold if onlycodons with a relative frequency above the threshold areto be considered.
reverse_translate_best
Title : reverse_translate_bestUsage : my $str = $cttable->reverse_translate_best($seq_object,$cutable);Function: Reverse translates a protein sequence into plain nucleotidesequence (GATC), uses the most common codon for each amino acidReturns : A stringArgs : A Bio::PrimarySeqI compatible object and a Bio::CodonUsage::Table object
is_start_codon
Title : is_start_codonUsage : $obj->is_start_codon('ATG')Function: returns true (1) for all codons that can be used as atranslation start, false (0) for others.Example : $myCodonTable->is_start_codon('ATG')Returns : booleanArgs : codon
is_ter_codon
Title : is_ter_codonUsage : $obj->is_ter_codon('GAA')Function: returns true (1) for all codons that can be used as atranslation tarminator, false (0) for others.Example : $myCodonTable->is_ter_codon('ATG')Returns : booleanArgs : codon
is_unknown_codon
Title : is_unknown_codonUsage : $obj->is_unknown_codon('GAJ')Function: returns false (0) for all codons that are valid,true (1) for others.Example : $myCodonTable->is_unknown_codon('NTG')Returns : booleanArgs : codon
unambiguous_codons
Title : unambiguous_codonsUsage : @codons = $self->unambiguous_codons('ACN')Returns : array of strings (one-letter unambiguous amino acid codes)Args : a codon = a three IUPAC nucleotide character string
_unambiquous_codons
deprecated, now an alias for unambiguous_codons
add_table
Title : add_tableUsage : $newid = $ct->add_table($name, $table, $starts)Function: Add a custom Codon Table into the object.Know what you are doing, only the length ofthe argument strings is checked!Returns : the id of the new codon tableArgs : name, a string, optional (can be empty)table, a string of 64 charactersstartcodons, a string of 64 characters, defaults to standard