Estimate cell proportions from beta values using estimateLC() for saliva reference panels or ENmix::estimateCellProp() for other supported references, then merge the estimates into the phenotype table.

estimateLCMinfiEwasWater(
  beta,
  targets,
  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

beta

Numeric matrix of beta values with probes in rows and samples in columns.

targets

Phenotype data frame aligned with the columns of beta.

lcRef

Character. Cell-composition reference. Internal saliva-based references supported through estimateLC() are "saliva" and "salivaEPIC". Other references are passed to ENmix::estimateCellProp().

phenoOrder

Character vector or semicolon-separated string describing the phenotype columns that should appear first in the merged phenoLC output.

constrained

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

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_minfiEwasWater_lc" containing the cell proportion matrix, merged phenotype table, reference name, and method used.

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))