[BioC] gplots Heatmap
Steve Lianoglou
mailinglist.honeypot at gmail.com
Tue Feb 14 16:38:05 CET 2012
Hi,
First, please do not reply to the entirety of a "digest" email. Your
email had ~ 5 sentences worth of a real, and about 10 pages worth of
junk attached to it.
Now:
On Fri, Feb 10, 2012 at 6:19 PM, Polikepahad, Sumanth <polikepa at bcm.edu> wrote:
> Hi,
>
> I have analyzed my deep sequencing data with DESeq and successfully generated a heatmap showing differentially expressed miRNAs by using gplots heatmap.2. However, I want to put different colors to the fonts of miRNA names that are shown on y-axis, depending on whether they are up or down regulated. For example, I want to show the names of all down-regulated miRNAs in blue and up-regulated in Red. How do I do this? I guess I must use if else statement, but not sure if its the right way to do it. I am very new to R and I really appreciate any help.
It unfortunately looks like there is no easy way to change the colors
of the labels using the heatmap.2 function.
This is untested, but one thing you can do is copy the entirety of the
function into your own, say "myheatmap.2" function, and add labRowCol
and labColCol arguments which would be vectors of colors for each
element in your row and columns.
Then you'd have to find the line of code that looks like so:
## add labels
axis(1, 1:nc, labels= labCol, las= 2, line= -0.5, tick= 0, cex.axis= cexCol)
if(!is.null(xlab)) mtext(xlab, side = 1, line = margins[1] - 1.25)
axis(4, iy, labels= labRow, las= 2, line= -0.5, tick= 0, cex.axis= cexRow)
if(!is.null(ylab)) mtext(ylab, side = 4, line = margins[2] - 1.25)
And change them to something like:
axis(1, 1:nc, labels= labCol, las= 2, line= -0.5, tick= 0, cex.axis=
cexCol, col=labColCol[colInd])
if(!is.null(xlab)) mtext(xlab, side = 1, line = margins[1] - 1.25)
axis(4, iy, labels= labRow, las= 2, line= -0.5, tick= 0, cex.axis=
cexRow, col=labRowCol[rowInd])
if(!is.null(ylab)) mtext(ylab, side = 4, line = margins[2] - 1.25)
Or something close to that.
HTH,
-steve
--
Steve Lianoglou
Graduate Student: Computational Systems Biology
| Memorial Sloan-Kettering Cancer Center
| Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact
More information about the Bioconductor
mailing list