comparison heatmap2.xml @ 0:76380bf74511 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ggplot2 commit 6e466ce83e2e5c0dd0ba30356d0488cf74574b8f
author iuc
date Tue, 22 Aug 2017 06:42:38 -0400
parents
children cb04f3235a4e
comparison
equal deleted inserted replaced
-1:000000000000 0:76380bf74511
1 <tool id="ggplot2_heatmap2" name="heatmap2" version="@VERSION@">
2 <macros>
3 <import>macros.xml</import>
4 </macros>
5 <expand macro="requirements">
6 <requirement type="package" version="3.0.1">r-gplots</requirement>
7 <requirement type="package" version="1.1_2">r-rcolorbrewer</requirement>
8 </expand>
9 <command detect_errors="exit_code"><![CDATA[
10 cat '$script' &&
11 Rscript '$script' &&
12 mv output_plot.pdf $output1
13 ]]></command>
14 <configfiles>
15 <configfile name="script"><![CDATA[
16
17 @R_INIT@
18
19 ## Import library
20 library("RColorBrewer")
21 library("gplots")
22
23 input <- read.delim('$input1', sep='\t', header=TRUE)
24
25 mat_input <- data.matrix(input[,2:ncol(input)])
26 rownames(mat_input) <- input[,1]
27
28 hclust_fun = function(x) hclust(x, method="complete")
29 dist_fun = function(x) dist(x, method="maximum")
30 distfun=dist_fun
31 hclustfun=hclust_fun
32
33 #if $transform == "none"
34 linput <- mat_input
35 #elif $transform == "log2"
36 linput <- log2(mat_input)
37 #elif $transform == "log2plus1"
38 linput <- log2(mat_input+1)
39 #elif $transform == "log10"
40 linput <- log10(mat_input)
41 #elif $transform == "log10plus1"
42 linput <- log10(mat_input+1)
43 #end if
44
45 #if $colorscheme == "whrd"
46 colorscale = colfunc <- colorRampPalette(c("white", "red"))
47 #elif $colorscheme == "whblu"
48 colorscale = colfunc <- colorRampPalette(c("white", "blue"))
49 #elif $colorscheme == "blwhre"
50 colorscale = colfunc <- colorRampPalette(c("blue","white", "red"))
51 #end if
52
53 #if $labels== "both"
54 rlabs = NULL
55 clabs = NULL
56 #elif $labels== "rows"
57 rlabs = NULL
58 clabs = FALSE
59 #elif $labels== "columns"
60 rlabs = FALSE
61 clabs = NULL
62 #elif $labels== "none"
63 rlabs = FALSE
64 clabs = FALSE
65 #end if
66
67 pdf(file='output_plot.pdf')
68 colorscale
69
70 #if $cluster:
71 heatmap.2(linput,
72 distfun=dist_fun, hclustfun=hclust_fun, scale = '$scale', labRow = rlabs, labCol = clabs,
73 col=colfunc(50), trace="none", density.info = "none", margins=c(8,2),
74 main = '$title', key.xlab='$key', keysize=1)
75 #else
76 heatmap.2(linput,
77 dendrogram="none", scale = '$scale', labRow = rlabs, labCol = clabs,
78 col=colfunc(50), trace="none", density.info = "none", margins=c(8,2),
79 main='$title', key.xlab='$key', keysize=1)
80 #end if
81
82 dev.off()
83
84 ]]></configfile>
85 </configfiles>
86
87 <inputs>
88 <param name="input1" type="data" format="tabular" label="Input should have column headers - these will be the columns that are plotted"/>
89 <param name="title" type="text" format="txt" label="Plot title"/>
90 <param name="key" type="text" format="txt" label="key title"/>
91 <expand macro="transform" />
92 <param name="cluster" type="boolean" truevalue="true" falsevalue="false" checked="false" label="Enable data clustering" />
93 <param name="labels" type="select" label="Labeling columns and rows" >
94 <option value="both" selected="True">Label my columns and rows</option>
95 <option value="rows">Label rows and not columns</option>
96 <option value="columns">Label columns and not rows</option>
97 <option value="none">Do not label rows or columns</option>
98 </param>
99 <param name="colorscheme" type="select" label="Coloring groups" >
100 <option value="whrd" selected="True">White to red</option>
101 <option value="whblu">White to blue</option>
102 <option value="blwhre">Blue to white to red</option>
103 </param>
104 <param name="scale" type="select" label="Data scaling" >
105 <option value="none" selected="True">Do not scale my data</option>
106 <option value="row">Scale my data by row</option>
107 <option value="column">Scale my data by column</option>
108 </param>
109 </inputs>
110 <outputs>
111 <data name="output1" format="pdf" from_work_dir="Rplot.pdf"/>
112 </outputs>
113 <tests>
114 <test>
115 <param name="input1" value="mtcars.txt"/>
116 <output name="output1" file="ggplot_heatmap2_result1.pdf" compare="sim_size"/>
117 </test>
118 </tests>
119 <help><![CDATA[
120 This tool will generate a clustered heatmap of your data. More customization options will be added, for now the heatmap uses a red coloring scheme and clustering is performed using the "maximum" similarity measure and the "complete" hierarchical clustering measure.
121
122 Input data should have row labels in the first column and column labels. For example, the row labels (the first column) should represent gene IDs and the column labels should represent sample IDs.
123
124 This wrapper employs the heatmap.2 function of R.
125 ]]></help>
126 <expand macro="citations"/>
127 </tool>