Bio::Tools::CodonOptTable - A more elaborative way to check the codons usage!


Version 1.05


    use Bio::Tools::CodonOptTable;

    my $seqobj = Bio::Tools::CodonOptTable->new(
        -id               => 'GeneFragment-12',
        -accession_number => 'Myseq1',
        -alphabet         => 'dna',
        -is_circular      => 1,
        -genetic_code     => 1,
    #If you wanna read from file
    my $seqobj = Bio::Tools::CodonOptTable->new(
        -file         => "contig.fasta",
        -format       => 'Fasta',
        -genetic_code => 1,
    #If you have Accession number and want to get file from NCBI
    my $seqobj = Bio::Tools::CodonOptTable->new(
        -ncbi_id      => "J00522",
        -genetic_code => 1,
    my $myCodons = $seqobj->rscu_rac_table();
    if ($myCodons) {
        foreach my $each_aa (@$myCodons) {
            print "Codon      : ", $each_aa->{'codon'},     "\t";
            print "Frequency  : ", $each_aa->{'frequency'}, "\t";
            print "AminoAcid  : ", $each_aa->{'aa_name'},   "\t";
            print "RSCU Value : ", $each_aa->{'rscu'},      "\t";       #Relative Synonymous Codons Uses
            print "RAC Value  : ", $each_aa->{'rac'},       "\t \n";    #Relative Adaptiveness of a Codon
    # To get the prefered codon list based on RSCU & RAC Values
    my $prefered_codons = $seqobj->prefered_codon($myCodons);
    while ( my ( $amino_acid, $codon ) = each(%$prefered_codons) ) {
        print "AminoAcid : $amino_acid \t Codon : $codon\n";
    # To produce a graph between RSCU & RAC
    # Graph output file extension should be GIF, we support GIF only
    $seqobj->generate_graph( $myCodons, $outfile_name );
    # To Calculate Codon Adaptation Index (CAI)    
    my $gene_cai = $seqobj->calculate_cai($myCodons);

    # To Produce HTML report
    # This function will generate HTML report, outfile extension should be .html


The purpose of this module is to show codon usage.

We produces each codon frequency, Relative Synonymous Codons Uses and Relative Adaptiveness of a Codon table and bar graph that will help you to calculate the Codon Adaptation Index (CAI) of a gene, to see the gene expression level.

Relative Synonymous Codons Uses(RSCU) values are the number of times a particular codon is observed, relative to the number of times that the codon would be observed in the absence of any codon usage bias.

In the absence of any codon usage bias, the RSCU value would be 1.00. A codon that is used less frequently than expected will have a value of less than 1.00 and vice versa for a codon that is used more frequently than expected.

Genetics Code: NCBI takes great care to ensure that the translation for each coding sequence (CDS) present in GenBank records is correct. Central to this effort is careful checking on the taxonomy of each record and assignment of the correct genetic code (shown as a /transl_table qualifier on the CDS in the flat files) for each organism and record. This page summarizes and references this work.

The following functions are provided by this module:




To Produce RSCU and RAC table along with codon and Amino acid name.


Return you prefered codons list.


Produce a bar graph between RAC(Relative Adaptiveness of a Codon) & RSCU (Relative Synonymous Codons Uses).


Calculate Codon Adaptation Index (CAI) for sequence.


To Produce HTML report, this function will generate HTML report, outfile extension should be .html example output :


Rakesh Kumar Shardiwal, <rakesh.shardiwal at>


Please report any bugs or feature requests to bug-bio-tools-codonopttable at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc Bio::Tools::CodonOptTable

You can also look for information at:


Copyright 2010 Rakesh Kumar Shardiwal, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.