Hi Michael,
For the DESeq2::plotPCA()
function, it calls the pca <- prcomp(t(assay(object)[select, ]))
internally. I compared the results from prcomp
and that of FactoMineR::PCA
, the variances explained by PC1 from the two functions differ. Specifically, PC1 from DESeq2::plotPCA()
is 99%, which is concerning high while PC1 from FactoMineR::PCA
is a more reasonable 70% or so. The discrepancy seems to boil down to the fact that the scale.
argument is set to FALSE
in the prcomp
function, whereas FactoMineR::PCA
seems to scale by default.
I read the prcomp
documentation, it actually recommends setting scale. = TRUE
:
scale. a logical value indicating whether the variables should be
scaled to have unit variance before the analysis takes place.
The default is FALSE for consistency with S, but in general scaling
is advisable. Alternatively, a vector of length equal the number of
columns of x can be supplied. The value is passed to scale.
Therefore, I am wondering if is intentional to use the default scale. = FALSE
in the DESeq2::plotPCA()
. And should I scale the data before using DESeq2::plotPCA()
?
Thanks and best,
Thanks very much! Simply put, after
vst
transformation, it is not recommended to scale if usingDESeq2::plotPCA()
.By default,
base::prcomp()
setscale.
toFALSE
, whereasFactoMineR::PCA()
setscale.unit
toTRUE
. This causes the plotting discrepancies that I observed. But why my PC1 is counting for 99% of the variance is another question.