Load the merged phenotype-plus-beta input object, validate the requested modeling variables, convert selected variables to factors, and return a single in-memory object for downstream helpers.

prepareMethylationGLM_T1Data(
  inputPheno,
  phenotypes,
  covariates,
  factorVars,
  cpgPrefix = "cg",
  cpgLimit = NA,
  interactionTerm = NULL,
  prsMap = NULL,
  verbose = FALSE,
  logs = FALSE,
  log_dir = NULL,
  log_file = "log_methylationGLM_T1.txt"
)

Arguments

inputPheno

Character. Path to the merged phenotype-plus-beta object created by preprocessingPheno().

phenotypes

Character vector or comma-separated string of phenotype variables to model.

covariates

Character vector or comma-separated string of covariate variables to adjust for.

factorVars

Character vector or comma-separated string of variables that should be converted to factors before modeling.

cpgPrefix

Character. Prefix used to identify methylation columns.

cpgLimit

Integer or NA. Maximum number of CpGs to retain. NA keeps all matching CpGs.

interactionTerm

Character or NULL. Optional interaction term.

prsMap

Character vector or comma-separated string of phenotype-to-PRS mappings in the form "Phenotype:PRS".

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_data" containing the prepared analysis data, parsed variable selections, CpG columns, and exploratory summaries.

Examples

ex <- dnaEPICO:::exampleMethylationGLMStateDnaEpico()
prepared_data <- prepareMethylationGLM_T1Data(
  inputPheno = ex$inputPath,
  phenotypes = "status",
  covariates = "sex,age",
  factorVars = "status,sex",
  cpgLimit = 2,
  verbose = FALSE,
  logs = FALSE
)
names(prepared_data)
#>  [1] "data"                     "phenotypes"              
#>  [3] "covariates"               "factorVars"              
#>  [5] "cpgColumns"               "cpgPrefix"               
#>  [7] "cpgLimit"                 "prsMap"                  
#>  [9] "interactionTerm"          "requestedInteractionTerm"
#> [11] "missingCounts"            "variableSummary"         
#> [13] "interactionTable"