Create Q-Q and residual-diagnostic plots from the CpG summary tables returned by summarizeMethylationGLM_T1Models().

plotMethylationGLM_T1Diagnostics(
  modelSummaries,
  preparedData,
  fdrThreshold = 0.05,
  padjmethod = "fdr",
  outputDir = NULL,
  plotWidth = 2000L,
  plotHeight = 1000L,
  plotDPI = 150L,
  display = FALSE,
  verbose = FALSE,
  logs = FALSE,
  log_dir = NULL,
  log_file = "log_methylationGLM_T1.txt"
)

Arguments

modelSummaries

Object returned by summarizeMethylationGLM_T1Models().

preparedData

Object returned by prepareMethylationGLM_T1Data().

fdrThreshold

Numeric. False-discovery-rate threshold used to highlight CpGs in the diagnostic plots.

padjmethod

Character. P-value adjustment method passed to stats::p.adjust().

outputDir

Character or NULL. Directory used for TIFF files. When NULL, plots are returned in memory only.

plotWidth

Integer. TIFF width in pixels when plots are written to disk.

plotHeight

Integer. TIFF height in pixels when plots are written to disk.

plotDPI

Integer. TIFF resolution in DPI when plots are written to disk.

display

Logical. If TRUE, draw plots on the active graphics device.

verbose

Logical. If TRUE, emit progress messages with message().

logs

Logical. If TRUE, write the same messages to a log file.

log_dir

Character or NULL. Directory used for the log file when logs = TRUE.

log_file

Character. File name used when logs = TRUE.

Value

A list with class "dnaEPICO_methylationGLM_T1_diagnostic_plots" containing the generated ggplot2 objects, genomic inflation factors, and any saved TIFF file paths.

Examples

ex <- dnaEPICO:::exampleMethylationGLMStateDnaEpico()
diagnostic_plots <- plotMethylationGLM_T1Diagnostics(
  modelSummaries = ex$modelSummaries,
  preparedData = ex$preparedData,
  display = FALSE,
  verbose = FALSE,
  logs = FALSE
)
names(diagnostic_plots$plots)
#> NULL