Eigencor plot after limma::removeBatchEffect
1
0
Entering edit mode
4 months ago
f2ff7a46 • 0

I'm trying to create an eigencor plot of clinical variables against principle components using the PCAtools guidelines. https://www.bioconductor.org/packages/devel/bioc/vignettes/PCAtools/inst/doc/PCAtools.html#correlate-the-principal-components-back-to-the-clinical-data I want to first eliminate batch effects as the batches are really noticeable in PCA plots. This is the script I currently have:

> analysis_PCA <- vst(analysis_dds, blind=FALSE)
mat <- assay(analysis_PCA)
mm <- model.matrix(~DM, colData(analysis_PCA))
mat <- limma::removeBatchEffect(mat, batch=analysis_PCA$Batch, design=mm)
assay(analysis_PCA) <- mat
p <- pca(analysis_PCA, metadata = DASCondition, removeVar = 0.1)
eigencorplot(p,
components = getComponents(p, 1:10),
         components = getComponents(p, 1:10),
         metavars = c("BMI", "LFVEF"),
         col = c('darkblue', 'blue2', 'black', 'red2', 'darkred'),
         cexCorval = 0.7,
         colCorval = 'white',
         fontCorval = 2,
         posLab = 'bottomleft',
         rotLabX = 45,
         posColKey = 'top',
         cexLabColKey = 1.5,
         scale = TRUE,
         main = 'PC1-27 clinical correlations',
         colFrame = 'white',
         plotRsquared = FALSE)

This produced this error:

Error in t.default(mat) : argument is not a matrix

I know that the plot runs if I don't use the removeBatchEffect portion and if i use the removeBatchEffect and then plotPCA to generate PCA plots it works.

DESeq2 PCAtools • 453 views
ADD COMMENT
0
Entering edit mode
4 months ago

Like the error says, you have to feed a matrix. You are feeding an assay object instead.

At least assuming the error is coming from the pca call. Feed mat to it directly or extract the results from the assay (as.matrix(assay(analysis_PCA)).

ADD COMMENT

Login before adding your answer.

Traffic: 2020 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