I have expression profile of 27 samples (10 normal, 17 tumors). I did PCA analysis to check the quality of the samples to see them clustered in 2 different groups. I did it in two ways after RMA normalization and log2 transformation.
1. I did it without centring the data and the result showed that the quality is not good.pc <- prcomp(exp)
For the second time I centred the data (mean subtraction)
exp.scale <- t(scale(t(exp), scale = F))
pc <- prcomp(exp.scale)
My question is, if the PCA is calculated from the covariance matrix and mean centering does not affect the covariance matrix; why the output is different? After centering, the quality of the samples is much better! Should I consider that the quality of my samples are good or not?
Thanks!
You did not transpose your matrix prior to running
prcomp
. In a gene expression matrix with rows = genes and columns = samples one would run PCA likeprcomp(t(data))
, see e.g. the source code ofDESeq2::plotPCA
. Re-run the PCA using the log2-normalized intensity values and see how it performs.For the future please see How to add images to a Biostars post. You need the pull path to the image.
Could you please fix the images ?