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

Benjamin Otto b.otto at uke.uni-hamburg.de
Wed Jul 9 16:18:17 CEST 2008


Hi Jenny, hi Martin,

Yes, Jenny definitely is right, I forgot about the "breaks" option because I never used it for shifting the mean. Maybe one should add two points here:

1. Jennys solution, as far as I can see with a quick glimpse on the code, will give you an asymmetric binning size on each side of the zero value, as long as you set the length.out argument is 50 for each color. So if you do want to use maybe an equal bin size (e.g. each step about 0.5 signal) then you'll have to adjust the number of color bins according to the ratio of the min and max.

2. The reason I didn't have that argument in mind that moment was a nice and mighty feature of that "breaks" argument I used to associate it with. That is the possibility of the asymmetric bin sizes from another point of view. Suppose you have some very few outliers with very extreme values masking your real data distribution then they will tend to spread the color scale on the edges and condense it in the middle. You won't see the real differences in your normal value range because they will probably have very similar colors. In this case you can replace parts of Jennys pairs.breaks sequence with bins derived from your data quantiles. 

Regards,

Benjamin



-----Ursprüngliche Nachricht-----
Von: Jenny Drnevich [mailto:drnevich at illinois.edu] 
Gesendet: Wednesday, July 09, 2008 3:49 PM
An: Benjamin Otto; 'Martin Bonke'; bioconductor at stat.math.ethz.ch
Betreff: Re: [BioC] How to adjust the Heatmap.2 color key

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 




-- 
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


More information about the Bioconductor mailing list