comparison heatmap.xml @ 2:17f627ee8f5a draft

"planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/high_dim_heatmap commit ba6089071a53fbf08df00c0f94dfc8515b7c858b"
author artbio
date Tue, 26 Oct 2021 10:22:28 +0000
parents 58b36ae7baca
children cf72f579d100
comparison
equal deleted inserted replaced
1:58b36ae7baca 2:17f627ee8f5a
1 <tool id="high_dim_heatmap" name="Plot heatmap" version="1.1.0"> 1 <tool id="high_dim_heatmap" name="Plot heatmap" version="1.2.0">
2 <description>with high number of rows</description> 2 <description>with high number of rows</description>
3 <requirements> 3 <requirements>
4 <requirement type="package" version="3.0.1">r-gplots</requirement> 4 <requirement type="package" version="3.0.1">r-gplots</requirement>
5 <requirement type="package" version="1.1_2">r-rcolorbrewer</requirement> 5 <requirement type="package" version="1.1_2">r-rcolorbrewer</requirement>
6 </requirements> 6 </requirements>
20 library("RColorBrewer") 20 library("RColorBrewer")
21 library("gplots") 21 library("gplots")
22 22
23 input <- read.delim('$input1', sep='\t', header=TRUE) 23 input <- read.delim('$input1', sep='\t', header=TRUE)
24 24
25 mat_input <- data.matrix(input[,2:ncol(input)]) 25 mat_input <- data.matrix(input[, 2:ncol(input)])
26 rownames(mat_input) <- input[,1] 26 rownames(mat_input) <- input[, 1]
27 27
28 #if $transform == "none" 28 #if $transform == "none"
29 linput <- mat_input 29 linput <- mat_input
30 #elif $transform == "log2" 30 #elif $transform == "log2"
31 linput <- log2(mat_input) 31 linput <- log2(mat_input)
32 #elif $transform == "log2plus1" 32 #elif $transform == "log2plus1"
33 linput <- log2(mat_input+1) 33 linput <- log2(mat_input + 1)
34 #elif $transform == "log10" 34 #elif $transform == "log10"
35 linput <- log10(mat_input) 35 linput <- log10(mat_input)
36 #elif $transform == "log10plus1" 36 #elif $transform == "log10plus1"
37 linput <- log10(mat_input+1) 37 linput <- log10(mat_input + 1)
38 #end if 38 #end if
39 39
40 #if $colorscheme == "whrd" 40 #if $colorscheme == "whrd"
41 colorscale = colfunc <- colorRampPalette(c("white", "red")) 41 colfunc <- colorRampPalette(c("white", "red"))
42 #elif $colorscheme == "whblu" 42 #elif $colorscheme == "whblu"
43 colorscale = colfunc <- colorRampPalette(c("white", "blue")) 43 colfunc <- colorRampPalette(c("white", "blue"))
44 #elif $colorscheme == "blwhre" 44 #elif $colorscheme == "blwhre"
45 colorscale = colfunc <- colorRampPalette(c("blue","white", "red")) 45 colfunc <- colorRampPalette(c("blue","white", "red"))
46 #elif $colorscheme == "yeblu" 46 #elif $colorscheme == "yeblu"
47 colorscale = colfunc <- colorRampPalette(c("lightyellow", "royalblue4")) 47 colfunc <- colorRampPalette(c("lightyellow", "royalblue4"))
48 #end if 48 #end if
49 49
50 #if $labels== "both" 50 #if $labels== "both"
51 rlabs = NULL 51 rlabs = NULL
52 clabs = NULL 52 clabs = NULL
59 #elif $labels== "none" 59 #elif $labels== "none"
60 rlabs = FALSE 60 rlabs = FALSE
61 clabs = FALSE 61 clabs = FALSE
62 #end if 62 #end if
63 63
64 pdf(file='$output1', paper='special', height=$height) 64 pdf(file = '$output1', paper = 'special', height = $height)
65 colorscale 65 par(cex.main = $title_size)
66 66
67 #if $cluster_cond.cluster: 67 #if $cluster_cond.cluster:
68 hclust_fun = function(x) hclust(x, method='$cluster_cond.clustering') 68 hclust_fun = function(x) hclust(x, method = '$cluster_cond.clustering')
69 dist_fun = function(x) dist(x, method='$cluster_cond.distance') 69 dist_fun = function(x) dist(x, method = '$cluster_cond.distance')
70 #if $cluster_cond.cluster_cols_rows=="rows": 70 #if $cluster_cond.cluster_cols_rows == "rows":
71 heatmap.2(linput, dendrogram="row", Colv=FALSE, Rowv=TRUE, 71 heatmap.2(linput, dendrogram="row", Colv = FALSE, Rowv = TRUE,
72 distfun=dist_fun, hclustfun=hclust_fun, scale = '$scale', labRow = rlabs, labCol = clabs, 72 distfun = dist_fun, hclustfun = hclust_fun, scale = '$scale', labRow = rlabs,
73 col=colfunc(50), trace="none", density.info = "none", margins=c(8,8), 73 labCol = clabs, col = colfunc(50), trace = "none", density.info = "none",
74 main = '$title', key.xlab='$key', keysize=1, cexCol=0.8, cexRow = $rowfontsize, srtCol=45, 74 margins = c(8,8), main = '$title', key.xlab = '$key', keysize = 1,
75 lhei=c(1, $lineheight)) 75 cexCol = 0.8, cexRow = $rowfontsize, srtCol = 45, lhei = c(1, $lineheight))
76 #elif $cluster_cond.cluster_cols_rows=="columns": 76 #elif $cluster_cond.cluster_cols_rows == "columns":
77 heatmap.2(linput, dendrogram="column", Colv=TRUE, Rowv=FALSE, 77 heatmap.2(linput, dendrogram = "column", Colv = TRUE, Rowv = FALSE,
78 distfun=dist_fun, hclustfun=hclust_fun, scale = '$scale', labRow = rlabs, labCol = clabs, 78 distfun = dist_fun, hclustfun = hclust_fun, scale = '$scale', labRow = rlabs,
79 col=colfunc(50), trace="none", density.info = "none", margins=c(8,8), 79 labCol = clabs, col = colfunc(50), trace = "none", density.info = "none",
80 main = '$title', key.xlab='$key', keysize=1, cexCol=0.8, cexRow = $rowfontsize, srtCol=45, 80 margins = c(8,8), main = '$title', key.xlab = '$key', keysize = 1,
81 lhei=c(1, $lineheight)) 81 cexCol = 0.8, cexRow = $rowfontsize, srtCol = 45, lhei = c(1, $lineheight))
82 #else 82 #else
83 heatmap.2(linput, 83 heatmap.2(linput,
84 distfun=dist_fun, hclustfun=hclust_fun, scale = '$scale', labRow = rlabs, labCol = clabs, 84 distfun = dist_fun, hclustfun = hclust_fun, scale = '$scale', labRow = rlabs,
85 col=colfunc(50), trace="none", density.info = "none", margins=c(8,8), 85 labCol = clabs, col = colfunc(50), trace = "none", density.info = "none",
86 main = '$title', key.xlab='$key', keysize=1, cexCol=0.8, cexRow = $rowfontsize, srtCol=45, 86 margins = c(8,8), main = '$title', key.xlab = '$key', keysize = 1,
87 lhei=c(1, $lineheight)) 87 cexCol = 0.8, cexRow = $rowfontsize, srtCol = 45, lhei = c(1, $lineheight))
88 #end if 88 #end if
89 #else 89 #else
90 heatmap.2(linput, 90 heatmap.2(linput,
91 dendrogram="none", Colv=FALSE, Rowv=FALSE, scale = '$scale', labRow = rlabs, labCol = clabs, 91 dendrogram = "none", Colv = FALSE, Rowv = FALSE, scale = '$scale', labRow = rlabs,
92 col=colfunc(50), trace="none", density.info = "none", margins=c(8,8), 92 labCol = clabs, col = colfunc(50), trace="none", density.info = "none",
93 main='$title', key.xlab='$key', keysize=1, cexCol=0.8, cexRow = $rowfontsize, srtCol=45, 93 margins = c(8,8), main = '$title', key.xlab = '$key', keysize = 1, cexCol = 0.8,
94 lhei=c(1, $lineheight)) 94 cexRow = $rowfontsize, srtCol = 45, lhei = c(1, $lineheight))
95 #end if 95 #end if
96 96
97 dev.off() 97 dev.off()
98 ]]></configfile> 98 ]]></configfile>
99 </configfiles> 99 </configfiles>
147 <option value="none" selected="true">Do not scale my data</option> 147 <option value="none" selected="true">Do not scale my data</option>
148 <option value="row">Scale my data by row</option> 148 <option value="row">Scale my data by row</option>
149 <option value="column">Scale my data by column</option> 149 <option value="column">Scale my data by column</option>
150 </param> 150 </param>
151 151
152 <param name="title_size" type="float" label="tweak main title size" value="1" />
152 <param name="height" type="float" label="tweak plot height" value="7" /> 153 <param name="height" type="float" label="tweak plot height" value="7" />
153 <param name="rowfontsize" type="float" label="tweak row label size" value="0.8" /> 154 <param name="rowfontsize" type="float" label="tweak row label size" value="0.8" />
154 <param name="lineheight" type="integer" label="tweak line height" value="4" /> 155 <param name="lineheight" type="integer" label="tweak line height" value="4" />
155 </inputs> 156 </inputs>
156 <outputs> 157 <outputs>
157 <data name="output1" format="pdf"/> 158 <data name="output1" format="pdf"/>
158 </outputs> 159 </outputs>
159 <tests> 160 <tests>
160 <test> 161 <test>
161 <param name="input1" value="mtcars.txt"/> 162 <param name="input1" value="mtcars.txt"/>
163 <param name="title" value="This is a pretty long title"/>
162 <param name="cluster" value="true"/> 164 <param name="cluster" value="true"/>
163 <output name="output1" file="result1.pdf"/> 165 <output name="output1" file="result1.pdf"/>
164 </test> 166 </test>
165 <test> 167 <test>
166 <param name="input1" value="mtcars.txt"/> 168 <param name="input1" value="mtcars.txt"/>
169 <param name="title" value="This is a pretty long title"/>
167 <param name="cluster" value=""/> 170 <param name="cluster" value=""/>
168 <output name="output1" file="result2.pdf"/> 171 <output name="output1" file="result2.pdf"/>
169 </test> 172 </test>
170 <test> 173 <test>
171 <param name="input1" value="complex_table.tsv"/> 174 <param name="input1" value="complex_table.tsv"/>
175 <param name="title" value="This is a pretty long title for a complex plot"/>
176 <param name="title_size" value="0.7"/>
172 <param name="transform" value="log2plus1"/> 177 <param name="transform" value="log2plus1"/>
173 <param name="cluster" value=""/> 178 <param name="cluster" value=""/>
174 <param name="colorscheme" value="blwhre"/> 179 <param name="colorscheme" value="blwhre"/>
175 <param name="height" value="21"/> 180 <param name="height" value="21"/>
176 <param name="rowfontsize" value="0.4"/> 181 <param name="rowfontsize" value="0.4"/>