Hi,
I asked this over on biostars with no reply - a bit too technical and more appropriate here I think.
I am working through the PCAtools readme. Two data sets are used to demonstrate the package, the first pca created takes a deseq2 object (DESeq2 data), and the second does not (GEO data).
The eigencorplot() function is introduced on the GEO data, and I am trying to figure out how to use it on the DESeq2 data. Can anyone explain why I can't get it to work, and offer a solution?
It is clear the problem is associated with my use of the 'metavars' argument which is "A vector of column names in metadata representing continuous variables". Clearly in both datasets some of the columns are not continuous, but for the GEO data set it works (coercion I think), while the DESeq2 data set it doesn't.
Thanks, Kenneth
# Compute PCA
pGEO <- pca(mat, metadata = metadata, removeVar = 0.1) # GEO
pDESEQ <- pca(vst, metadata = colData(airway), removeVar = 0.1) # DESeq2
# View available metadata columns in pca object
colnames(pGEO$metadata) # prints: Study, Age, Distant.RFS, ER, GGI, Grade, Size, Time.RFS
colnames(pDESEQ$metadata) # prints: SampleName, cell, dex, albut, Run, avgLength, Experiment, Sample, BioSample
# Eigencorplot
eigencorplot(pGEO, metavars = c('Study','Age','Distant.RFS','ER', 'GGI','Grade','Size','Time.RFS')) # successful
eigencorplot(pDESEQ, metavars = c('SampleName', 'cell', 'dex', 'albut', 'Run', 'avgLength', 'Experiment', 'Sample', 'BioSample')) # error
# Error
Error in `[.data.frame`(data, , components[i]) :
undefined columns selected
try
traceback()
that may help the developer figure out what's going on.
Or you can make a reproducible example, with
makeExampleDESeqDataSet()
Figured it out with ?eigencorplot, thanks Michael. I was trying to pass 10 PCs when I only had 8, and I was including metadata columns that were not part of the design.