I'm trying to perform RNASeq analysis with DESeq2 in RStudio, and as one of the quality control steps I am trying to perform Principal Component Analysis on my DESeq2 object. I've included the code chunk below - I am able to create the DESeq2 object just fine, but run into problems plotPCA(). I think there's an issue with the packages talking to each other/masking each other, but I'm not sure how to resolve it. I've also tried DESeq2::plotPCA() and still received the same error message. Any help would be greatly appreciated - thanks!
#code from my script
library(DESeq2)
dataset = "./data/merged.csv"
dataset = read.table(dataset,
header = T,
sep = ",",
row.names = 1,
stringsAsFactors = F)
metadata = data.frame(condition = (c("CTL", "TS21", "TS21", "CTL")),
row.names = c("NDC", "DSIPS", "THO3B", "THO3F"))
dds_DS <- DESeqDataSetFromMatrix(countData = dataset,
colData = metadata,
design = ~condition)
library(pheatmap)
library(RColorBrewer)
plotPCA(vst_dds_DS, intgroup="condition")
#Error Message!
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘plotPCA’ for signature ‘"matrix"’
sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.4
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] parallel stats4 stats graphics grDevices
[6] utils datasets methods base
other attached packages:
[1] RColorBrewer_1.1-2 pheatmap_1.0.12
[3] DESeq2_1.28.1 SummarizedExperiment_1.18.1
[5] DelayedArray_0.14.0 matrixStats_0.56.0
[7] Biobase_2.48.0 GenomicRanges_1.40.0
[9] GenomeInfoDb_1.24.0 IRanges_2.22.2
[11] S4Vectors_0.26.1 BiocGenerics_0.34.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.4.6 locfit_1.5-9.4
[3] lattice_0.20-41 digest_0.6.25
[5] R6_2.4.1 RSQLite_2.2.0
[7] ggplot2_3.3.1 pillar_1.4.4
[9] zlibbioc_1.34.0 rlang_0.4.6
[11] rstudioapi_0.11 annotate_1.66.0
[13] blob_1.2.1 Matrix_1.2-18
[15] splines_4.0.0 BiocParallel_1.22.0
[17] geneplotter_1.66.0 RCurl_1.98-1.2
[19] bit_1.1-15.2 munsell_0.5.0
[21] tinytex_0.23 compiler_4.0.0
[23] xfun_0.14 pkgconfig_2.0.3
[25] tidyselect_1.1.0 tibble_3.0.1
[27] GenomeInfoDbData_1.2.3 XML_3.99-0.3
[29] crayon_1.3.4 dplyr_1.0.0
[31] bitops_1.0-6 grid_4.0.0
[33] xtable_1.8-4 gtable_0.3.0
[35] lifecycle_0.2.0 DBI_1.1.0
[37] magrittr_1.5 scales_1.1.1
[39] farver_2.0.3 XVector_0.28.0
[41] genefilter_1.70.0 ellipsis_0.3.1
[43] vctrs_0.3.1 generics_0.0.2
[45] tools_4.0.0 bit64_0.9-7
[47] glue_1.4.1 purrr_0.3.4
[49] survival_3.1-12 yaml_2.2.1
[51] AnnotationDbi_1.50.0 colorspace_1.4-1
[53] memoise_1.1.0 knitr_1.28
Any help would be greatly appreciated! Thanks!
Thank you Michael! Really appreciate providing the path/method of thinking towards the solution as well as the solution itself!