Create Q-Q and standard-error diagnostic plots from the mixed-effects summary tables returned by summarizeMethylationGLMM_T1T2Models().

plotMethylationGLMM_T1T2Diagnostics(
  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_methylationGLMM_T1T2.txt"
)

Arguments

modelSummaries

Object returned by summarizeMethylationGLMM_T1T2Models().

preparedData

Object returned by prepareMethylationGLMM_T1T2Data().

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_methylationGLMM_T1T2_diagnostic_plots" containing the generated ggplot2 objects, genomic inflation factors, and any saved TIFF file paths.

Examples

ex <- dnaEPICO:::exampleMethylationGLMMStateDnaEpico()
diagnostic_plots <- plotMethylationGLMM_T1T2Diagnostics(
  modelSummaries = ex$modelSummaries,
  preparedData = ex$preparedData,
  display = FALSE,
  verbose = FALSE,
  logs = FALSE
)
names(diagnostic_plots$plots)
#> [1] "score"