-
Notifications
You must be signed in to change notification settings - Fork 23
plot_distribution
plot_distribution create a distribution plot of the values for a specified key from all records in the stream. 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_distribution to work. Read more here:
Also, the GNUplot gem for Ruby is required - run: gem install gnuplot
... | plot_distribution -k <key> [options]
[-? | --help] # Print full usage description.
[-k <string> | --key=<string>] # Key to use for plotting.
[-o <file> | --data_out=<file>] # Write result to file.
[-x | --no_stream] # Do not emit records.
[-t <string> | --terminal=<string>] # Terminal for output: dumb|post|svg|x11|aqua|png|pdf - Default=dumb
[-T <string> | --title=<string>] # Set plot title - Default="Distribution"
[-X <string> | --xlabel=<string>] # Set x-axis label - Default=<key>
[-Y <string> | --ylabel=<string>] # Set y-axis label - Default="n"
[-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.
Here we plot the distribution of sequence lengths from a FASTA file:
read_fasta -i test.fna | plot_distribution -k SEQ_LEN -x
Distribution
+ + + + + +
90 +++-------------+------------+------------+------------+-------------+++
| |
80 ++ **++
| **|
70 ++ **++
60 ++ **++
| **|
50 ++ **++
| **|
40 ++ **++
| **|
30 ++ **++
20 ++ **++
| **|
10 ++ **++
| ******|
0 +++-------------+------------+**--------**+--***-------+**--**********++
+ + + + + +
0 10 20 30 40 50
SEQ_LEN
To render X11 output (i.e. instant view) use -t x11
:
read_fasta -i test.fna | plot_distribution -k SEQ_LEN -t x11 -x
To generate a PNG image:
read_fasta -i test.fna | plot_distribution -k SEQ_LEN -t png -o plot_distribution.png -x
And the result will look like this:
If you choose -t svg
instead of -t png
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:
Martin Asser Hansen - Copyright (C) - All rights reserved.
May 2011
GNU General Public License version 2
http://www.gnu.org/copyleft/gpl.html
plot_distribution is part of the Biopieces framework.