Mercurial > repos > artbio > high_dim_heatmap
comparison heatmap.xml @ 1:e298f66f5d8c draft default tip
"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:01 +0000 |
| parents | 5182b74b6435 |
| children |
comparison
equal
deleted
inserted
replaced
| 0:5182b74b6435 | 1:e298f66f5d8c |
|---|---|
| 1 <tool id="high_dim_heatmap" name="Plot heatmap" version="1.0.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" | |
| 47 colfunc <- colorRampPalette(c("lightyellow", "royalblue4")) | |
| 46 #end if | 48 #end if |
| 47 | 49 |
| 48 #if $labels== "both" | 50 #if $labels== "both" |
| 49 rlabs = NULL | 51 rlabs = NULL |
| 50 clabs = NULL | 52 clabs = NULL |
| 57 #elif $labels== "none" | 59 #elif $labels== "none" |
| 58 rlabs = FALSE | 60 rlabs = FALSE |
| 59 clabs = FALSE | 61 clabs = FALSE |
| 60 #end if | 62 #end if |
| 61 | 63 |
| 62 pdf(file='$output1', paper='special', height=$height) | 64 pdf(file = '$output1', paper = 'special', height = $height) |
| 63 colorscale | 65 par(cex.main = $title_size) |
| 64 | 66 |
| 65 #if $cluster_cond.cluster: | 67 #if $cluster_cond.cluster: |
| 66 hclust_fun = function(x) hclust(x, method='$cluster_cond.clustering') | 68 hclust_fun = function(x) hclust(x, method = '$cluster_cond.clustering') |
| 67 dist_fun = function(x) dist(x, method='$cluster_cond.distance') | 69 dist_fun = function(x) dist(x, method = '$cluster_cond.distance') |
| 68 #if $cluster_cond.cluster_cols_rows=="rows": | 70 #if $cluster_cond.cluster_cols_rows == "rows": |
| 69 heatmap.2(linput, dendrogram="row", Colv=FALSE, Rowv=TRUE, | 71 heatmap.2(linput, dendrogram="row", Colv = FALSE, Rowv = TRUE, |
| 70 distfun=dist_fun, hclustfun=hclust_fun, scale = '$scale', labRow = rlabs, labCol = clabs, | 72 distfun = dist_fun, hclustfun = hclust_fun, scale = '$scale', labRow = rlabs, |
| 71 col=colfunc(50), trace="none", density.info = "none", margins=c(8,8), | 73 labCol = clabs, col = colfunc(50), trace = "none", density.info = "none", |
| 72 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, |
| 73 lhei=c(1, $lineheight)) | 75 cexCol = 0.8, cexRow = $rowfontsize, srtCol = 45, lhei = c(1, $lineheight)) |
| 74 #elif $cluster_cond.cluster_cols_rows=="columns": | 76 #elif $cluster_cond.cluster_cols_rows == "columns": |
| 75 heatmap.2(linput, dendrogram="column", Colv=TRUE, Rowv=FALSE, | 77 heatmap.2(linput, dendrogram = "column", Colv = TRUE, Rowv = FALSE, |
| 76 distfun=dist_fun, hclustfun=hclust_fun, scale = '$scale', labRow = rlabs, labCol = clabs, | 78 distfun = dist_fun, hclustfun = hclust_fun, scale = '$scale', labRow = rlabs, |
| 77 col=colfunc(50), trace="none", density.info = "none", margins=c(8,8), | 79 labCol = clabs, col = colfunc(50), trace = "none", density.info = "none", |
| 78 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, |
| 79 lhei=c(1, $lineheight)) | 81 cexCol = 0.8, cexRow = $rowfontsize, srtCol = 45, lhei = c(1, $lineheight)) |
| 80 #else | 82 #else |
| 81 heatmap.2(linput, | 83 heatmap.2(linput, |
| 82 distfun=dist_fun, hclustfun=hclust_fun, scale = '$scale', labRow = rlabs, labCol = clabs, | 84 distfun = dist_fun, hclustfun = hclust_fun, scale = '$scale', labRow = rlabs, |
| 83 col=colfunc(50), trace="none", density.info = "none", margins=c(8,8), | 85 labCol = clabs, col = colfunc(50), trace = "none", density.info = "none", |
| 84 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, |
| 85 lhei=c(1, $lineheight)) | 87 cexCol = 0.8, cexRow = $rowfontsize, srtCol = 45, lhei = c(1, $lineheight)) |
| 86 #end if | 88 #end if |
| 87 #else | 89 #else |
| 88 heatmap.2(linput, | 90 heatmap.2(linput, |
| 89 dendrogram="none", Colv=FALSE, Rowv=FALSE, scale = '$scale', labRow = rlabs, labCol = clabs, | 91 dendrogram = "none", Colv = FALSE, Rowv = FALSE, scale = '$scale', labRow = rlabs, |
| 90 col=colfunc(50), trace="none", density.info = "none", margins=c(8,8), | 92 labCol = clabs, col = colfunc(50), trace="none", density.info = "none", |
| 91 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, |
| 92 lhei=c(1, $lineheight)) | 94 cexRow = $rowfontsize, srtCol = 45, lhei = c(1, $lineheight)) |
| 93 #end if | 95 #end if |
| 94 | 96 |
| 95 dev.off() | 97 dev.off() |
| 96 ]]></configfile> | 98 ]]></configfile> |
| 97 </configfiles> | 99 </configfiles> |
| 136 <option value="none">Do not label rows or columns</option> | 138 <option value="none">Do not label rows or columns</option> |
| 137 </param> | 139 </param> |
| 138 <param name="colorscheme" type="select" label="Coloring groups" > | 140 <param name="colorscheme" type="select" label="Coloring groups" > |
| 139 <option value="whrd" selected="true">White to red</option> | 141 <option value="whrd" selected="true">White to red</option> |
| 140 <option value="whblu">White to blue</option> | 142 <option value="whblu">White to blue</option> |
| 143 <option value="yeblu">Yellow to blue</option> | |
| 141 <option value="blwhre">Blue to white to red</option> | 144 <option value="blwhre">Blue to white to red</option> |
| 142 </param> | 145 </param> |
| 143 <param name="scale" type="select" label="Data scaling" > | 146 <param name="scale" type="select" label="Data scaling" > |
| 144 <option value="none" selected="true">Do not scale my data</option> | 147 <option value="none" selected="true">Do not scale my data</option> |
| 145 <option value="row">Scale my data by row</option> | 148 <option value="row">Scale my data by row</option> |
| 146 <option value="column">Scale my data by column</option> | 149 <option value="column">Scale my data by column</option> |
| 147 </param> | 150 </param> |
| 148 | 151 |
| 152 <param name="title_size" type="float" label="tweak main title size" value="1" /> | |
| 149 <param name="height" type="float" label="tweak plot height" value="7" /> | 153 <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" /> | 154 <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" /> | 155 <param name="lineheight" type="integer" label="tweak line height" value="4" /> |
| 152 </inputs> | 156 </inputs> |
| 153 <outputs> | 157 <outputs> |
| 154 <data name="output1" format="pdf"/> | 158 <data name="output1" format="pdf"/> |
| 155 </outputs> | 159 </outputs> |
| 156 <tests> | 160 <tests> |
| 157 <test> | 161 <test> |
| 158 <param name="input1" value="mtcars.txt"/> | 162 <param name="input1" value="mtcars.txt"/> |
| 163 <param name="title" value="This is a pretty long title"/> | |
| 159 <param name="cluster" value="true"/> | 164 <param name="cluster" value="true"/> |
| 160 <output name="output1" file="result1.pdf"/> | 165 <output name="output1" file="result1.pdf"/> |
| 161 </test> | 166 </test> |
| 162 <test> | 167 <test> |
| 163 <param name="input1" value="mtcars.txt"/> | 168 <param name="input1" value="mtcars.txt"/> |
| 169 <param name="title" value="This is a pretty long title"/> | |
| 164 <param name="cluster" value=""/> | 170 <param name="cluster" value=""/> |
| 165 <output name="output1" file="result2.pdf"/> | 171 <output name="output1" file="result2.pdf"/> |
| 166 </test> | 172 </test> |
| 167 <test> | 173 <test> |
| 168 <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"/> | |
| 169 <param name="transform" value="log2plus1"/> | 177 <param name="transform" value="log2plus1"/> |
| 170 <param name="cluster" value=""/> | 178 <param name="cluster" value=""/> |
| 171 <param name="colorscheme" value="blwhre"/> | 179 <param name="colorscheme" value="blwhre"/> |
| 172 <param name="height" value="21"/> | 180 <param name="height" value="21"/> |
| 173 <param name="rowfontsize" value="0.4"/> | 181 <param name="rowfontsize" value="0.4"/> |
