0
$\begingroup$

Suppose I want to cluster genes from the Golub dataset according to their expression profile. Note that I want to specifically cluster genes, and not patients.

It's advisable to do scaling before clustering if distance metric is the euclidian distance. In this case I'd do something like:

data(golub, package = "multtest")
golub_df <- data.frame(golub)
colnames(golub_df) <- factor(golub.cl, levels = c(0, 1), labels = c("ALL","AML"))

golub_scaled <- scale(golub_df)
colMeans(golub_scaled)

The last command outputs values near 0 for each column, which are patients. Is this correct, or should the mean for each gene across the patients be 0(i.e. rowMeans(golub_rescaled) give zeros)?

Thanks in advance!

$\endgroup$

1 Answer 1

1
$\begingroup$

Scaling is done on the column. It subtracts the mean and divides by the standard deviation , so you should get colMeans(golub) to be around zero.

However you don't need to scale, if you check the vignette:

library(multtest)
?golub
Gene expression data (3051 genes and 38 tumor mRNA samples) from
 the leukemia microarray study of Golub et al. (1999).
 Pre-processing was done as described in Dudoit et al. (2002). The
 R code for pre-processing is available in the file <URL:
 ../doc/golub.R>.

So looking at golub.R, lines 39-41, there is a scaling done:

# Normalization 
golub.expr<-scale(golub,T,T)
dimnames(golub.expr)<-list(NULL,NULL)

the two T indicate TRUE for centering and scaling. So you don't need to scale your data, it's already done. We read in the data:

data(golub)
colMeans(golub)
 [1] -1.245493e-07  2.851524e-07 -3.474271e-07 -1.409374e-07 -4.654212e-07
 [6]  1.002950e-06 -2.917076e-07 -5.145854e-07 -7.604064e-07  4.195346e-07
[11] -5.735824e-07  1.016060e-07  1.507702e-07  6.588004e-07 -1.540479e-07
[16]  5.834153e-07 -1.179941e-07 -6.161914e-07  1.802688e-07  5.735824e-07
[21] -1.606031e-07  1.081613e-07  3.277614e-08 -1.704359e-07 -8.128482e-07
[26] -1.769912e-07 -3.605375e-07 -4.392003e-07  1.179941e-07  5.571944e-08
[31]  6.882989e-08  8.194035e-07  7.014094e-07  6.424123e-07 -7.931826e-07
[36] -4.588659e-08  1.868240e-07  1.179941e-07

Even if you scale it again, it will be unchanged.

$\endgroup$
2
  • $\begingroup$ Thanks! I've checked the documentation out, it's already scaled indeed. So if I wanted to cluster genes, I don't need to scale. If I wanted to cluster patients, then if I were to start from raw data(not using multtest), I'd need to on the rows? $\endgroup$ Commented May 18, 2020 at 20:22
  • $\begingroup$ yes, you would scale the rows $\endgroup$
    – StupidWolf
    Commented May 18, 2020 at 21:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.