Skip to content
Martin Asser Hansen edited this page Oct 2, 2015 · 7 revisions

Biopiece: plot_chrdist

Description

plot_chrdist uses CHR keys from Biopiece records in the stream to plot a chromosome distribution indicating the number of records for each of the found chromosomes. Plotting is done using GNUplot which allows for different types of output the default one being crufty ASCII graphics.

GNUplot must be installed for plot_chrdist to work. Read more here:

http://www.gnuplot.info/

Usage

... | plot_chrdist [options]

Options

[-?          | --help]               #  Print full usage description.
[-x          | --no_stream]          #  Do not emit records.
[-o <file>   | --data_out=<file>]    #  Write result to file.
[-t <string> | --terminal=<string>]  #  Terminal for output: dumb|post|svg|x11|aqua  -  Default=dumb
[-T <string> | --title=<string>]     #  Set plot title.                 - Default="Chromosome Distribution"
[-X <string> | --xlabel=<string>]    #  Set x-axis label.
[-Y <string> | --ylabel=<string>]    #  Set y-axis label.
[-L          | --logscale_y]         #  Set y-axis to log scale.
[-I <file!>  | --stream_in=<file!>]  #  Read input from stream file     -  Default=STDIN
[-O <file>   | --stream_out=<file>]  #  Write output to stream file     -  Default=STDOUT
[-v          | --verbose]            #  Verbose output.

Examples

To generate a ASCII graphics chromosome distrubution you merely need to pipe the stream through plot_chrdist:

read_bed -i test.bed | plot_chrdist -x

                           Chromosome Distribution

12 ++--------------------------------------------------------------------++
   |                                                                      |
   |                                                                  **  |
10 ++                                                                 ** ++
   |                                                                  **  |
   |                                                                  **  |
 8 ++                                                                 ** ++
   |                                                                  **  |
   |                                                                  **  |
 6 ++                                                                 ** ++
   |                                                                  **  |
   |                                                                  **  |
   |                                                                  **  |
 4 ++                                                                 ** ++
   |                 **                                               **  |
   |                 **                                               **  |
 2 ++  ***  **       **           ***      **                    ***  ** ++
   |   * *  **  ***  **  ***  **  * *  **  **  ***  **  ***  **  * *  **  |
   |   * *  **  * *  **  * *  **  * *  **  **  * *  **  * *  **  * *  **  |
 0 ++--***--**--***--**--***--**--***--**--**--***--**--***--**--***--**-++
     chr1 chr2chr3 chr4chr5 chr8chr9 chr11hr13hr14chr15hr16chr17hrX17_random

Obviously the ASCII graphics is crufty and the x axis is messed up, but still you can get an idea of the chromosome distribution. However, if you want publication grade graphics you can change the terminal from dumb to postscript or SVG (Scalable Vector Graphics):

To generate a postscript image:

read_bed -i test.bed | plot_chrdist -t post -xo test.ps

And the result will look like this:

If you choose -t svg instead of -t post the output will be in SVG which is neat since it can easily be modified using e.g. Inkscape to apply labels and such.

Read more about Inkscape here:

http://www.inkscape.org/

See also

read_bed

Author

Martin Asser Hansen - Copyright (C) - All rights reserved.

[email protected]

August 2007

License

GNU General Public License version 2

http://www.gnu.org/copyleft/gpl.html

Help

plot_chrdist is part of the Biopieces framework.

http://www.biopieces.org

Clone this wiki locally