Dear all,
i am using pheatmap
to generate some heatmaps using the function scale=row
but i cannot replicate (at least visually, because i didn't manage to export the scaled matrix) the results if i manually scale the matrix with t(scale (t(my.mat)))
(the scale function scales by column). Normally that would be used as scale(x, center = TRUE, scale = TRUE)
. I've seen that because when replotting with the scale=none
the the manually scaled matrix the heatmaps look different.
If somebody has any idea about why this happens, it would be really appreciated.
p.s. i've checked the exact function they used:
scale_rows = function(x){
m = apply(x, 1, mean, na.rm = T)
s = apply(x, 1, sd, na.rm = T)
return((x - m) / s)
}
the clustering in fact is exactly the same but it looks like a difference in the colour bar.
It should be the opposite. The scaling is the same, but the clustering is different due to the order or operations. See this previous thread: Clustering differences between heatmap.2 and pheatmap
Hey igor, it's the same clustering in my case because i am comparing
manually scaled > pheatmap function with
scale=none
VS pheatmap scaled withscale=rows