Path: | lib/bio/data/codontable.rb |
Last Update: | Sun Dec 04 02:16:41 +0000 2011 |
Copyright: | Copyright (C) 2001, 2004 Toshiaki Katayama <k@bioruby.org> |
License: | The Ruby License |
$Id:$
Data in this class is converted from the NCBI‘s genetic codes page.
* ((<URL:http://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi?mode=t>))
Obtain a codon table No.1 — Standard (Eukaryote)
table = Bio::CodonTable[1]
Obtain a copy of the codon table No.1 to modify. In this example, reassign a seleno cystein (‘U’) to the ‘tga’ codon.
table = Bio::CodonTable.copy(1) table['tga'] = 'U'
Create a new codon table by your own from the Hash which contains pairs of codon and amino acid. You can also define the table name in the second argument.
hash = { 'ttt' => 'F', 'ttc' => 'ttc', ... } table = Bio::CodonTable.new(hash, "my codon table")
Obtain a translated amino acid by codon.
table = Bio::CodonTable[1] table['ttt'] # => F
Reverse translation of a amino acid into a list of relevant codons.
table = Bio::CodonTable[1] table.revtrans("A") # => ["gcg", "gct", "gca", "gcc"]