Script: heatmap_table.pl

This is a simple perl program that uses GD to generate heatmaps.

Usage syntax:
  [options] source [[options] source]...
Usage options (defaults in []'s):
  --output-base=?  The first part of the output file names. [derived from source file]
  --gamma=?        Gamma correction for coloring. [1]
  --log            Logarithmic (magnitude) plot. [no]
  --center=?       Center colors on this value. [mean]
  --split-scale    Use different scales above and below the center
                   (for better color resolution). [off]
  --no-labels      Ignore labels in source file. [off]
  --low-color=?    Set the low end color. [green]
  --center-color=? Set the center color. [black]
  --high-color=?   Set the high end color. [red]
  --nan-color=?    Set the color for undefined values. [darkgrey]
  --el-width=?     Width of map element (pixels). [8]
  --el-height=?    Height of map element (pixels). [8]

Input

Input files may either by in picoXML format (the format used by the picoXML module) or in flat format.

Flat file format should be a tab-delimited file containing a numeric matrix (with NaN in empty fields).

picoXML format is the following:

<heatmap>
  <col label="(label)" />
  <row label="(label)" div>
    <v>(value)</v>
    ...
  </row>
</heatmap>

The col blocks are optional, used only for column labels. Each row block should have a v block for each column. If a label tag is missing, the row or column number will be used (unless --no-labels is in effect).

picoXML format is highly extensible, so it is likely to be the format that will support most fancy features.

Output

By default the output file names will be derived from the name of the source file. These examples are equivalent:

  heatmap_table.pl map.pxml
  heatmap_table.pl --output-base=map map.pxml

The output html table is in a file named by attaching a '.html' extension to the output base. For example:

  map.html

Output images are currently in png format only. The files are named with the output base followed by the row and column number where they exist in the output table. For example:

  map_2_0.png
In addition, separate images are created for the column labels, row labels, and key. The row and column label images may also be split into multiple image files. For example:
  map_col_label_0.png
  map_row_label_2.png
  map_key.png

Colors

Color specification may be:

  by name (red, green, blue, black, darkgrey, grey, white, yellow)
  by RGB values:
    255:0:0 (red), 0:255:0 (green), 127:127:127 (grey), etc.

Color examples:

  Green to black center then to blue:
    --low-color=green --center-color=black --high-color=0:0:255
  A graded blue band (black to blue):
    --low-color=black --center-color=0:0:127 --high-color=0:0:255
  A band graded from yellow to blue:
    --low-color=yellow --center-color=grey --high-color=blue

Examples

Any options apply only to source file that follow. For example, this will color the first map green-yellow and the second map blue-yellow:

  --high-color=yellow data1.pxml --low-color=blue data2.pxml

These examples are NOT equivalent:

  heatmap_table.pl data.pxml --output-base=map
  heatmap_table.pl --output-base=map data.pxml