User Tools

Site Tools


This is an old revision of the document!

A Web Server for Zoomable Chaos Game Represenations


Chaos Game Representation

Chaos Game Representation (CGR) is a generalized scale-independent Markov probability table for the sequence, and oligomer tables (see document for "kmer_table" function) can be deduced from CGR image.

CGR is generated by the following procedure:

  • Start from position (0,0) or the origin of two dimensional coordinate.
     Four nucleotides are located at the four corners:
         A: (-1, 1)  upper left
         T: (1, -1)  lower right
         G: (1, 1)   upper right
         C: (-1, -1) lower left
  • For each nucleotide, move and mark the new location which is halfway between the current location and the nucleotide. For example, if the first letter is A, position is moved from (0,0) to midpoint between (-1, 1) and (0,0), which is (-0.5, 0.5).
  • Repeat this procedure for all nucleotides.

k-mer table

This program creates an image showing the abundance of all k-mers (oligonucleotides of length k) in a given sequence. For example, for tetramers (k=4), resulting image is composed of 4^4 = 256 boxes, each representing an oligomer. Oligomer name and abundance is written within these boxes, and abundance is also visualized with the box color, from white (none) to black (highly frequent).

This k-mer table is alternatively known as the FCGR (frequency matrices extracted from Chaos Game Representation).

Position of the oligomers can be recursively located as follows:

  • For each letter in an oligomer, a box is subdivided into four quadrants, where A is upper left, T is lower right, G is upper right, and C is lower left. Therefore, oligomer ATGC is in the
    A = upper left quadrant
    T = lower right within the above quadrant
    G = upper right within the above quadrant
    C = lower left within the above quadrant

Chaos Game Representation for five prokaryotes

Click on the images to enlarge.

Escherichia coli Bacillus subtilis
Escherichia coli Bacillus subtilis
Mycoplasma genitalium Synechococcus sp.
Mycoplasma genitalium Synechococcus sp.
Pyrococcus furiosus
Pyrococcus furiosus


Web Service

Basically, our web service can be accessed by specifying the URL according to a certain syntax.


Here the [genome] is a RefSeq accession number (see here for listing), and [method] is either cgr (for Chaos Game Representation) or kmer_table (for k-mer table).

For example, for Mycoplasma genitalium genome (RefSeq: NC_000908),

Perl API

For usage through Perl API, firstly download and install G-language Genome Analysis Environment v.1.8.9 or above following the instructions in:

Then, create the following script:

use G;
$genome = load("FastaFile.fasta");

The load function can take most common sequence formats, such as GenBank and EMBL. See the API documentation for "load" for more details.

In order to change the parameters, such as the length of oligomers for kmer_table (-k option), generation of Google Map (-gmap⇒1 option), or changing the image width for cgr (-width option), simply add these options and values to the function call, as follows:

use G;
$genome = load("genbank.gbk");
cgr($genome, -width=>512, -gmap=>1);
kmer_table($genome, -k=>8, -gmap=>1);

See the API documentation for further details about the optional parameters.

G-language Shell

For usage through G-language Shell, firstly download and install G-language Genome Analysis Environment v.1.8.9 or above following the instructions in:

Then, start the G-language Shell by typing G in your UNIX shell:

unix % G

Follow the instructions of the above Perl API once you enter the G-language Shell.

See the G-language System tutorial for more details about the G-language Shell.

API Documentations

cgr.1247734483.txt.gz · Last modified: 2014/01/18 07:44 (external edit)