From krc at odin.mdacc.tmc.edu  Mon Jun 27 21:55:37 2005
From: krc at odin.mdacc.tmc.edu (krc@odin.mdacc.tmc.edu)
Date: Mon, 27 Jun 2005 21:55:37 +0200 (CEST)
Subject: [Rd] row-side color bars do not reverse properly in heatmap
	(PR#7972)
Message-ID: <20050627195537.4E1AFA290@slim.kubism.ku.dk>

Full_Name: Kevin R. Coombes
Version: 2.1.0
OS: Windows XP
Submission from: (NULL) (143.111.224.169)


When revC = TRUE and RowSideColors is set to a list of colors in heatmap, then
the image and dendrogram are inverted, but the row-side color map does not
change. The following script illustrates the problem.

##############
set.seed(1023)
# generate columns of two different types
d1 <- matrix(rnorm(100*6, rnorm(100, 0.5)), nrow=100, ncol=6, byrow=FALSE)
d2 <- matrix(rnorm(100*4, rnorm(100, 0.5)), nrow=100, ncol=4, byrow=FALSE)
# join them together
dd <- cbind(d1, d2)
# label them with different colors
cols <- rep(c('blue', 'green'), times=c(6,4))

# change the order of the columns and the matching labels
# to show that reordering occurs in one case in heatmap
col.order <- sample(10)
dd <- dd[, col.order]
cols <- cols[col.order]

# compute the dendrogram to be used in the display
hc <- hclust(dist(dd, 'euclid'))

# get the correlation matrix
m <- cor(dd)

# this version works correctly
heatmap(m, Rowv=as.dendrogram(hc), symm=TRUE, revC=FALSE,
        RowSideColors=cols)
#this version reverses the dendrogram and image, but not the colors
heatmap(m, Rowv=as.dendrogram(hc), symm=TRUE, revC=TRUE,
        RowSideColors=cols)



[Rd] row-side color bars do not reverse properly in heatmap (PR#7972)
krc@odin.mdacc.tmc.edu