Hi, 

I am trying to make a Heatmap of some analyzed RNAseq data. I am using ggplot2 with R. The problem I have is that I cannot see well the upregulated and the downregulated genes. I can't get the colors shown to be dark enough. I am doing the heatmap with all the genes of the study organism, around 13,000. I'm also not sure that ggplot2 clusters the genes in my data. Is there a way to cluster the genes and see darker colors in the genes upregulated and the downregulated? The code I am using would be the following:

    library(ggplot2) 
    library(reshape2)
    
    g<-read.csv("datos_prueba3.csv") g3<-melt(g)
    
    plot1 <- ggplot(g3, aes(variable, Gene, fill=value)) + geom_tile() + scale_fill_gradient2(low="dark green", high="dark red", mid="green", midpoint=0) + theme(axis.text.y=element_blank()) 
    plot1
![enter image description here][1]

Best,


  [1]: /media/images/f8a7c4c3-4b01-4416-a89d-52e82151
Doing a heatmap of 13k genes is not going to be informative, it is just too many data. Try the following points:

a) reduce the number of genes to the most meaningful ones, e.g. the differential ones. All others are not different between days and as such do not add any information

b) standardize your data. Expression data have large spans, both if you plot log-scale expression data or fold changes. In this case the extreme values will dominate the color scale (here it is the -20 on the color gradient). Basically the extreme gradient makes it impossible to see differences, e.g. etween -5 and -10. Scaling means Z-scoring. If you have a numeric matrix of log-expression values called `x` then do `t(scale(t(c)))` to get Z-scored data which indicate for every gene the deviation from its mean of all samples. 

c) Cluster your heatmap with `hclust` to group similar expression patterns and visualize them. The `ComplexHeatmap` package can do this internally. Alternatively, if you prefer ggplot style use https://github.com/XiaoLuo-boy/ggheatmap which also has parameters to use hclust.

Does that make sense to you?