[BioC] heatmap() column ordering

Steffen Moeller steffen.moeller at med.uni-rostock.de
Tue Nov 4 12:30:32 MET 2003


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 at 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 at med.uni-rostock.de
   +49 381 4059 684 
   Fax:        -686



More information about the Bioconductor mailing list