diff heatmap2.R @ 34:4d73dafc7bf4 draft

Uploaded
author moheydarian
date Thu, 27 Apr 2017 15:58:19 -0400
parents 817f255101c6
children c1f0f262836a
line wrap: on
line diff
--- a/heatmap2.R	Thu Apr 27 15:50:00 2017 -0400
+++ b/heatmap2.R	Thu Apr 27 15:58:19 2017 -0400
@@ -46,7 +46,8 @@
 
 hclust_fun = function(x) hclust(x, method="complete")
 dist_fun = function(x) dist(x, method="maximum")
-
+distfun=dist_fun
+hclustfun=hclust_fun
 if(options$transform == "none"){
     linput <- mat_input
 }else if(options$transform == "log2"){
@@ -70,15 +71,7 @@
 }
 
 
-if(options$cluster== "Default"){
-  dclust = distfun=dist_fun
-  hclust = hclustfun=hclust_fun
-  dend = "both"
-}else{
-  dclust = NULL
-  hclust = NULL
-  dend = "none"
-}
+
 
 if(options$labels== "both"){
   rlabs = NULL
@@ -100,8 +93,21 @@
 
 pdf(file="Rplot.pdf")
 colorscale
+
+if(options$cluster== "Default"){
+
 heatmap.2(linput,
-          dclust, hclust, dendrogram=dend, scale = options$scale, labRow = rlabs, labCol = clabs,
+          distfun=dist_fun, hclustfun=hclust_fun, scale = options$scale, labRow = rlabs, labCol = clabs,
           col=colfunc(50), trace="none", density.info = "none", margins=c(8,2),
           main = options$title, key.xlab= options$key, keysize=1)
+}else{
+heatmap.2(linput,
+          dendrogram="none", scale = options$scale, labRow = rlabs, labCol = clabs,
+          col=colfunc(50), trace="none", density.info = "none", margins=c(8,2),
+          main = options$title, key.xlab= options$key, keysize=1)
+}
+
+
+
+
 dev.off()