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

Biopiece: plot_lendist

Description

plot_lendist uses a specified key to plot a histogram where each column is the value of the key, and the height of the column indicates the number of records with this value. This is almost the same as plot_histogram generates nicer x-axis intervals. 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_lendist to work. Read more here:

http://www.gnuplot.info/

Usage

... | plot_lendist [options]

Options

[-?          | --help]               #  Print full usage description.
[-x          | --no_stream]          #  Do not emit records.
[-o <file>   | --data_out=<file>]    #  Write result to file.
[-k <string> | --key=<string>]       #  Key to use for plotting.
[-t <string> | --terminal=<string>]  #  Terminal for output: dumb|post|svg|x11|aqua  -  Default=dumb
[-T <string> | --title=<string>]     #  Set plot title               -  Default="Length 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 length distrubution you merely need to pipe the stream through plot_lendist:

read_fasta -i test.fna | plot_lendist -xk SEQ_LEN

                                 Length Distribution

  45000 ++--------------------------------------------------------**-------++
        |                                                         **        |
  40000 ++                                                      ****       ++
        |                                                       ****        |
  35000 ++                                                      ****       ++
        |                                                       ****        |
  30000 ++                                                      ****       ++
        |                                                       ****        |
  25000 ++                                                      ****       ++
        |                                                       ****        |
  20000 ++                                                    ********     ++
        |                                                     ********      |
  15000 ++                                                  **********     ++
        |                                                  ***********      |
  10000 ++                                                 ***********     ++
        |                                                  ***********      |
   5000 ++                                               *************     ++
        |                                          *******************      |
      0 +*************************************************************-----++
          +        +         +        +         +        +         +        +
          0        5         10       15        20       25        30       35

Obviously the ASCII graphics is crufty and the x axis is messed up, but still you can get an idea of the length 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_fasta -i test.fna | plot_lendist -xk SEQ_LEN -t post -o lendist.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_fasta

plot_histogram

Author

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

mail@maasha.dk

August 2007

License

GNU General Public License version 2

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

Help

plot_lendist is part of the Biopieces framework.

http://www.biopieces.org

Clone this wiki locally