# HG changeset patch # User moheydarian # Date 1493312461 14400 # Node ID e75734b84e612f7b19b681d7d0bdb27b6f5f92b2 # Parent c1cb330e162e83da79a73a9121f221dcb0a90c86 Uploaded diff -r c1cb330e162e -r e75734b84e61 heatmap2.R --- a/heatmap2.R Thu Apr 27 13:00:52 2017 -0400 +++ b/heatmap2.R Thu Apr 27 13:01:01 2017 -0400 @@ -22,6 +22,8 @@ 'transform', 'c', 2, 'character', 'key', 'k', 2, 'character', 'colorscheme', 'z', 2, 'character', + 'cluster', 'b', 2, 'character', + 'labels', 'a', 2, 'character', 'output', 'o', 2, 'character' ), byrow=TRUE, ncol=4); @@ -53,20 +55,42 @@ }else{ } -if(options$colorscheme == "Default"){ +if(options$colorscheme == "whrd"){ colorscale = colfunc <- colorRampPalette(c("white", "red")) -} else { +} else if(options$colorscheme == "whblu"){ + colorscale = colfunc <- colorRampPalette(c("white", "blue")) +}else if(options$colorscheme == "blwhre"){ colorscale = colfunc <- colorRampPalette(c("blue","white", "red")) +}else{ } -hclust_fun = function(x) hclust(x, method="complete") -dist_fun = function(x) dist(x, method="maximum") +if(options$cluster== "Default"){ + hclust_fun = function(x) hclust(x, method="complete") + dist_fun = function(x) dist(x, method="maximum") + clust = distfun=dist_fun, hclustfun=hclust_fun +}else{ + clust = NULL +} + +if(options$labels== "both"){ + labs = NULL +}else if(options$labels== "rows"){ + labs = labCol=FALSE +}else if(options$labels== "columns"){ + labs = labRow=FALSE +}else if(options$labels== "none"){ + labs = labRow=FALSE, labCol=FALSE +} else{ +} + + + pdf(file="Rplot.pdf") colorscale heatmap.2(linput, - distfun=dist_fun, hclustfun=hclust_fun, scale = "none", - col=colfunc(50), trace="none", density.info = "none",labRow=FALSE, margins=c(8,2), + clust, scale = options$scale, + col=colfunc(50), trace="none", density.info = "none", labs, margins=c(8,2), main = options$title, key.xlab= options$key, keysize=1) dev.off()