Whenever the available data contains also the sample class (i.e cancer vs. normal), does it make sense to calculate the correlation matrix considering all the samples. Shouldn't be better calculate the correlation values considering each class separated? In the first way we identify only those genes that are correlated across all the conditions, while in the second way we highlight genes that are correlate across a specific condition (cancer or normal). Which is the common approach? Is the second procedure used only when we want discover new biomarkers?
I think you understand the concept of correlation within and between classes correctly. The most common approach is to use correlation across all conditions. Correlation is not a method for discovering new biomarkers, generally. Biomarker discovery is generally done through a process of feature selection such as t-testing or some forms of classification.