Workshop in Computational Bioskills - Lesson 5

Workshop in Computational Bioskills - Spring 2010

Lesson 5 - Graphics

Part 1 - UNIX figures manipulation

Part 2 - Visualization : Graphics in Perl


figure manipulation in unix

View images:
There are a few simple programs to display images on an X server,
which supports many types of images: gif, jpg, png, tiff and others.
Try xv, xview, display.
Manipulate figures:
convert - Use it to convert between image formats as well as other
manipulations on figures such as: resize an image, blur, crop, flip, append, join.
Usage: convert input-file [options] output-file
examples:
Convert from eps format to png:
<201|0>bioskill:~> convert img.eps img.png
Resize the image:
<201|0>bioskill:~> convert img.png -resize 100x100 img-small.png
Crop a part of the image:
<201|0>bioskill:~> convert -crop 70x70+0+0 img.png img-start.png
The input image is: The result will be :
<201|0>bioskill:~> convert -crop 70x70+80+80 img.png img-end.png
The result will be :

Graphics in Perl: GD module

GD.pm is a Perl interface to the gd graphics library.
GD allows you to create color drawings using a large number of graphics
primitives, and emit the drawings as PNG files.
For example:
gd-example.pl is a short program that creates this pictures: Can we simplify things? GD::Simple : GD::Simple is a subclass of the GD library that shortens many of the long GD methods, by storing information about the color, size and position in the GD object itself. GD::Simple maintains a "pen" whose settings are used for line and shape drawing operations.
The pen has properties, such as:
fgcolor - The color of lines and the borders of shapes. bgcolor - The color of filled shapes. pensize - Larger sizes draw thicker lines. position - The current position on the canvas in (X,Y) coordinates. Visualizing gene regulation: Let's use GD::Simple to create a cartoon image of a gene and it's main regulators, such as this: drawGene.pl

Using GD to visualize our results:

In Ex2 we looked for candidate miRNAs that regulate a group of genes we are interested in.
We did this by finding miRNA which their target genes are enriched with our genes of interest.
Here is an example of an optional output (only results with p-value<0.05): miR-1/206 28 81 2297 47080 5.8e-17 miR-6 5 81 510 47080 2e-3 miR-192 10 81 602 47080 9e-08 let-7/98 40 81 3013 47080 2.2e-26 miR-122 32 81 594 47080 1.5e-39 miR-13 3 81 54 47080 1e-4 miR-769 5 81 32 47080 2.6e-09 How should we present these results in an informative way??
We can use the visualization to highlight:
  • Who are the most significant miRs?
  • Which miRs cover most of the targets?
  • Are there any miRs that share the same targets?
  • Where are the miRs and their targets located on the genome?
  • ...
We can think of many alternative presentations:
  • A sorted table (with a color code?)
  • Graphs: lines, bars, pie-charts, etc.
  • Ven-diagrams
  • Cartoons
  • Existing visualization tools: Genome-Browser
Graphs and Charts : there are different GD modules designed for plotting graphs and charts, Such as GD::Graph
Back to our miR example... Let's use the GD::Graph module for creating a bars-plot.
We would like to present both the enrichment (p-value) and
the coverage (% of targets) for the top miRs in our genes of interest.
Running the program plotGraph.pl
on our data will create this graph:

Note : the "map" function used in this program. Very useful!