Hi, I am attempting to use the PCAtools R package. I have imported my own data matrix (pca.matrix) and metadata (metadata) files. When just running this code, everything works great and I get plots:
p <- pca(pca.matrix, removeVar = 0.1)
-- removing the lower 10% of variables based on variance
screeplot(p)
biplot(p)
When I try to link and check the metadata, all seems to be working:
pca.matrix <-pca.matrix[,which(colnames(pca.matrix) %in% rownames(metadata))]
all(colnames(pca.matrix) == rownames(metadata))
[1] TRUE
However, when I try to run the PCA with the metadata, I get the following:
p <- pca(pca.matrix, metadata = metadata, removeVar = 0.1)
Error in pca(pca.matrix, metadata = metadata, removeVar = 0.1) : 'colnames(mat)' is not identical to 'rownames(metadata)'
Shouldn't it be trying to match up 'colnames(pca.matrix)' with 'rownames(metadata)'? What is 'colnames(mat)'? I feel like I'm totally missing some key information.
Any help would be great! Thank you!
Hi, I developed this package. Sure that it is all now okay? There will likely be a variety of reasons for that error message to appear - yours is just one particular use case
Hi Kevin,
Thank you for the response! Yes! Everything is working wonderfully now - just a rookie user error on my part!
Hi Kevin, what other reasons might lead to this error? I'm having a similar issue to op, but their solution isn't working for me
Can you show a sample of your input metadata and the command you are using to import it?