changeset 3:db5d126bf8d0 draft

planemo upload
author marpiech
date Thu, 22 Dec 2016 18:19:53 -0500
parents 27e62af48a5a
children 2fee8da6aabb
files plotheatmap.xml tools/script.R
diffstat 2 files changed, 72 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/plotheatmap.xml	Sun Dec 11 19:15:22 2016 -0500
+++ b/plotheatmap.xml	Thu Dec 22 18:19:53 2016 -0500
@@ -5,17 +5,51 @@
     </stdio>
     <command>
         <![CDATA[ 
-            $__tool_directory__/tools/script.R $count_matrix $stats_matrix $log_fc $log_cpm $pvalue $fdr > $rscript_log 2> $rerror_log
+            $__tool_directory__/tools/script.R $main.count_matrix $main.stats_matrix $main.log_fc $main.log_cpm $main.pvalue $main.fdr $heatmap.cluster_row $heatmap.cluster_col $heatmap.hclust_method $plotparm.col_marg $plotparm.row_marg $plotparm.pdf_width $plotparm.pdf_height > $rscript_log 2> $rerror_log
 
         ]]>
     </command>
     <inputs>
-        <param name="count_matrix" type="data" format="data" label=""/>
-        <param name="stats_matrix" type="data" format="data" label=""/>
-        <param name="log_fc" type="float" value="0.5" label=""/>
-        <param name="log_cpm" type="float" value="0.5" label=""/>
-        <param name="pvalue" type="float" value="0.5" label=""/>
-        <param name="fdr" type="float" value="0.5" label=""/>
+        <section name="main" title="Main parameters" expanded="True">
+            <param name="count_matrix" type="data" format="data" label=""/>
+            <param name="stats_matrix" type="data" format="data" label=""/>
+            <param name="log_fc" type="float" value="0.5" label=""/>
+            <param name="log_cpm" type="float" value="0.5" label=""/>
+            <param name="pvalue" type="float" value="0.5" label=""/>
+            <param name="fdr" type="float" value="0.5" label=""/>
+        </section>
+
+        <section name="heatmap" title="Heatmap parameters">
+            <param name="cluster_row" type="select" label="Determines if the row dendrogram should be reordered">
+                <option value="No" >No </option>
+                <option value="Yes" selected="true" >Yes </option>
+            </param>
+            <param name="cluster_col" type="select" label="Determines if the column dendrogram should be reordered">
+                <option value="No" selected="true">No </option>
+                <option value="Yes" >Yes </option>
+            </param>
+
+            <param name="hclust_method" type="select" label="Hierarchical clustering method">
+                <option value="ward.D" >ward.D </option>
+                <option value="ward.D2" >ward.D2 </option>
+                <option value="single" >single </option>
+                <option value="complete" >complete </option>
+                <option value="average" selected="true">average </option>
+                <option value="mcquitty" >mcquitty </option>
+                <option value="median" >median </option>
+                <option value="centroid" >centroid </option>
+            </param>
+        </section>
+
+
+       <section name="plotparm" title="Plot parameters">
+            <param name="col_marg" type="float" value="7" label="Margins or column names"/>
+            <param name="row_marg" type="float" value="8" label="Margins or row names"/>
+            <param name="pdf_width" type="float" value="7" label="Width of the graphics region in inches" />
+            <param name="pdf_height" type="float" value="7" label="Height of the graphics region in inches" />
+        </section>
+
+
 
     </inputs>
     <outputs>
@@ -43,6 +77,7 @@
     </tests>
     <help>
         <![CDATA[ 
+
      ]]>
     </help>
     <citations>
--- a/tools/script.R	Sun Dec 11 19:15:22 2016 -0500
+++ b/tools/script.R	Thu Dec 22 18:19:53 2016 -0500
@@ -8,6 +8,29 @@
 pValue = args[5]
 fdr = args[6]
 
+clusterRow = args[7]
+clusterCol = args[8]
+hclustMethod = args[9]
+
+mgColumnNm = as.numeric(args[10])
+mgRowNm = as.numeric(args[11])
+
+pdfWidth = as.numeric(args[12])
+pdfHeight = as.numeric(args[13])
+
+
+if(clusterRow == "Yes"){
+  clusterRow = TRUE
+} else {
+  clusterRow = NA
+}
+
+if(clusterCol == "Yes"){
+  clusterCol = TRUE
+} else {
+  clusterCol = NA
+}
+
 require(preprocessCore)
 require(gplots)
 
@@ -49,19 +72,19 @@
 rownames(countDataNormLog) = rownames(countData)
 
 #svg("heatmap.svg", width = 3+length(names), height = 1/2*length(wh))
-pdf("heatmap.pdf")
+pdf("heatmap.pdf", width = pdfWidth, height = pdfHeight)
 
 heatmap.2(
   countDataNormLog[wh, ],
   density.info=c("none"),
-  hclustfun = function(x) hclust(x, method = "average"),
+  hclustfun = function(x) hclust(x, method = hclustMethod),
   distfun = function(x) as.dist(1-cor(t(x))),  
   col = bluered(50), 
-  scale = 'row', 
-  trace = "none", #lwid = c(1, length(names)),  lhei = c(1,1/3*length(wh)),
-#  Rowv=NA, 
-  Colv = NA,
-  margins = c(7, 8)
+  scale = "row", 
+  trace = "none", 
+  Rowv = clusterRow, 
+  Colv = clusterCol,
+  margins = c(mgColumnNm, mgRowNm)
 )
 
 dev.off()