% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/preprocessingMinfiEwasWater.R
\name{preprocessingMinfiEwasWater}
\alias{preprocessingMinfiEwasWater}
\title{Convenience preprocessing pipeline for Illumina methylation arrays}
\usage{
preprocessingMinfiEwasWater(
  phenoFile = "data/preprocessingMinfiEwasWater/pheno.csv",
  idatFolder = "data/preprocessingMinfiEwasWater/idats",
  outputLogs = "logs",
  nSamples = NA,
  SampleID = "Sample_Name",
  arrayType = "IlluminaHumanMethylationEPICv2",
  annotationVersion = "20a1.hg38",
  idatForce = FALSE,
  scriptLabel = "preprocessingMinfiEwasWater",
  baseDataFolder = "rData",
  figureBaseDir = "figures",
  sepType = NULL,
  tiffWidth = 2000,
  tiffHeight = 1000,
  tiffRes = 150,
  qcCutoff = 10.5,
  detPtype = "m+u",
  detPThreshold = 0.05,
  normMethods = "adjustedfunnorm",
  sexColumn = "Sex",
  removeSexMismatch = FALSE,
  pvalThreshold = 0.01,
  chrToRemove = "chrX,chrY",
  snpsToRemove = "SBE,CpG",
  mafThreshold = 0.1,
  probeExclusionPath = "data/preprocessingMinfiEwasWater/12864_2024_10027_MOESM8_ESM.csv",
  probeExclusionIdColumn = NULL,
  useEpicV2Manifest = FALSE,
  epicV2ManifestFlags = c(CH_WGBS_evidence = TRUE, CH_BLAT = TRUE, MissingPos = TRUE,
    MismatchPos = FALSE),
  plotGroupVar = "Sex",
  lcRef = "salivaEPIC",
  phenoOrder = "Sample_Name;Timepoint;Sex;PredSex;Basename;Sentrix_ID;Sentrix_Position",
  lcPhenoDir = "data/preprocessingMinfiEwasWater",
  display = FALSE,
  verbose = FALSE,
  logs = FALSE,
  saveOutputs = FALSE,
  crossReactivePath = NULL,
  crossReactiveIdColumn = NULL
)
}
\arguments{
\item{phenoFile}{Character. Path to the phenotype CSV file.}

\item{idatFolder}{Character. Directory containing the IDAT files.}

\item{outputLogs}{Character. Directory used for log files when \code{logs = TRUE}.}

\item{nSamples}{Integer or \code{NA}. Number of rows to keep from the phenotype
table. Use \code{NA} to keep all samples.}

\item{SampleID}{Character. Name of the phenotype column containing sample
identifiers.}

\item{arrayType}{Character. Illumina array identifier passed to
\code{Biobase::annotation()}, for example \code{'IlluminaHumanMethylationEPICv2'}.}

\item{annotationVersion}{Character. Annotation build passed to
\code{Biobase::annotation()}, for example \code{'20a1.hg38'} or \code{'ilmn12.hg19'}.}

\item{idatForce}{Logical. Passed to \code{minfi::read.metharray.exp()} when
reading IDAT files. Use \code{TRUE} only after confirming that the selected IDAT
files should be read together.}

\item{scriptLabel}{Character. Label used to name output folders when
\code{saveOutputs = TRUE}.}

\item{baseDataFolder}{Character. Base directory used for saved \code{.RData}
outputs when \code{saveOutputs = TRUE}.}

\item{figureBaseDir}{Character. Base directory used for saved figure outputs
when \code{saveOutputs = TRUE}.}

\item{sepType}{Character or \code{NULL}. Field separator used in \code{phenoFile}. Use
\code{NULL} for a comma-separated file, \code{'\\\\t'} for a tab-delimited file, or
another separator accepted by \code{utils::read.csv()}.}

\item{tiffWidth}{Integer. Width of saved TIFF plots in pixels.}

\item{tiffHeight}{Integer. Height of saved TIFF plots in pixels.}

\item{tiffRes}{Integer. Resolution in DPI for saved TIFF plots.}

\item{qcCutoff}{Numeric. QC cutoff passed to \code{minfi::plotQC()}.}

\item{detPtype}{Character. Detection P-value mode passed to
\code{minfi::detectionP()}. Common values in minfi workflows are \code{'m+u'} and
\code{'negative'}. The default here is \code{'m+u'}.}

\item{detPThreshold}{Numeric. Samples with mean detection P value above this
threshold are removed.}

\item{normMethods}{Character vector or semicolon-separated string of
normalization methods. Supported values are \code{'adjustedfunnorm'},
\code{'funnorm'}, \code{'illumina'}, \code{'quantile'}, and \code{'swan'}.}

\item{sexColumn}{Character. Name of the phenotype column containing reported
sex.}

\item{removeSexMismatch}{Logical. If \code{TRUE}, remove samples whose reported
sex and methylation-predicted sex are both known and disagree. Missing or
unknown sex values are retained. The default is \code{FALSE}.}

\item{pvalThreshold}{Numeric. Probe-level detection P-value threshold used in
the probe filter.}

\item{chrToRemove}{Character vector or comma-separated string of chromosome
names to remove, for example \code{'chrX,chrY'}.}

\item{snpsToRemove}{Character vector or comma-separated string of SNP probe
types to remove, for example \code{'SBE,CpG'}.}

\item{mafThreshold}{Numeric. Minor allele frequency threshold passed to
\code{minfi::dropLociWithSnps()}.}

\item{probeExclusionPath}{Character vector or semicolon-separated string of
CSV files containing probe IDs to remove.}

\item{probeExclusionIdColumn}{Character or \code{NULL}. Column containing probe
IDs. When \code{NULL} or \code{''}, each file is auto-detected using \code{ProbeID},
\code{TargetID}, \code{IlmnID}, or \code{Name}, then falling back to an unlabeled or
probe-like first column.}

\item{useEpicV2Manifest}{Logical. If \code{TRUE}, also remove EPICv2 probes
flagged in the Peters et al. expanded manifest from AnnotationHub resource
\code{AH116484}.}

\item{epicV2ManifestFlags}{Named logical vector controlling which EPICv2
manifest flags are removed. Defaults remove \code{CH_WGBS_evidence}, \code{CH_BLAT},
and \code{MissingPos}, but not \code{MismatchPos}.}

\item{plotGroupVar}{Character. Phenotype column used for density and MDS
grouping plots.}

\item{lcRef}{Character. Reference panel used for cell composition estimation.
\code{'saliva'} and \code{'salivaEPIC'} use \code{estimateLC()}. Other values are passed
to \code{ENmix::estimateCellProp()}.}

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

\item{lcPhenoDir}{Character. Directory used for the saved \code{phenoLC.csv} file
when \code{saveOutputs = TRUE}.}

\item{display}{Logical. If \code{TRUE}, draw plots on the active graphics device.}

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

\item{logs}{Logical. If \code{TRUE}, write log messages to \code{outputLogs}. The
default is \code{FALSE}.}

\item{saveOutputs}{Logical. If \code{TRUE}, write the \code{.RData}, figure, and
\code{phenoLC.csv} outputs to disk. The default is \code{FALSE}.}

\item{crossReactivePath}{Deprecated alias for \code{probeExclusionPath}.}

\item{crossReactiveIdColumn}{Deprecated alias for \code{probeExclusionIdColumn}.}
}
\value{
A list with class \code{'dnaEPICO_preprocessingMinfiEwasWater'}.
\describe{
\item{targets}{Filtered phenotype table aligned to the retained samples.}
\item{RGSet}{Filtered \code{RGChannelSet} used in downstream preprocessing and
available for direct interactive inspection.}
\item{rawData}{Object returned by \code{\link[=buildRawMinfiEwasWater]{buildRawMinfiEwasWater()}} containing the
raw \code{MSet}, \code{RatioSet}, and genome-mapped object derived from \code{RGSet}.}
\item{assessment}{Object returned by \code{\link[=assessSamplesMinfiEwasWater]{assessSamplesMinfiEwasWater()}}
containing detection P values, QC summaries, and failed-sample tracking.}
\item{sexData}{Object returned by \code{\link[=predictSexMinfiEwasWater]{predictSexMinfiEwasWater()}} containing
predicted sex labels, mismatch summaries, plotting data, and the sample IDs
removed when \code{removeSexMismatch = TRUE}.}
\item{normData}{Object returned by \code{\link[=normalizeMinfiEwasWater]{normalizeMinfiEwasWater()}} containing
the requested normalized objects and metadata on the methods that were run.}
\item{filterData}{Object returned by \code{\link[=filterProbesMinfiEwasWater]{filterProbesMinfiEwasWater()}}
containing the probe-filtered methylation objects at each filtering stage.}
\item{metricsData}{Object returned by \code{\link[=extractMetricsMinfiEwasWater]{extractMetricsMinfiEwasWater()}}
containing the beta-value, M-value, and copy-number matrices used by later
workflow steps.}
\item{lcData}{Object returned by \code{\link[=estimateLCMinfiEwasWater]{estimateLCMinfiEwasWater()}} containing
the estimated cell-type proportions and the phenotype table augmented with
those proportions.}
\item{logFile}{Resolved path to the optional log file, or \code{NULL} when
logging was disabled.}
}
See \linkS4class{dnaEPICO_preprocessingMinfiEwasWater} for a class-level overview.
}
\description{
Run the \code{dnaEPICO} preprocessing workflow as a convenience wrapper around the
smaller minfi/ENmix/wateRmelon helper functions in this package. The wrapper
returns a structured result object containing the in-memory outputs from each
stage. Files are written only when \code{saveOutputs = TRUE}.
}
\examples{
if (requireNamespace("minfiData", quietly = TRUE) &&
    requireNamespace("IlluminaHumanMethylation450kmanifest", quietly = TRUE) &&
    requireNamespace("IlluminaHumanMethylation450kanno.ilmn12.hg19", quietly = TRUE)) {
    ex <- dnaEPICO:::exampleMinfiIdatInputsDnaEpico(n = 4)
    result <- preprocessingMinfiEwasWater(
        phenoFile = ex$phenoFile,
        idatFolder = ex$idatFolder,
        outputLogs = file.path(ex$tempDir, "logs"),
        nSamples = 4,
        SampleID = "Sample_Name",
        arrayType = ex$arrayType,
        annotationVersion = ex$annotationVersion,
        scriptLabel = "preprocessingMinfiEwasWater",
        baseDataFolder = file.path(ex$tempDir, "rData"),
        figureBaseDir = file.path(ex$tempDir, "figures"),
        detPThreshold = 1,
        normMethods = "quantile",
        sexColumn = "Sex",
        pvalThreshold = 1,
        chrToRemove = "",
        snpsToRemove = "SBE",
        mafThreshold = 1,
        probeExclusionPath = ex$probeExclusionPath,
        plotGroupVar = "Sex",
        lcRef = "saliva",
        phenoOrder = "Sample_Name;Sex;Basename;Sentrix_ID;Sentrix_Position",
        lcPhenoDir = ex$tempDir,
        saveOutputs = FALSE,
        verbose = FALSE,
        logs = FALSE
    )
    inherits(result, "dnaEPICO_preprocessingMinfiEwasWater")
}

}
\seealso{
\linkS4class{dnaEPICO_preprocessingMinfiEwasWater}
}
