Fit one Gaussian GLM per CpG for each phenotype requested in the object returned by prepareMethylationGLMData(). Each native fit is reduced to compact numerical results and discarded before the next batch is returned.

fitMethylationGLMModels(
  preparedData,
  nCores = 1L,
  libPath = NULL,
  glmLibs = "glm2",
  summaryDir = NULL,
  omnibusTest = FALSE,
  resumeFromSummary = TRUE,
  verbose = FALSE,
  logs = FALSE,
  log_dir = NULL,
  log_file = "log_methylationGLM.txt"
)

Arguments

preparedData

Object returned by prepareMethylationGLMData().

nCores

Integer. Maximum number of worker processes to use. Automatic fitting remains serial below the glm2 crossover and caps workers by available CpGs, CPUs, and detected memory.

libPath

Character vector or NULL. Optional library paths forwarded to worker processes.

glmLibs

Character vector or comma-separated string of package names to check on worker processes. The default is 'glm2'.

summaryDir

Character or NULL. Directory used for one complete compact summary per phenotype. NULL disables disk persistence.

omnibusTest

Logical. If TRUE, use car::linearHypothesis() to test the complete phenotype-by-interaction term, or the phenotype main effect when no interaction is specified, once per CpG.

resumeFromSummary

Logical. If TRUE, reuse a complete summary in summaryDir when it was generated from the same input file and model configuration.

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_models' containing compact coefficient matrices, unfiltered target summaries, formulas, model conditions, hard errors, and phenotype summary artifacts.

Examples

ex <- dnaEPICO:::exampleMethylationGLMStateDnaEpico()
model_results <- fitMethylationGLMModels(
  preparedData = ex$preparedData,
  nCores = 1,
  verbose = FALSE,
  logs = FALSE
)
names(model_results$fits)
#> [1] "status"