% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/methylationGLM_steps.R
\name{prepareMethylationGLMData}
\alias{prepareMethylationGLMData}
\title{Prepare phenotype-plus-methylation data for one-timepoint GLM analyses}
\usage{
prepareMethylationGLMData(
  inputPheno,
  phenotypes,
  covariates,
  factorVars,
  scaleVars = NULL,
  cpgPrefix = "cg",
  cpgLimit = NA,
  methylationScale = "beta",
  interactionTerm = NULL,
  prsMap = NULL,
  verbose = FALSE,
  logs = FALSE,
  log_dir = NULL,
  log_file = "log_methylationGLM.txt"
)
}
\arguments{
\item{inputPheno}{Character. Path to the merged phenotype-plus-methylation
object
created by \code{preprocessingPheno()}.}

\item{phenotypes}{Character vector or comma-separated string of phenotype
variables to model.}

\item{covariates}{Character vector or comma-separated string of covariate
variables to adjust for.}

\item{factorVars}{Character vector or comma-separated string of variables
that
should be converted to factors before modeling.}

\item{scaleVars}{Character vector, comma-separated variable names, or \code{NULL}.
Numeric fixed-effect variables to standardize before model fitting.}

\item{cpgPrefix}{Character. Prefix used to identify methylation columns.}

\item{cpgLimit}{Integer or \code{NA}. Maximum number of CpGs to retain. \code{NA}
keeps all matching CpGs.}

\item{methylationScale}{Character. Methylation metric represented by the CpG
columns. One of \code{'Beta'}, \code{'M'}, or \code{'CN'}, case-insensitively.}

\item{interactionTerm}{Character or \code{NULL}. Optional interaction term.}

\item{prsMap}{Character vector or comma-separated string of phenotype-to-PRS
mappings in the form \code{'Phenotype:PRS'}.}

\item{verbose}{Logical. If \code{TRUE}, emit progress messages with \code{message()}.}

\item{logs}{Logical. If \code{TRUE}, write the same messages to a log file.}

\item{log_dir}{Character or \code{NULL}. Directory used for the log file when
\code{logs = TRUE}.}

\item{log_file}{Character. File name used when \code{logs = TRUE}.}
}
\value{
A list with class \code{'dnaEPICO_methylationGLM_data'} containing the
prepared analysis data, parsed variable selections, CpG columns, and
exploratory summaries.
}
\description{
Load the merged phenotype-plus-methylation input object, validate the
requested
modeling variables, convert selected variables to factors, and return a
single in-memory object for downstream helpers.
}
\examples{
ex <- dnaEPICO:::exampleMethylationGLMStateDnaEpico()
prepared_data <- prepareMethylationGLMData(
    inputPheno = ex$inputPath,
    phenotypes = "status",
    covariates = "sex,age",
    factorVars = "status,sex",
    cpgLimit = 2,
    verbose = FALSE,
    logs = FALSE
)
names(prepared_data)

}
