[R-gregmisc-users] SF.net SVN: r-gregmisc:[1819] trunk/gplots/R/heatmap.2.R
Brought to you by:
warnes
From: <wa...@us...> - 2014-06-17 23:19:50
|
Revision: 1819 http://sourceforge.net/p/r-gregmisc/code/1819 Author: warnes Date: 2014-06-17 23:19:46 +0000 (Tue, 17 Jun 2014) Log Message: ----------- Allow user to specify function used to reorder based on the dendogram via a new 'reorderfun' argument. Suggested by Yuanhua Liu. Modified Paths: -------------- trunk/gplots/R/heatmap.2.R Modified: trunk/gplots/R/heatmap.2.R =================================================================== --- trunk/gplots/R/heatmap.2.R 2014-06-17 20:34:17 UTC (rev 1818) +++ trunk/gplots/R/heatmap.2.R 2014-06-17 23:19:46 UTC (rev 1819) @@ -8,6 +8,7 @@ distfun = dist, hclustfun = hclust, dendrogram = c("both","row","column","none"), + reorderfun = function(d, w) reorder(d, w), symm = FALSE, ## data scaling @@ -109,13 +110,6 @@ "specified can produce unpredictable results.", "Please consider using only one or the other.") - ## key & density don't make sense when data is not all on the same scale - ## if(scale!="none" && key==TRUE) - ## { - ## warning("Key cannot be plotted when scale!=\"none\".") - ## key=FALSE - ## } - if ( is.null(Rowv) || is.na(Rowv) ) Rowv <- FALSE if ( is.null(Colv) || is.na(Colv) ) @@ -190,7 +184,7 @@ { ## Compute dendrogram and do reordering based on given vector hcr <- hclustfun(distfun(x)) ddr <- as.dendrogram(hcr) - ddr <- reorder(ddr, Rowv) + ddr <- reorderfun(ddr, Rowv) rowInd <- order.dendrogram(ddr) if(nr != length(rowInd)) @@ -201,7 +195,7 @@ Rowv <- rowMeans(x, na.rm = na.rm) hcr <- hclustfun(distfun(x)) ddr <- as.dendrogram(hcr) - ddr <- reorder(ddr, Rowv) + ddr <- reorderfun(ddr, Rowv) rowInd <- order.dendrogram(ddr) if(nr != length(rowInd)) @@ -232,7 +226,7 @@ {## Compute dendrogram and do reordering based on given vector hcc <- hclustfun(distfun(if(symm)x else t(x))) ddc <- as.dendrogram(hcc) - ddc <- reorder(ddc, Colv) + ddc <- reorderfun(ddc, Colv) colInd <- order.dendrogram(ddc) if(nc != length(colInd)) @@ -243,7 +237,7 @@ Colv <- colMeans(x, na.rm = na.rm) hcc <- hclustfun(distfun(if(symm)x else t(x))) ddc <- as.dendrogram(hcc) - ddc <- reorder(ddc, Colv) + ddc <- reorderfun(ddc, Colv) colInd <- order.dendrogram(ddc) if(nc != length(colInd)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |