kevinblighe / PCAtools

PCAtools: everything Principal Components Analysis
329 stars 67 forks source link

Percentage variation #58

Closed VictorGoitea closed 2 years ago

VictorGoitea commented 2 years ago

Hi,

First of all, congrats and thank you for such a nice tool for PCA. I was wondering about the percentage of variation. I have obtained different results between DESeq2::plotPCA() and PCAtools::biplot(). For example, I have a case where plotPCA shows 19% for PC1 and biplot shows 15.4% for PC1, of course, using the same vst data as input. I observed that plotPCA uses prcomp in its calculation of sdev, while you use BiocSingular::runPCA. Can you @kevinblighe or @LTLA explain here why the differences? And is it okay they do not match or should we be concern about it.

Thanks in advance

kevinblighe commented 2 years ago

Hi @VictorGoitea, yes, the difference will be that DESeq2's function automatically removes variables prior to performing PCA. If you may take a look at the ntopparameter: https://www.rdocumentation.org/packages/DESeq2/versions/1.12.3/topics/plotPCA

That should explain the difference.

Kind regards, Kevin