Hello everyone,
I am using edgeR and ComplexHeatmap trying to plot a Heatmap with a few ATAC-seq datasets. But I came across an issue that I can't solve. So I will really appreciate if you can give me some suggestions.
When I used log transformed CPM value to plot the Heatmap, the clustering is not very clear. The Heatmap is either all in blue or all in red.
When I used "mat_scaled = t(scale(t(data)))" to scale my data before plotting, some information can't be shown in the Heatmap. Like I expected there should be values that are the same in all the samples, which should be shown in the same color across the samples. But unfortunately, after scaling, the similar values scaled to larger differences, which show different color in the Heatmap.
sample1 sample2. sample3
chr4_185974589_185974741 1.483681 1.472528 1.4296474
after scaling
sample1 sample2. sample3
chr4_185974589_185974741 0.761687321 0.37073755 -1.132424873
Thanks.
It might be easier for us to assist you if you posted the example images and the corresponding code. For example, it is not clear if you want to scale columns or rows or both.
Here is the code for scaled heatmap
![enter image description here][1]
And unscaled
![enter image description here][2]
Thanks.
And what exactly is the detail you don't like about the z-score? Which values do you think should be "the same"?
From what I can tell, your code does what you instructed it to do -- you're z-score-transforming the rows of your matrix, i.e. instead of displaying the actual values of
data
, you're coloring the heatmap based on the distance of each entry to its row's mean.Btw, I would strongly recommend to not create an object named "type" because that's also the name of a base R function.
I got some values changed after scaling like this.
after scaling
Peaks like this not are not changed across the samples but after scaling, it showed differences.
I expected there should be some common regions (similar or same values) across my samples showing as the same color in a cluster.
Check out the formula below. The z-score is going to drastically reduce the influence of the dynamic range differences between individual rows, therefore small differences in a row with overall small values may get similar z-scores as differences that seem larger to you just because the numbers that are compared to each other live on a different scale. But relatively speaking, the differences from the mean may not be as dramatic (or similarly dramatic in the low-value-ranges).
Hello sophialovechan,
You have added multiple images improperly, hence they show up as links and not as embedded images. Please see How to add images to a Biostars post to add your images properly. You need the direct link to the image, not the link to the webpage that has the image embedded (which is what you have used here).
I will make the necessary changes for now.