Predict sample sex from a genome-mapped methylation object, align the predictions with phenotype data, and return a structured object that can be plotted or merged into downstream phenotype tables.

predictSexMinfiEwasWater(
  rawData,
  targets,
  SampleID = "Sample_Name",
  sexColumn = "Sex",
  verbose = FALSE,
  logs = FALSE,
  log_dir = NULL,
  log_file = "log_predictSexMinfiEwasWater.txt"
)

Arguments

rawData

Object returned by buildRawMinfiEwasWater().

targets

Filtered phenotype data frame aligned with rawData.

SampleID

Character. Name of the sample identifier column in targets.

sexColumn

Character. Name of the phenotype column containing reported sex.

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_sex" containing the sex prediction result, aligned phenotype data, plotting data, and mismatch table.

Examples

ex <- dnaEPICO:::exampleMinfiWorkflowStateDnaEpico()
sex_data <- predictSexMinfiEwasWater(
  rawData = ex$rawFiltered,
  targets = ex$sampleData$targets,
  SampleID = "Sample_Name",
  sexColumn = "Sex",
  verbose = FALSE,
  logs = FALSE
)
names(sex_data)
#> [1] "pSex"        "targets"     "sexPlotData" "mismatches"  "SampleID"   
#> [6] "sexColumn"