heatmap() column ordering
2
0
Entering edit mode
Dave Waddell ▴ 160
@dave-waddell-323
Last seen 10.2 years ago
I have four experiments (two dye swaps) and this is the original order: > colnames(mav) [1] Cy3="Cancer" Cy5="Normal" Cy3="Cancer" Cy5="Normal" Cy3="Normal" Cy5="Cancer"Cy3=" Normal" Cy5="Cancer" I want to get a heatmap of the top 30 expressed genes but ordered by cancerous vs. normal tissue. > hv <- heatmap(mav[genes %in% topgenes$Name,],col=RGcol) > title("Heatmap of Top 30 genes") > str(hv) List of 2 $ rowInd: int [1:30] 5 8 30 13 7 27 19 21 25 26 ... $ colInd: int [1:8] 4 3 8 7 1 5 2 6 No matter what I do, the columns are reordered. Furthermore, if I set Colv=F the heatmap stays the same but the ordering changes. > hv <- heatmap(mav[genes %in% topgenes$Name,],col=RGcol,Colv=F) > title("Heatmap of Top 30 genes") > str(hv) List of 2 $ rowInd: int [1:30] 5 8 30 13 7 27 19 21 25 26 ... $ colInd: int [1:8] 3 4 7 8 2 6 1 5 Am I missing something or is this a bug/feature? BTW, is there any way to post images to this group? It seems this would be desirable. Dave Waddell
• 2.7k views
ADD COMMENT
0
Entering edit mode
@vincent-j-carey-jr-4
Last seen 10 weeks ago
United States
> I have four experiments (two dye swaps) and this is the original order: > > colnames(mav) > [1] Cy3="Cancer" Cy5="Normal" Cy3="Cancer" Cy5="Normal" Cy3="Normal" > Cy5="Cancer"Cy3=" Normal" Cy5="Cancer" > > I want to get a heatmap of the top 30 expressed genes but ordered by > cancerous vs. normal tissue. > > hv <- heatmap(mav[genes %in% topgenes$Name,],col=RGcol) > > title("Heatmap of Top 30 genes") > > str(hv) > List of 2 > $ rowInd: int [1:30] 5 8 30 13 7 27 19 21 25 26 ... > $ colInd: int [1:8] 4 3 8 7 1 5 2 6 > > No matter what I do, the columns are reordered. Furthermore, if I set Colv=F > the heatmap stays the same but the ordering changes. I believe this needs to be taken up with the R developers. I have not seen how to suppress reordering short of going into the source and commenting out the reordering step. A non-invasive workaround is to create a dendrogram that corresponds to the order you desire and to use that as the argument value. In my case, I clustered 1:n, reordered the result a little bit and I was able to subvert the heatmap behavior. Sorry for the vague account -- it was an emergency operation and the materials are not ready to hand.
ADD COMMENT
0
Entering edit mode
Hello, we had the same idea Vincent had. We generate a dendrogram and use that for the columns. The variable experimentgroups has the default settings. A special feature is that we allow multiple groups of "indistinguishable" patients. The distances 0 within such a group and neighboured groups have distances of 1. cat("Please enter sizes of groups for distance calculation or (defaut: ",paste(experimentgroups,sep=" "),"):\n") groups <- scan(what=integer(0)) #vector containing number of members for each group if (length(groups)==0) { groups<-experimentgroups } dend<-rep(0,sum(groups)) last<-0 for (i in 1:length(groups)) { dend[(last+1):sum(groups[1:i])]<-rep(i,groups[i]) last<-sum(groups[1:i]) } print(dend) dend<-as.dendrogram(hclust(dist(dend))) print(dend) hv<-heatmap(dat2, Colv=dend, Henning and Steffen Vincent Carey 525-2265 wrote: >>I have four experiments (two dye swaps) and this is the original order: >> >> >>>colnames(mav) >>> >>> >>[1] Cy3="Cancer" Cy5="Normal" Cy3="Cancer" Cy5="Normal" Cy3="Normal" >>Cy5="Cancer"Cy3=" Normal" Cy5="Cancer" >> >>I want to get a heatmap of the top 30 expressed genes but ordered by >>cancerous vs. normal tissue. >> >> >>>hv <- heatmap(mav[genes %in% topgenes$Name,],col=RGcol) >>>title("Heatmap of Top 30 genes") >>>str(hv) >>> >>> >>List of 2 >> $ rowInd: int [1:30] 5 8 30 13 7 27 19 21 25 26 ... >> $ colInd: int [1:8] 4 3 8 7 1 5 2 6 >> >>No matter what I do, the columns are reordered. Furthermore, if I set Colv=F >>the heatmap stays the same but the ordering changes. >> >> > >I believe this needs to be taken up with the R developers. >I have not seen how to suppress reordering short of going >into the source and commenting out the reordering step. > >A non-invasive workaround is to create a dendrogram that corresponds >to the order you desire and to use that as the argument value. >In my case, I clustered 1:n, reordered the result a little >bit and I was able to subvert the heatmap behavior. Sorry for >the vague account -- it was an emergency operation and the >materials are not ready to hand. > >_______________________________________________ >Bioconductor mailing list >Bioconductor@stat.math.ethz.ch >https://www.stat.math.ethz.ch/mailman/listinfo/bioconductor > > > -- Steffen M?ller, PhD Universit?t Rostock Institut f?r Immunologie Proteom-Zentrum Rostock Joachim-Jungius-Str. 9 D-18059 Rostock steffen.moeller@med.uni-rostock.de +49 381 4059 684 Fax: -686
ADD REPLY
0
Entering edit mode
@johannes-husing-207
Last seen 10.2 years ago
Dave Waddell <dwaddell@nutecsciences.com> [Mon, Nov 03, 2003 at 04:54:08PM CET]: [...] > > No matter what I do, the columns are reordered. [...] > Am I missing something or is this a bug/feature? The reordering of cols is a feature of heatmap() over image(). Have you tried the latter? Greetings Johannes -- Johannes H?sing There is something fascinating about science. One gets hannes@ruhrau.de such wholesale returns of conjecture from such a trifling investment of fact. Mark Twain
ADD COMMENT

Login before adding your answer.

Traffic: 810 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6