Class: BioDSL::PlotHeatmap
- Inherits:
-
Object
- Object
- BioDSL::PlotHeatmap
- Includes:
- AuxHelper
- Defined in:
- lib/BioDSL/commands/plot_heatmap.rb
Overview
Plot tabular numerical data in a heatmap.
A heatmap can be plotted with plot_heatmap
using numerical data (Non- numerical data is ignored). Data should be tabular with records as rows and keys as columns - the data cells plotted will be the values.
Default graphics are crufty ASCII and you probably want high resolution postscript or SVG output instead with is easy using the terminal
option. Plotting is done using GNUplot which allows for different types of output.
GNUplot must be installed for plot_heatmap
to work. Read more here:
Usage
plot_heatmap([keys: <list> | skip: <list>[, output: <file>
[, force: <bool> [, terminal: <string>
[, title: <string>[, xlabel: <string>[, ylabel: <string>
[, test: <bool>]]]]]]])
Options
-
keys: <list> - Comma separated list of keys to plot as columns.
-
skip: <list> - Comma separated list of keys to skip as columns.
-
output: <file> - Output file.
-
force: <bool> - Force overwrite existing output file.
-
terminal: <string> - Terminal for output: dumb|post|svg|x11|aqua|png|pdf
(default=dumb).
-
title: <string> - Plot title (default=“Heatmap”).
-
xlabel: <string> - X-axis label (default=“x”).
-
ylabel: <string> - Y-axis label (default=“y”).
-
test: <bool> - Output Gnuplot script instead of plot.
Examples
Here we plot a heatmap of data a table:
BD.new.read_table(input: "test.tab").plot_heatmap.run
Constant Summary collapse
- STATS =
%i(records_in records_out)
Instance Method Summary collapse
-
#initialize(options) ⇒ PlotHeatmap
constructor
Constructor for PlotHeatmap.
-
#lmb ⇒ Proc
Return command lambda for plot_histogram.
Methods included from AuxHelper
Constructor Details
#initialize(options) ⇒ PlotHeatmap
Constructor for PlotHeatmap.
93 94 95 96 97 98 99 100 101 |
# File 'lib/BioDSL/commands/plot_heatmap.rb', line 93 def initialize() @options = @headings = nil @skip_keys = determine_skip_keys aux_exist('gnuplot') defaults end |
Instance Method Details
#lmb ⇒ Proc
Return command lambda for plot_histogram.
106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/BioDSL/commands/plot_heatmap.rb', line 106 def lmb lambda do |input, output, status| status_init(status, STATS) gp = GnuPlotter.new (gp) plot_dataset(gp, input, output) plot_output(gp) end end |