Perform a biplot from pcaData and coldata in DESeq2, maybe PCAtools?
1
0
Entering edit mode
ecg1g15 ▴ 20
@ecg1g15-19970
Last seen 3.4 years ago

I am working with a set of samples and around 4000 genes being expressed across these. (no control).

  • I have a counts df with samples as columns and genes as rows
  • I have a coldata df = samples as rows and observations as columns

I have plotted a PCA using the DESEq

plotPCA(vsd, intgroup=c("condition", "type"))

pcaData <- plotPCA(vsd, intgroup=c("condition", "type"), returnData=TRUE)
percentVar <- round(100 * attr(pcaData, "percentVar"))
ggplot(pcaData, aes(PC1, PC2, color=condition, shape=type)) +
  geom_point(size=3) +
  xlab(paste0("PC1: ",percentVar[1],"% variance")) +
  ylab(paste0("PC2: ",percentVar[2],"% variance")) + 
  coord_fixed()

I would like to plot a biplot on the PCA using my coldata environmental variables so they point explaining the variability.

  • Is there a way I could include the eigenvectors or the factors from my "coldata" which are potentially explaining the PCA variability of my samples?
  • In what format do I need to have my data to (ie. only numeric, transpose, merge coldata+count data?
library(PCAtools)
biplot(pcaData)
# Error in nrow(y) : argument "y" is missing, with no default
sessionInfo( )
R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.4
PCAtools biplot DESeq2 RNASeq PCA • 1.8k views
ADD COMMENT
0
Entering edit mode
Kevin Blighe ★ 3.9k
@kevin
Last seen 17 days ago
Republic of Ireland

Hi, PCAtools developer here. You first need to perform PCA via the PCAtools::pca() function. Please refer to my extensive vignette: https://bioconductor.org/packages/release/bioc/vignettes/PCAtools/inst/doc/PCAtools.html

More specifically, you will probably need:

p <- pca(assay(vsd))
biplot(p)

Note that DESeq2 also provides a PCA function.

Kevin

ADD COMMENT

Login before adding your answer.

Traffic: 536 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6