I read a lot on the web, but I am still not sure whether I understood completely when we standardize the data (so that it is zero mean unit variance). So, let's say that I have a set of genes and expression levels of those genes among different cancer patients, and I want to cluster the genes into pathways using expression data. What I need to do as a preprocessing step is to standardize each gene so that it is zero mean unit variance across samples, right? That's what people do in the papers I read. Okay, now let's say I want to work on the transposed matrix, that's, let's say I want to cluster patients into different cancer subtypes. Then, should I standardize the data this time for each sample so that each sample is zero mean unit variance across genes? Or, should I again standardize for each gene as before when we were clustering the genes? The latter approach seems to make more sense since gene activity levels are actually dependent to each other, but samples are usually independent. Making genes independent from each other using the former step does not seem logical to me. Could you please clarify on what dimension of the data and when I need standardizing?
Two types of clustering are mentioned in the question. The first, grouping genes into pathways, is variable clustering. The second, clustering patients by cancer type, is clustering by observation. In both cases, you should standardize the gene variables, not standardize within each individual.
In variable clustering, the correlation between the variables is of interest (you want to cluster variables that are highly correlated with each other). One way of performing variable clustering that may provide some intuition into your problem is to perform PCA on your data and then cluster variables that are grouped together by the PCA loadings. Intuitively, one could say that they are highly correlated with the same dimension of the PCA subspace (perhaps a pathway) and therefore with each other - thus they should be clustered. The point here is that as the papers you read allude to, before performing PCA and other similar procedures, one should standardize the variables. This R package may provide more insight into the considerations for variable clustering.
When you cluster patients by cancer type, you are performing the most familiar type of clustering; grouping individuals into intuitive clusters. As alluded to here and here (this paper might be the most helpful), you should standardize the variables (still the genes) before performing this type of analysis. That said, if the expression of your genes are all on the same scale, you may not want to standardize them, since this can cause you to lose valuable information. Furthermore, the standardization you describe will give all variables equal weight; this is probably what you want, but perhaps it is worth considering if this true.