diff tools/script.R @ 3:db5d126bf8d0 draft

planemo upload
author marpiech
date Thu, 22 Dec 2016 18:19:53 -0500
parents c5a812cdf478
children
line wrap: on
line diff
--- 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()