# HG changeset patch
# User devteam
# Date 1421941266 18000
# Node ID 89902ebc58b9fd4f3bcd554582b36a82dc3328c0
Imported from capsule None
diff -r 000000000000 -r 89902ebc58b9 heatmap/heatmap.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/heatmap/heatmap.xml Thu Jan 22 10:41:06 2015 -0500
@@ -0,0 +1,161 @@
+
+ of numeric data
+ \$R_SCRIPT_PATH/r_wrapper.sh $script_file
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ## Setup R error handling to go to stderr
+ options( show.error.messages=F,
+ error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) },
+ warn=-1 )
+ inp = read.table( "${input.file_name}" )
+ x = inp[, c(${var_cols})]
+ scale_value = "${scale}"
+ na_rm_value = FALSE
+ Colv_value = NA
+ Rowv_value = NA
+
+ #if str($na_remove) == "yes"
+ na_rm_value = TRUE
+ #end if
+
+ #if str($header) == "yes"
+ colnames(x) = rapply(x[1,], as.character)
+ x = x[2:nrow(x),]
+ #end if
+ x = apply(x,2,as.numeric)
+
+ #if str($dendrogram) == "row"
+ Rowv_value = TRUE
+ #elif str($dendrogram) == "column"
+ Colv_value = TRUE
+ #elif str($dendrogram) == "both"
+ Rowv_value = TRUE
+ Colv_value = TRUE
+ #end if
+
+ ## Open output PDF file
+ pdf( "${out_file1}" )
+ rgb_palette = colorRampPalette(c("${col_min}", "${col_max}"), space="rgb")
+ heatmap(as.matrix(x), main="${main}", xlab="${xlab}", ylab="${ylab}", scale=scale_value, Rowv=Rowv_value, Colv=Colv_value, na.rm=na_rm_value, col=rgb_palette(10))
+ ## Close the PDF file
+ devname = dev.off()
+
+
+
+
+
+
+
+
+ R_SCRIPT_PATH
+ R
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+.. class:: infomark
+
+**What it does**
+
+This tool uses the 'heatmap' function from R statistical package to draw heatmap using numeric data values contained in columns of a dataset.
+
+*R Development Core Team (2009). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. ISBN 3-900051-07-0, URL http://www.R-project.org.*
+
+-----
+
+.. class:: warningmark
+
+If "Remove NA" option is not set to "yes", this tool skips entire rows/columns with non-numeric data
+
+-----
+
+**Example**
+
+Input file::
+
+ chromosome GC telo fRec SNP
+ 1 38.6381 51797179 1.0662 0.012289
+ 2 38.8651 31413753 1.2255 0.008923
+ 3 41.4730 26482501 1.6308 0.015474
+ 4 44.9184 12412377 1.4997 0.022099
+ 5 39.4870 34991501 1.4439 0.013091
+ 6 38.3041 20816323 1.4700 0.014043
+
+Below is a heatmap using columns 2 to 5 from the above data, with centering and scaling by column:
+
+.. image:: ./static/operation_icons/heatmap_output.png
+
+
+
diff -r 000000000000 -r 89902ebc58b9 heatmap/r_wrapper.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/heatmap/r_wrapper.sh Thu Jan 22 10:41:06 2015 -0500
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+### Run R providing the R script in $1 as standard input and passing
+### the remaining arguments on the command line
+
+# Function that writes a message to stderr and exits
+function fail
+{
+ echo "$@" >&2
+ exit 1
+}
+
+# Ensure R executable is found
+which R > /dev/null || fail "'R' is required by this tool but was not found on path"
+
+# Extract first argument
+infile=$1; shift
+
+# Ensure the file exists
+test -f $infile || fail "R input file '$infile' does not exist"
+
+# Invoke R passing file named by first argument to stdin
+R --vanilla --slave $* < $infile
diff -r 000000000000 -r 89902ebc58b9 heatmap/test-data/heatmap_inp.tabular
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/heatmap/test-data/heatmap_inp.tabular Thu Jan 22 10:41:06 2015 -0500
@@ -0,0 +1,7 @@
+state GC telo fRec SNP
+1 38.6381 51797179 1.066205 0.012289
+2 38.8651 31413753 1.22548 0.008923
+3 41.473 26482501 1.63077 0.015474
+4 44.9184 12412376.5 1.499715 0.022099
+5 39.487 34991500.5 1.44399 0.013091
+6 38.3041 20816323 1.47006 0.014043
diff -r 000000000000 -r 89902ebc58b9 heatmap/test-data/heatmap_out.pdf
Binary file heatmap/test-data/heatmap_out.pdf has changed
diff -r 000000000000 -r 89902ebc58b9 heatmap/tool_dependencies.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/heatmap/tool_dependencies.xml Thu Jan 22 10:41:06 2015 -0500
@@ -0,0 +1,21 @@
+
+
+
+ $REPOSITORY_INSTALL_DIR
+
+
+
+
+ http://CRAN.R-project.org/src/base/R-2/R-2.15.0.tar.gz
+ ./configure --prefix=$INSTALL_DIR
+ make
+
+ $INSTALL_DIR/bin
+
+
+
+
+You need a FORTRAN compiler or perhaps f2c in addition to a C compiler to build R.
+
+
+