I identified eigengenes for all gene modules using WGCNA. I am trying to reproduce the eigengenes using prcomp function to get the PC1. PC1 and eigengene values are not matching. What am I missing?
Dera Jayesh there are many variants of PCA linked to differrent normalization methods and/or metrics and probably you used a different approach so giving you different results, thus you have to check these points:
1. The two computations extract the eigenvalues of correlation or covariance matrixes ?
2. The original data are mean-centered before analysis ?
3. The original data are standardized before analysis ?
and, most important of all Am I working on the same data set or not ? (i.e. whole data set or only a subset of genes or statistical units ?)
I also used eigengenes sometimes, based WGCNA package. Recently, when I want to refine my code, I found a way to get this in a simple way.
By definition, eigengenes are the right singular vectors of the SVD of the expression matrix(row as genes, column as samples). Thus, you could regard them as unscaled PCs. As in SVD or PCA, the direction is chosen arbitrarily, you need to align the PC with the average expressions of your genesets.