Commit 9afc9a95 authored by Christian Arnold's avatar Christian Arnold

Improved diagnostic plots for limma and small sign bug that caused a DESeq /...

Improved diagnostic plots for limma and small sign bug that caused a DESeq / limma switch in the new version
parent 5c7e6458
......@@ -374,7 +374,7 @@ countsNorm.df = as.data.frame(countsNorm) %>%
dplyr::select(one_of("peakID", colnames(countsNorm)))
if (par.l$nPermutations == 0) {
if (par.l$nPermutations > 0) {
# Generate normalized counts for limma analysis
countsNorm.transf = log2(countsNorm + par.l$pseudocountAddition)
......@@ -405,7 +405,7 @@ if (par.l$nPermutations == 0) {
)
plotDiagnosticPlots(cds.peaks.filt, fit, comparisonDESeq, par.l$file_output_plots, maxPairwiseComparisons = 20)
plotDiagnosticPlots(cds.peaks.filt, fit, comparisonDESeq, par.l$file_output_plots, maxPairwiseComparisons = 10)
} else {
......
......@@ -421,26 +421,34 @@ myMAPlot <- function(M, idx, main, minMean = 0) {
}
plotDiagnosticPlots <- function(dd, differentialResults, conditionComparison, filename = NULL, maxPairwiseComparisons = 5, alpha = 0.05) {
plotDiagnosticPlots <- function(dd, differentialResults, conditionComparison, filename = NULL, maxPairwiseComparisons = 5, alpha = c(0.001, 0.01, 0.05,0.1,0.2)) {
checkAndLoadPackages(c("tidyverse", "checkmate", "geneplotter", "DESeq2", "vsn", "RColorBrewer", "limma"), verbose = FALSE)
assertClass(dd, "DESeqDataSet")
assert(testClass(differentialResults, "MArrayLM"), testClass(differentialResults, "DESeqDataSet"))
assertVector(conditionComparison, len = 2)
assert(checkNull(filename), checkDirectory(dirname(filename), access = "w"))
if (!is.null(filename)) {
pdf(filename)
}
if (testClass(differentialResults, "MArrayLM")) {
title = paste0("limma results\n", conditionComparison[1], " vs. ", conditionComparison[2])
isSign = ifelse(p.adjust(differentialResults$p.value[,ncol(differentialResults$p.value)], method = "BH") < alpha, paste0("sign. (BH, ", alpha, ")"), "not-significant")
limma::plotMA(differentialResults, main = title, status = isSign)
for (alphaCur in alpha) {
isSign = ifelse(p.adjust(differentialResults$p.value[,ncol(differentialResults$p.value)], method = "BH") < alphaCur,
paste0("sign. (BH, ", alphaCur, ")"),
"not-significant")
limma::plotMA(differentialResults, main = title, status = isSign, bg.cex = 0.5, hl.cex = 0.5)
}
} else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment