Mercurial > repos > artbio > high_dim_heatmap
comparison heatmap.xml @ 0:22d5d811dc37 draft
planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/high_dim_heatmap commit 3839913fd15008dd999f2da10dcb6797ddb8dbdc
author | artbio |
---|---|
date | Sat, 20 Jul 2019 17:55:20 -0400 |
parents | |
children | 58b36ae7baca |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:22d5d811dc37 |
---|---|
1 <tool id="high_dim_heatmap" name="Plot heatmap" version="1.0.0"> | |
2 <description>with high number of rows</description> | |
3 <requirements> | |
4 <requirement type="package" version="3.0.1">r-gplots</requirement> | |
5 <requirement type="package" version="1.1_2">r-rcolorbrewer</requirement> | |
6 </requirements> | |
7 <command detect_errors="exit_code"><![CDATA[ | |
8 cat '$script' && | |
9 Rscript '$script' | |
10 ]]></command> | |
11 <configfiles> | |
12 <configfile name="script"><![CDATA[ | |
13 ## Setup R error handling to go to stderr | |
14 options(show.error.messages=F, error=function(){cat(geterrmessage(), file=stderr()); q("no",1,F)}) | |
15 | |
16 ## Unify locale settings | |
17 loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8") | |
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 #if $transform == "none" | |
29 linput <- mat_input | |
30 #elif $transform == "log2" | |
31 linput <- log2(mat_input) | |
32 #elif $transform == "log2plus1" | |
33 linput <- log2(mat_input+1) | |
34 #elif $transform == "log10" | |
35 linput <- log10(mat_input) | |
36 #elif $transform == "log10plus1" | |
37 linput <- log10(mat_input+1) | |
38 #end if | |
39 | |
40 #if $colorscheme == "whrd" | |
41 colorscale = colfunc <- colorRampPalette(c("white", "red")) | |
42 #elif $colorscheme == "whblu" | |
43 colorscale = colfunc <- colorRampPalette(c("white", "blue")) | |
44 #elif $colorscheme == "blwhre" | |
45 colorscale = colfunc <- colorRampPalette(c("blue","white", "red")) | |
46 #end if | |
47 | |
48 #if $labels== "both" | |
49 rlabs = NULL | |
50 clabs = NULL | |
51 #elif $labels== "rows" | |
52 rlabs = NULL | |
53 clabs = FALSE | |
54 #elif $labels== "columns" | |
55 rlabs = FALSE | |
56 clabs = NULL | |
57 #elif $labels== "none" | |
58 rlabs = FALSE | |
59 clabs = FALSE | |
60 #end if | |
61 | |
62 pdf(file='$output1', paper='special', height=$height) | |
63 colorscale | |
64 | |
65 #if $cluster_cond.cluster: | |
66 hclust_fun = function(x) hclust(x, method='$cluster_cond.clustering') | |
67 dist_fun = function(x) dist(x, method='$cluster_cond.distance') | |
68 #if $cluster_cond.cluster_cols_rows=="rows": | |
69 heatmap.2(linput, dendrogram="row", Colv=FALSE, Rowv=TRUE, | |
70 distfun=dist_fun, hclustfun=hclust_fun, scale = '$scale', labRow = rlabs, labCol = clabs, | |
71 col=colfunc(50), trace="none", density.info = "none", margins=c(8,8), | |
72 main = '$title', key.xlab='$key', keysize=1, cexCol=0.8, cexRow = $rowfontsize, srtCol=45, | |
73 lhei=c(1, $lineheight)) | |
74 #elif $cluster_cond.cluster_cols_rows=="columns": | |
75 heatmap.2(linput, dendrogram="column", Colv=TRUE, Rowv=FALSE, | |
76 distfun=dist_fun, hclustfun=hclust_fun, scale = '$scale', labRow = rlabs, labCol = clabs, | |
77 col=colfunc(50), trace="none", density.info = "none", margins=c(8,8), | |
78 main = '$title', key.xlab='$key', keysize=1, cexCol=0.8, cexRow = $rowfontsize, srtCol=45, | |
79 lhei=c(1, $lineheight)) | |
80 #else | |
81 heatmap.2(linput, | |
82 distfun=dist_fun, hclustfun=hclust_fun, scale = '$scale', labRow = rlabs, labCol = clabs, | |
83 col=colfunc(50), trace="none", density.info = "none", margins=c(8,8), | |
84 main = '$title', key.xlab='$key', keysize=1, cexCol=0.8, cexRow = $rowfontsize, srtCol=45, | |
85 lhei=c(1, $lineheight)) | |
86 #end if | |
87 #else | |
88 heatmap.2(linput, | |
89 dendrogram="none", Colv=FALSE, Rowv=FALSE, scale = '$scale', labRow = rlabs, labCol = clabs, | |
90 col=colfunc(50), trace="none", density.info = "none", margins=c(8,8), | |
91 main='$title', key.xlab='$key', keysize=1, cexCol=0.8, cexRow = $rowfontsize, srtCol=45, | |
92 lhei=c(1, $lineheight)) | |
93 #end if | |
94 | |
95 dev.off() | |
96 ]]></configfile> | |
97 </configfiles> | |
98 | |
99 <inputs> | |
100 <param name="input1" type="data" format="tabular" label="Input should have column headers - these will be the columns that are plotted"/> | |
101 <param name="title" type="text" format="txt" label="Plot title"/> | |
102 <param name="key" type="text" format="txt" label="key title"/> | |
103 <param name="transform" type="select" label="Data transformation"> | |
104 <option value="none">Plot the data as it is</option> | |
105 <option value="log2">Log2(value) transform my data</option> | |
106 <option value="log2plus1">Log2(value+1) transform my data</option> | |
107 <option value="log10">Log10(value) transform my data</option> | |
108 <option value="log10plus1">Log10(value+1) transform my data</option> | |
109 </param> | |
110 <conditional name="cluster_cond"> | |
111 <param name="cluster" type="select" label="Enable data clustering"> | |
112 <option value="true">Yes</option> | |
113 <option value="">No</option> | |
114 </param> | |
115 <when value="true"> | |
116 <param name="cluster_cols_rows" type="select" label="Clustering columns and rows"> | |
117 <option value="both" selected="true">Cluster rows and columns</option> | |
118 <option value="rows">Cluster rows and not columns</option> | |
119 <option value="columns">Cluster columns and not rows</option> | |
120 </param> | |
121 <param name="distance" type="select" label="Distance method" help="The method used to compute the distance (dissimilarity) between both rows and columns. Default: Euclidean" > | |
122 <option value="euclidean" selected="true">Euclidean</option> | |
123 <option value="maximum">Maximum</option> | |
124 </param> | |
125 <param name="clustering" type="select" label="Clustering method" help="The method used to compute the hierarchical clustering. Default: Complete" > | |
126 <option value="complete" selected="true">Complete</option> | |
127 <option value="average">Average</option> | |
128 </param> | |
129 </when> | |
130 <when value=""/> | |
131 </conditional> | |
132 <param name="labels" type="select" label="Labeling columns and rows" > | |
133 <option value="both" selected="true">Label my columns and rows</option> | |
134 <option value="rows">Label rows and not columns</option> | |
135 <option value="columns">Label columns and not rows</option> | |
136 <option value="none">Do not label rows or columns</option> | |
137 </param> | |
138 <param name="colorscheme" type="select" label="Coloring groups" > | |
139 <option value="whrd" selected="true">White to red</option> | |
140 <option value="whblu">White to blue</option> | |
141 <option value="blwhre">Blue to white to red</option> | |
142 </param> | |
143 <param name="scale" type="select" label="Data scaling" > | |
144 <option value="none" selected="true">Do not scale my data</option> | |
145 <option value="row">Scale my data by row</option> | |
146 <option value="column">Scale my data by column</option> | |
147 </param> | |
148 | |
149 <param name="height" type="float" label="tweak plot height" value="7" /> | |
150 <param name="rowfontsize" type="float" label="tweak row label size" value="0.8" /> | |
151 <param name="lineheight" type="integer" label="tweak line height" value="4" /> | |
152 </inputs> | |
153 <outputs> | |
154 <data name="output1" format="pdf"/> | |
155 </outputs> | |
156 <tests> | |
157 <test> | |
158 <param name="input1" value="mtcars.txt"/> | |
159 <param name="cluster" value="true"/> | |
160 <output name="output1" file="result1.pdf"/> | |
161 </test> | |
162 <test> | |
163 <param name="input1" value="mtcars.txt"/> | |
164 <param name="cluster" value=""/> | |
165 <output name="output1" file="result2.pdf"/> | |
166 </test> | |
167 <test> | |
168 <param name="input1" value="complex_table.tsv"/> | |
169 <param name="transform" value="log2plus1"/> | |
170 <param name="cluster" value=""/> | |
171 <param name="colorscheme" value="blwhre"/> | |
172 <param name="height" value="21"/> | |
173 <param name="rowfontsize" value="0.4"/> | |
174 <param name="lineheight" value="15"/> | |
175 <output name="output1" file="complex_result1.pdf"/> | |
176 </test> | |
177 </tests> | |
178 <help><![CDATA[ | |
179 This tool employs the heatmap.2 function from the R gplots package and will generate a | |
180 heatmap of your data. If clustering is enabled, the heatmap uses the Euclidean distance | |
181 method and the Complete hierarchical clustering method by default. | |
182 | |
183 Input data should have row labels in the first column and column labels. For example, | |
184 the row labels (the first column) should represent gene IDs and the column labels should | |
185 represent sample IDs. | |
186 | |
187 To adapt heatmap.2 to high number of lines, tweak the parameters: | |
188 | |
189 - `tweak plot height`. By default 7 (inches), this can be increased to 14, 21, 28, etc.. | |
190 - `tweak row label size`. By default 0.8. This is usually diminished to 0.3, 0.1, etc to | |
191 adapt the label font to high number of rows | |
192 - `tweak line height`. By default 4. This is a metric to define the relative size of the | |
193 heatmap panel in the plot layout. This is a bit tricky to adjust, but should be adapted | |
194 when plot height is increased (typically to 8, 10, 15, etc...) | |
195 | |
196 For instance, upload the dataset | |
197 https://raw.githubusercontent.com/ARTbio/tools-artbio/master/tools/high_dim_heatmap/test-data/complex_table.tsv | |
198 to your account and test this tools with: | |
199 | |
200 - `tweak plot height` : 21.0 | |
201 - `tweak row label size`: 0.4 | |
202 - `tweak line height`: 14 | |
203 | |
204 | |
205 ]]></help> | |
206 <citations> | |
207 </citations> | |
208 </tool> |