This is a test version of Biostars. For the public version, visit https://www.biostars.org.
RNA-Seq heatmap Scaling Problem

Hello, I have a gene expression data from two conditions. Its FPKM value from cuffdiff. I picked 3fold up and down-regulated genes to draw a heatmap. I used different R packages and other online tools, but I keep getting a very uniform color. osm-heatmap-default

  1. I want to have a more color gradient, which represents my expression values.
  2. I want to list 360 genes on the row label, can I do it? The font size did not work.
  3. I believe there is a problem with scaling. When I used cluster optimization method to determine the number of clusters, Its gives me 7 as shown below, when I make the heatmap, even though I gave the parameter for clustering to be 7 I still get two clusters. Any advice on this? Cluster-Optimization
rna-seq r sequencing next-gen

Hi Kevin, I used zFPKM (myFPKM), but I got the error message FPKM values should be numeric. I used read.csv(mydata) to get my myFPKM and It has row names and column names. Is it a problem?

Do not add an answer unless you're answering the top level question. This should have been a comment on Kevin's answer.

You've not shown us a sample of your data or your current heatmap. Please add that in to give more context so we can help you better.

Sorry for the misinformation.

1 answer

I want to have a more color gradient, which represents my expression values.

Try modifying breaks - see my example, here: A: Heatmap based with FPKM values

I want to list 360 genes on the row label, can I do it? The font size did not work.

Increase the dimensions of the figure and / or reduce the label size

I believe there is a problem with scaling. When I used cluster optimization method to determine the number of clusters, Its gives me 7 as shown below, when I make the heatmap, even though I gave the parameter for clustering to be 7 I still get two clusters. Any advice on this?

See A: Heatmap based with FPKM values

Kevin

Thanks Kevin. I will try these.

Hello Kevin,

I have these codes

heatmap.2(heat,col = mycol,breaks = myBreaks,
          main = "Test",key = T, ,keysize = 1.0,
          scale = "none",
          reorderfun = function(d,w) reorder(d,w,agglo.FUN=mean),
          trace("none"), cexRow = 0.2, cexCol = 0.8,
          distfun = function(x) dist(x,method = "euclidean"),
          hclustfun = function(x) hclust(x,method = "ward.D2"))

` I received below error message.

Error in heatmap.2(heat, col = mycol, breaks = myBreaks, main = "Test",  : 
  `x' must be a numeric matrix .

My data is below

head(MyFPKM)
          con.1     con.2    test1    test2
Serpinb2  0.6152240 0.5229670 34.03570 25.85470
Serpina3n 0.3688580 0.7559590 27.22470 30.08840

How can I solve it?

Thanks,

You're showing us MyFPKM but using heat to plot the heatmap. How do you get heat from MyFPKM?

My mistake

head(heat)
        con.1     con.2       test1       test2                                                                                                                        
Serpinb2  -1.222093 -1.402463  1.54058582  1.33805871                                                                                       
Serpina3n -1.564001 -1.160136  1.41558418  1.41716247

My code is below

`require("RColorBrewer"),mycol <- colorRampPalette(c("dodgerblue","black","yellow"))(100), myBreaks <- seq(-3,3,length.out = 101), library(zFPKM) ,MyFPKM <- read.csv("Test_Hmap.csv", header = T, sep ="," ), row.names(MyFPKM) <- MyFPKM$gene ,MyFPKM <- MyFPKM[,2:5] ,heat <- zFPKM(MyFPKM),require(gplots)`

MyFPKM is already filtered. My sample heatmap will be similar to the one here A: Heatmap based with FPKM values

Also, what is mycol? What is mybreaks? Can you give us a sample heatmap you're seeing now? Give us _as much_ detail as you can - right now you're giving us as little as you can.

Hello Kevin, Thank you very much. I am explicitly told by my advisor to get a heatmap with different colors for each condition. I do not seem to know how to start with it, at the moment all I can do is to make a simple heatmap using complex heatmap or other heatmap sources. Here is the heatmap he wants. ![enter image description here][heatmap]

My questions- 1. Do I need to make two heatmaps then merge? I am using zFPKM, and there are two biological replicates for each condition. 2. I need to have one color for one condition, and another color for another condition. The color intensity then represents expression values. If I use complex heatmap how do I do that / which parameter is for this option.

Regards, Thanks,

heatmap with different colors for each condition

That cannot be done in a single heatmap unless the data lines up beautifully. In your sample heatmap, either all Kontrol samples had <-1.5 values and all LLC had >0.5, or the authros produced two plots and merged them on Illlustrator. It does look like the data lined up though, the -3 -> 3 scale would have been challenging to generate otherwise (I think)

1 Do I need to make two heatmaps then merge?

It might come to that, in which case you can use CH's horizontal aligned heatmaps and set heatmap gap to 0 (not sure if that'd work but give it a shot)

2 I need to have one color for one condition, and another color for another condition. The color intensity then represents expression values.

You definitely needs 2 heatmaps then. It's either that or you assign each cell a value that gives both expression value as well as condition, then fiddle around cell_fun to customize things per cell. That'll be tedious though.

Log in to answer this question.