Scaling data using Pheatmap
1
0
Entering edit mode
4.6 years ago
statfa ▴ 580

Hi,

I'm going to draw a heatmap for DE analysis. According to my research, these are the steps:

1- I sorted genes by their FDR and chose 30 of the most significant genes.

2- I'm using the normalized read counts of the chosen genes to draw heatmaps.

3- When I'm going to scale my normalized read counts using package "Pheatmap", I choose "scale by row". (Rows are genes)

Now my problem is this package scales the data to mean 0 and standard deviation 3. While I'm gonna scale them to mean 0 and SD 1.

Would you please help me know what I can do? can "pheatmap" scale my data the way I want?

scale pheatmap • 11k views
0
Entering edit mode
4.6 years ago

Why do you think pheatmap scales the data to mean 0 and standard deviation 3?

0
Entering edit mode

My colors change from -3 to 3 And 0 is in the middle of them. And I used pheatmap on two data sets and both were scaled the same.

4
Entering edit mode

Here is the functions in the code :

scale_rows = function(x){
m = apply(x, 1, mean, na.rm = T)
s = apply(x, 1, sd, na.rm = T)
return((x - m) / s)
}


As you can see, scale in this package means removing the mean (centering) and dividing by the standard deviation (scaling). This is actually Z-score value. For Z-score values, 3 means 3 SDs away from the center (0). Hope this can help you.

0
Entering edit mode

Yeah,thank you. I had read it but I thought that maybe after scaling, my data should follow standard normal distribution. But if you say my scaling is fine, then that's ok.