R/deseq_plot_qc.R

Defines functions deseq_plot_qc

Documented in deseq_plot_qc

#' deseq_plot_qc
#'
#' plots PCA
#' @param directory directory where raw output from feature counts are kept
#' @import limma
#' @import ggpubr
#' @import SummarizedExperiment
#' @export

deseq_plot_qc <- function(dds){
  vsd <- vst(dds, blind=FALSE)
  rld <- rlog(dds, blind=FALSE)
  mat_vsd <- assay(vsd)
  mat_vsd <- limma::removeBatchEffect(mat_vsd, vsd$pairs)
  assay(vsd) <- mat_vsd
  vsd_plot <- plotPCA(vsd, intgroup=c("condition")) + ggtitle("Variance stabilizing transformations")

  mat_rld <- assay(rld)
  mat_rld <- limma::removeBatchEffect(mat_rld, rld$pairs)
  assay(rld) <- mat_rld
  rld_plot <- plotPCA(rld, intgroup=c("condition")) + ggtitle("Regularized logarithm")

  ggpubr::ggarrange(vsd_plot, rld_plot)
}
s1060046/OmicsEO documentation built on Dec. 22, 2021, 9:10 p.m.