Mercurial > repos > iuc > ggplot2_heatmap2
comparison heatmap2.xml @ 5:3b37b1b1c3a7 draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/heatmap2 commit b04b237daba99e6992b27d1b65524744feb07d7d"
author | iuc |
---|---|
date | Tue, 12 Apr 2022 15:53:40 +0000 |
parents | ca7cb0eaad62 |
children | 566197475670 |
comparison
equal
deleted
inserted
replaced
4:ca7cb0eaad62 | 5:3b37b1b1c3a7 |
---|---|
1 <tool id="ggplot2_heatmap2" name="heatmap2" version="@VERSION@"> | 1 <tool id="ggplot2_heatmap2" name="heatmap2" version="@VERSION@"> |
2 <macros> | 2 <macros> |
3 <token name="@VERSION@">3.0.1</token> | 3 <token name="@VERSION@">3.1.1</token> |
4 </macros> | 4 </macros> |
5 <requirements> | 5 <requirements> |
6 <requirement type="package" version="@VERSION@">r-gplots</requirement> | 6 <requirement type="package" version="@VERSION@">r-gplots</requirement> |
7 <requirement type="package" version="1.1_2">r-rcolorbrewer</requirement> | 7 <requirement type="package" version="1.1_3">r-rcolorbrewer</requirement> |
8 </requirements> | 8 </requirements> |
9 <command detect_errors="exit_code"><![CDATA[ | 9 <command detect_errors="exit_code"><![CDATA[ |
10 cat '$script' && | 10 cat '$script' && |
11 Rscript '$script' | 11 Rscript '$script' |
12 ]]></command> | 12 ]]></command> |
37 linput <- log10(mat_input) | 37 linput <- log10(mat_input) |
38 #elif $transform == "log10plus1" | 38 #elif $transform == "log10plus1" |
39 linput <- log10(mat_input+1) | 39 linput <- log10(mat_input+1) |
40 #end if | 40 #end if |
41 | 41 |
42 #if $colorscheme == "whrd" | 42 #if $zscore_cond.zscore == "rows": |
43 colorscale = colfunc <- colorRampPalette(c("white", "red")) | 43 linput <- t(apply(linput, 1, scale)) |
44 #elif $colorscheme == "whblu" | 44 colnames(linput) <- colnames(input) |
45 colorscale = colfunc <- colorRampPalette(c("white", "blue")) | 45 rownames(linput) <- input[,1] |
46 #elif $colorscheme == "blwhre" | 46 scale <- "none" |
47 colorscale = colfunc <- colorRampPalette(c("blue","white", "red")) | 47 #elif $zscore_cond.zscore == "cols": |
48 #end if | 48 linput <- apply(linput, 2, scale) |
49 | 49 rownames(linput) <- input[,1] |
50 #if $labels== "both" | 50 scale <- "none" |
51 rlabs = NULL | 51 #elif $zscore_cond.zscore == "none": |
52 clabs = NULL | 52 scale <- "$zscore_cond.scale" |
53 #elif $labels== "rows" | 53 #end if |
54 rlabs = NULL | 54 |
55 clabs = FALSE | 55 srtCol <- 45 |
56 #elif $labels== "columns" | 56 #if $labels == "both" |
57 rlabs = FALSE | 57 rlabs <- NULL |
58 clabs = NULL | 58 clabs <- NULL |
59 #elif $labels== "none" | 59 #elif $labels == "rows" |
60 rlabs = FALSE | 60 rlabs <- NULL |
61 clabs = FALSE | 61 clabs <- FALSE |
62 #end if | 62 srtCol <- NULL |
63 | 63 #elif $labels == "columns" |
64 pdf(file='$output1') | 64 rlabs <- FALSE |
65 colorscale | 65 clabs <- NULL |
66 | 66 #elif $labels == "none" |
67 #if $cluster_cond.cluster: | 67 rlabs <- FALSE |
68 hclust_fun = function(x) hclust(x, method='$cluster_cond.clustering') | 68 clabs <- FALSE |
69 dist_fun = function(x) dist(x, method='$cluster_cond.distance') | 69 srtCol <- NULL |
70 #if $cluster_cond.cluster_cols_rows=="rows": | 70 #end if |
71 heatmap.2(linput, dendrogram="row", Colv=FALSE, Rowv=TRUE, | 71 |
72 distfun=dist_fun, hclustfun=hclust_fun, scale = '$scale', labRow = rlabs, labCol = clabs, | 72 #if $cluster_cond.cluster == "yes": |
73 col=colfunc(50), trace="none", density.info = "none", margins=c(8,8), | 73 dendrogramtoplot <- "$cluster_cond.cluster_cols_rows" |
74 main = '$title', key.xlab='$key', keysize=1, cexCol=0.8, cexRow = 0.8, srtCol=45) | 74 #if $cluster_cond.cluster_cols_rows == "both" |
75 #elif $cluster_cond.cluster_cols_rows=="columns": | 75 reorder_cols <- TRUE |
76 heatmap.2(linput, dendrogram="column", Colv=TRUE, Rowv=FALSE, | 76 reorder_rows <- TRUE |
77 distfun=dist_fun, hclustfun=hclust_fun, scale = '$scale', labRow = rlabs, labCol = clabs, | 77 #elif $cluster_cond.cluster_cols_rows == "row" |
78 col=colfunc(50), trace="none", density.info = "none", margins=c(8,8), | 78 reorder_cols <- FALSE |
79 main = '$title', key.xlab='$key', keysize=1, cexCol=0.8, cexRow = 0.8, srtCol=45) | 79 reorder_rows <- TRUE |
80 #else | 80 #elif $cluster_cond.cluster_cols_rows == "column" |
81 heatmap.2(linput, | 81 reorder_cols <- TRUE |
82 distfun=dist_fun, hclustfun=hclust_fun, scale = '$scale', labRow = rlabs, labCol = clabs, | 82 reorder_rows <- FALSE |
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 = 0.8, srtCol=45) | |
85 #end if | 83 #end if |
86 #else | 84 hclust_fun <- function(x) hclust(x, method='$cluster_cond.clustering') |
87 heatmap.2(linput, | 85 #if $cluster_cond.distance == 'pearson_correlation': |
88 dendrogram="none", Colv=FALSE, Rowv=FALSE, scale = '$scale', labRow = rlabs, labCol = clabs, | 86 dist_fun <- function(x) as.dist(1 - cor(t(x))) |
89 col=colfunc(50), trace="none", density.info = "none", margins=c(8,8), | 87 #elif $cluster_cond.distance == 'spearmann_correlation': |
90 main='$title', key.xlab='$key', keysize=1, cexCol=0.8, cexRow = 0.8, srtCol=45) | 88 dist_fun <- function(x) as.dist(1 - cor(t(x), method="spearman")) |
91 #end if | 89 #else: |
90 dist_fun <- function(x) dist(x, method='$cluster_cond.distance') | |
91 #end if | |
92 #else: | |
93 dendrogramtoplot <- "none" | |
94 reorder_cols <- FALSE | |
95 reorder_rows <- FALSE | |
96 hclust_fun <- hclust | |
97 dist_fun <- dist | |
98 #end if | |
99 | |
100 ncolors <- 50 | |
101 #if $colorchoice.type == "palettes": | |
102 colused <- brewer.pal(ncolors, "$colorchoice.name") | |
103 #elif $colorchoice.type == "two" | |
104 colused <- colorRampPalette(c("$colorchoice.color1", "$colorchoice.color2"))(ncolors) | |
105 #elif $colorchoice.type == "three" | |
106 colused <- colorRampPalette(c("$colorchoice.color1", "$colorchoice.color2", "$colorchoice.color3"))(ncolors) | |
107 #end if | |
108 | |
109 #if $image_file_format == "pdf": | |
110 pdf(file='$output1') | |
111 #else: | |
112 png(file='$output1') | |
113 #end if | |
114 | |
115 heatmap.2(linput, dendrogram=dendrogramtoplot, Colv=reorder_cols, Rowv=reorder_rows, | |
116 distfun=dist_fun, hclustfun=hclust_fun, scale = scale, labRow = rlabs, labCol = clabs, | |
117 col=colused, trace="none", density.info = "none", margins=c(8,8), | |
118 main = '$title', key.xlab='$key', keysize=1, cexCol=0.8, cexRow = 0.8, srtCol=srtCol) | |
92 | 119 |
93 dev.off() | 120 dev.off() |
94 ]]></configfile> | 121 ]]></configfile> |
95 </configfiles> | 122 </configfiles> |
96 | 123 |
97 <inputs> | 124 <inputs> |
98 <param name="input1" type="data" format="tabular" label="Input should have column headers - these will be the columns that are plotted"/> | 125 <param name="input1" type="data" format="tabular" |
126 label="Input should have column headers - these will be the columns that are plotted and row names."/> | |
99 <param name="title" type="text" format="txt" label="Plot title"/> | 127 <param name="title" type="text" format="txt" label="Plot title"/> |
100 <param name="key" type="text" format="txt" label="key title"/> | 128 <param name="key" type="text" format="txt" label="key title"/> |
101 <param name="transform" type="select" label="Data transformation"> | 129 <param name="transform" type="select" label="Data transformation"> |
102 <option value="none">Plot the data as it is</option> | 130 <option value="none">Plot the data as it is</option> |
103 <option value="log2">Log2(value) transform my data</option> | 131 <option value="log2">Log2(value) transform my data</option> |
104 <option value="log2plus1">Log2(value+1) transform my data</option> | 132 <option value="log2plus1">Log2(value+1) transform my data</option> |
105 <option value="log10">Log10(value) transform my data</option> | 133 <option value="log10">Log10(value) transform my data</option> |
106 <option value="log10plus1">Log10(value+1) transform my data</option> | 134 <option value="log10plus1">Log10(value+1) transform my data</option> |
107 </param> | 135 </param> |
136 <conditional name="zscore_cond"> | |
137 <param name="zscore" type="select" label="Compute z-scores prior to clustering"> | |
138 <option value="none">Do not compute z-scores</option> | |
139 <option value="rows">Compute on rows</option> | |
140 <option value="cols">Compute on columns</option> | |
141 </param> | |
142 <when value="none"> | |
143 <param name="scale" type="select" label="Scale data on the plot (after clustering)" > | |
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 </when> | |
149 <when value="rows"/> | |
150 <when value="cols"/> | |
151 </conditional> | |
108 <conditional name="cluster_cond"> | 152 <conditional name="cluster_cond"> |
109 <param name="cluster" type="select" label="Enable data clustering"> | 153 <param name="cluster" type="select" label="Enable data clustering"> |
110 <option value="true">Yes</option> | 154 <option value="yes">Yes</option> |
111 <option value="">No</option> | 155 <option value="no">No</option> |
112 </param> | 156 </param> |
113 <when value="true"> | 157 <when value="yes"> |
114 <param name="cluster_cols_rows" type="select" label="Clustering columns and rows"> | 158 <param name="cluster_cols_rows" type="select" label="Clustering columns and rows"> |
115 <option value="both" selected="true">Cluster rows and columns</option> | 159 <option value="both" selected="true">Cluster rows and columns</option> |
116 <option value="rows">Cluster rows and not columns</option> | 160 <option value="row">Cluster rows and not columns</option> |
117 <option value="columns">Cluster columns and not rows</option> | 161 <option value="column">Cluster columns and not rows</option> |
118 </param> | 162 </param> |
119 <param name="distance" type="select" label="Distance method" help="The method used to compute the distance (dissimilarity) between both rows and columns. Default: Euclidean" > | 163 <param name="distance" type="select" label="Distance method" help="The method used to compute the distance (dissimilarity) between both rows and columns. Default: Euclidean" > |
120 <option value="euclidean" selected="true">Euclidean</option> | 164 <option value="euclidean" selected="true">Euclidean</option> |
121 <option value="maximum">Maximum</option> | 165 <option value="maximum">Maximum</option> |
166 <option value="manhattan">Manhattan</option> | |
167 <option value="canberra">Canberra</option> | |
168 <option value="binary">Binary</option> | |
169 <option value="minkowski">Minkowski</option> | |
170 <option value="pearson_correlation">Pearson's correlation (1 - correlation coefficient)</option> | |
171 <option value="spearmann_correlation">Spearmann's correlation (1 - correlation coefficient)</option> | |
122 </param> | 172 </param> |
123 <param name="clustering" type="select" label="Clustering method" help="The method used to compute the hierarchical clustering. Default: Complete" > | 173 <param name="clustering" type="select" label="Clustering method" help="The method used to compute the hierarchical clustering. Default: Complete" > |
124 <option value="complete" selected="true">Complete</option> | 174 <option value="complete" selected="true">Complete</option> |
125 <option value="average">Average</option> | 175 <option value="average">Average (= UPGMA)</option> |
126 </param> | 176 <option value="ward.D">ward.D</option> |
127 </when> | 177 <option value="ward.D2">ward.D2</option> |
128 <when value=""/> | 178 <option value="single">single</option> |
179 <option value="mcquitty">mcquitty (= WPGMA)</option> | |
180 <option value="median">median (= WPGMC)</option> | |
181 <option value="centroid">centroid (= UPGMC)</option> | |
182 </param> | |
183 </when> | |
184 <when value="no"/> | |
129 </conditional> | 185 </conditional> |
130 <param name="labels" type="select" label="Labeling columns and rows" > | 186 <param name="labels" type="select" label="Labeling columns and rows" > |
131 <option value="both" selected="true">Label my columns and rows</option> | 187 <option value="both" selected="true">Label my columns and rows</option> |
132 <option value="rows">Label rows and not columns</option> | 188 <option value="rows">Label rows and not columns</option> |
133 <option value="columns">Label columns and not rows</option> | 189 <option value="columns">Label columns and not rows</option> |
134 <option value="none">Do not label rows or columns</option> | 190 <option value="none">Do not label rows or columns</option> |
135 </param> | 191 </param> |
136 <param name="colorscheme" type="select" label="Coloring groups" > | 192 <conditional name="colorchoice"> |
137 <option value="whrd" selected="true">White to red</option> | 193 <param name="type" type="select" label="Type of colormap to use"> |
138 <option value="whblu">White to blue</option> | 194 <option value="palettes">RColorBrewer palettes</option> |
139 <option value="blwhre">Blue to white to red</option> | 195 <option value="two">Gradient with 2 colors</option> |
140 </param> | 196 <option value="three">Gradient with 3 colors</option> |
141 <param name="scale" type="select" label="Data scaling" > | 197 </param> |
142 <option value="none" selected="true">Do not scale my data</option> | 198 <when value="palettes"> |
143 <option value="row">Scale my data by row</option> | 199 <param name="name" type="select" label="Name of the colormap"> |
144 <option value="column">Scale my data by column</option> | 200 <option value="BrBG">BrBG</option> |
201 <option value="PiYG">PiYG</option> | |
202 <option value="PRGn">PRGn</option> | |
203 <option value="PuOr">PuOr</option> | |
204 <option value="RdBu">RdBu</option> | |
205 <option value="RdGy">RdGy</option> | |
206 <option value="RdYlBu">RdYlBu</option> | |
207 <option value="RdYlGn">RdYlGn</option> | |
208 <option value="Spectral">Spectral</option> | |
209 <option value="Blues">Blues</option> | |
210 <option value="BuGn">BuGn</option> | |
211 <option value="BuPu">BuPu</option> | |
212 <option value="GnBu">GnBu</option> | |
213 <option value="Greens">Greens</option> | |
214 <option value="Greys">Greys</option> | |
215 <option value="Oranges">Oranges</option> | |
216 <option value="OrRd">OrRd</option> | |
217 <option value="PuBu">PuBu</option> | |
218 <option value="PuBuGn">PuBuGn</option> | |
219 <option value="PuRd">PuRd</option> | |
220 <option value="Purples">Purples</option> | |
221 <option value="RdPu">RdPu</option> | |
222 <option value="Reds">Reds</option> | |
223 <option value="YlGn">YlGn</option> | |
224 <option value="YlGnBu">YlGnBu</option> | |
225 <option value="YlOrBr">YlOrBr</option> | |
226 <option value="YlOrRd">YlOrRd</option> | |
227 </param> | |
228 </when> | |
229 <when value="two"> | |
230 <param name="color1" type="color" value="#ffffff" label="First color" /> | |
231 <param name="color2" type="color" value="#ff0000" label="Second color" /> | |
232 </when> | |
233 <when value="three"> | |
234 <param name="color1" type="color" value="#0000ff" label="First color" /> | |
235 <param name="color2" type="color" value="#ffffff" label="Second color" /> | |
236 <param name="color3" type="color" value="#ff0000" label="Third color" /> | |
237 </when> | |
238 </conditional> | |
239 <param name="image_file_format" type="select" label="Output format"> | |
240 <option value="pdf">PDF</option> | |
241 <option value="png">PNG</option> | |
145 </param> | 242 </param> |
146 </inputs> | 243 </inputs> |
147 <outputs> | 244 <outputs> |
148 <data name="output1" format="pdf"/> | 245 <data name="output1" format="pdf"> |
246 <change_format> | |
247 <when input="image_file_format" value="png" format="png" /> | |
248 </change_format> | |
249 </data> | |
149 </outputs> | 250 </outputs> |
150 <tests> | 251 <tests> |
151 <test> | 252 <test> |
152 <param name="input1" value="mtcars.txt"/> | 253 <param name="input1" value="mtcars.txt"/> |
153 <param name="cluster" value="true"/> | 254 <param name="cluster" value="yes"/> |
255 <param name="type" value="two"/> | |
154 <output name="output1" file="result1.pdf" compare="sim_size"/> | 256 <output name="output1" file="result1.pdf" compare="sim_size"/> |
155 </test> | 257 </test> |
156 <test> | 258 <test> |
157 <param name="input1" value="mtcars.txt"/> | 259 <param name="input1" value="mtcars.txt"/> |
158 <param name="cluster" value=""/> | 260 <param name="cluster" value="no"/> |
159 <output name="output1" file="result2.pdf" compare="sim_size"/> | 261 <param name="image_file_format" value="png"/> |
262 <output name="output1" file="result2.png" compare="sim_size"/> | |
263 </test> | |
264 <test> | |
265 <param name="input1" value="mtcars.txt"/> | |
266 <param name="zscore" value="cols"/> | |
267 <param name="cluster" value="yes"/> | |
268 <param name="cluster_cols_rows" value="row"/> | |
269 <param name="labels" value="rows"/> | |
270 <param name="type" value="three"/> | |
271 <param name="image_file_format" value="png"/> | |
272 <output name="output1" file="result3.png" compare="sim_size"/> | |
273 </test> | |
274 <test> | |
275 <param name="input1" value="mtcars.txt"/> | |
276 <param name="cluster" value="yes"/> | |
277 <param name="distance" value="pearson_correlation"/> | |
278 <param name="type" value="two"/> | |
279 <output name="output1" file="result1pearson.pdf" compare="sim_size"/> | |
160 </test> | 280 </test> |
161 </tests> | 281 </tests> |
162 <help><![CDATA[ | 282 <help><![CDATA[ |
163 This tool employs the heatmap.2 function from the R gplots package and will generate a heatmap of your data. If clustering is enabled, the heatmap uses the Euclidean distance method and the Complete hierarchical clustering method by default. | 283 This tool employs the heatmap.2 function from the R gplots package and will generate a heatmap of your data. If clustering is enabled, the heatmap uses the Euclidean distance method and the Complete hierarchical clustering method by default. |
164 | 284 |