We are performing typical RNAseq workflow, so we have generated a counts matrix with genes as rows and samples as columns. We have a metadata file which contains all the samples as rows and the confounding variables as columns. We have identified a total of 7 confounding variables (biological and technical) such as age, sex, RIN, etc. that we have determined are confounding. We would like to perform PCA to extract the first 3 PC for all confounding variables, and then use the extracted PC1, PC2, PC3 as covariates for differential expression. Our question is how we could implement the data in the metadata file to the prcomp function, or another PCA R package that has this functionality? Thank you.
Hello, if you post the code you have working so far, I should be able to clean it up.
Do not delete posts that have received feedback. Engage with the people that invest effort in your problem.