% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/estimateLCMinfiEwasWater.R
\name{estimateLCMinfiEwasWater}
\alias{estimateLCMinfiEwasWater}
\title{Estimate cell composition for preprocessingMinfiEwasWater}
\usage{
estimateLCMinfiEwasWater(
  beta,
  targets,
  SampleID = "Sample_Name",
  lcRef = "salivaEPIC",
  phenoOrder = "Sample_Name;Timepoint;Sex;PredSex;Basename;Sentrix_ID;Sentrix_Position",
  constrained = FALSE,
  verbose = FALSE,
  logs = FALSE,
  log_dir = NULL,
  log_file = "log_estimateLCMinfiEwasWater.txt"
)
}
\arguments{
\item{beta}{Numeric matrix of beta values with probes in rows and samples in
columns.}

\item{targets}{Phenotype data frame aligned with the columns of \code{beta}.}

\item{SampleID}{Character. Phenotype column containing sample identifiers.}

\item{lcRef}{Character. Cell-composition reference. Internal saliva-based
references supported through \code{estimateLC()} are \code{'saliva'} and
\code{'salivaEPIC'}. Other references are passed to
\code{ENmix::estimateCellProp()}.}

\item{phenoOrder}{Character vector or semicolon-separated string describing
the phenotype columns that should appear first in the merged \code{phenoLC}
output.}

\item{constrained}{Logical. Passed to \code{estimateLC()} when an internal saliva
reference is used. If \code{TRUE}, estimated proportions are constrained to sum
to one.}

\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_minfiEwasWater_lc'} containing the cell
proportion matrix, merged phenotype table, reference name, and method used.
}
\description{
Estimate cell proportions from beta values using \code{estimateLC()} for saliva
reference panels or \code{ENmix::estimateCellProp()} for other supported
references, then merge the estimates into the phenotype table.
}
\examples{
ref_file <- system.file("extdata", "saliva.txt", package = "dnaEPICO")
beta <- as.matrix(utils::read.table(ref_file))[1:20, , drop = FALSE]
colnames(beta) <- c("sample1", "sample2")
targets <- data.frame(
    Sample_Name = colnames(beta),
    Timepoint = c("T1", "T2"),
    stringsAsFactors = FALSE
)
lc_data <- estimateLCMinfiEwasWater(
    beta = beta,
    targets = targets,
    lcRef = "saliva",
    phenoOrder = "Sample_Name;Timepoint"
)
stopifnot(is.data.frame(lc_data$phenoLC))

}
