[BioC] How to adjust the Heatmap.2 color key

Jenny Drnevich drnevich at illinois.edu
Wed Jul 9 15:48:56 CEST 2008


Hi Martin,

One of the many(!) arguments to heatmap.2 is 
breaks; see ?heatmap.2 for the explanation. I 
also tried what Benjamin suggested, but breaks 
seems to make a smoother color scale. Here's how I use it:

 > max(heatdata)
[1] 9.167324

 > min(heatdata)
[1] -6.469931

 > pairs.breaks <- c(seq(-7, 0, length.out=50),seq(0, 9.2, length.out=50))

 > mycol <- colorpanel(n=99,low="green",mid="black",high="red")

 > heatmap.2(heatdata, breaks=pairs.breaks, col=mycol)

Cheers,
Jenny

At 06:33 AM 7/9/2008, Benjamin Otto wrote:
>Hi Martin, I would define my own color sequence. 
>For example if your maximum logratio in your 
>table is 5 and the minimum is -8 then you will 
>have to decide how much color steps you like. 
>Let me assume you use RColorBrewer for choosing 
>a color palette. You can check the range of your 
>data with range(#whatyoutableiscalled#). Then 
>you could do: > mycol <- 
>c(brewer.pal(8,"Greens"),"black",brewer.pal(5,"Reds")[5:1])  
> > heatmap.2(mytable, col=mycol) Regards, 
>Benjamin -----Ursprüngliche Nachricht----- Von: 
>bioconductor-bounces at stat.math.ethz.ch 
>[mailto:bioconductor-bounces at stat.math.ethz.ch] 
>Im Auftrag von Martin Bonke Gesendet: Wednesday, 
>July 09, 2008 12:21 PM An: 
>bioconductor at stat.math.ethz.ch Betreff: [BioC] 
>How to adjust the Heatmap.2 color key Dear all, 
>I'm a postdoc at the University of Helsinki and 
>currently I'm in the middle of the analyses of a 
>huge data set of microarray data. A couple of 
>months ago I made the jump from Genespring to 
>using R and although the learning curve has been 
>somewhat steep, I'm quite happy that I have done 
>so. Right now I'm making heatmaps with the gene 
>lists that I've generated using heatmap.2. In 
>general I'm quite happy with the results, but in 
>several of them I'm having some trouble with the 
>color coding of the heatmap. My data has been 
>normalized towards control experiments, to get a 
>factor of up or down regulation (experiment 
>values are divided by control values) and in 
>general I see that genes are somewhat stronger 
>down regulated compared to upregulated. To give 
>an example, the strongest downregulated gene 
>could be at -8 fold, while the strongest 
>upregulated could be at +5 fold. So the 
>distributon is then from -8 to +5, which puts 
>the middle at -1.5 in the color key that 
>heatmap.2 automatically assigns. As a result, 
>those genes that are not really affected by my 
>experiments (and thus have 0 fold difference 
>towards the control experiment) fall in a 
>slightly green zone in the color key that 
>heatmap.2 assigns. This makes visual 
>identification of interesting gene clusters a 
>lot more difficult. So my question to you all is 
>whether there is a way to tell heatmap.2 which 
>colors should be assigned to a certain level of 
>expression? I've thought about checking each 
>matrix for the strongest up and down regulated 
>values and then forcing the data to max out on 
>whichever of the two is lowest, but that will be 
>a lot of work, and it'll mean that I have to 
>duplicate all data in order to conserve the 
>original values as well. So if there is a better 
>way, I'll gladly hear it. My thanks in advance. 
>Best, Martin Bonke         [[alternative HTML 
>version deleted]] 
>_______________________________________________ 
>Bioconductor mailing list 
>Bioconductor at stat.math.ethz.ch 
>https://stat.ethz.ch/mailman/listinfo/bioconductor 
>Search the archives: 
>http://news.gmane.org/gmane.science.biology.informatics.conductor 
>-- Pflichtangaben gemäß Gesetz über 
>elektronische Handelsregister und 
>Genossenschaftsregister sowie das 
>Unternehmensregister (EHUG): 
>Universitätsklinikum Hamburg-Eppendorf 
>Körperschaft des öffentlichen Rechts 
>Gerichtsstand: Hamburg Vorstandsmitglieder: 
>Prof. Dr. Jörg F. Debatin (Vorsitzender) Dr. 
>Alexander Kirstein Ricarda Klein Prof. Dr. Dr. 
>Uwe Koch-Gromus 
>_______________________________________________ 
>Bioconductor mailing list 
>Bioconductor at stat.math.ethz.ch 
>https://stat.ethz.ch/mailman/listinfo/bioconductor 
>Search the archives: 
>http://news.gmane.org/gmane.science.biology.informatics.conductor

Jenny Drnevich, Ph.D.

Functional Genomics Bioinformatics Specialist
W.M. Keck Center for Comparative and Functional Genomics
Roy J. Carver Biotechnology Center
University of Illinois, Urbana-Champaign

330 ERML
1201 W. Gregory Dr.
Urbana, IL 61801
USA

ph: 217-244-7355
fax: 217-265-5066
e-mail: drnevich at illinois.edu 



More information about the Bioconductor mailing list