Run ENmix::ctrlsva() on an RGChannelSet and return the surrogate variable matrix as an in-memory object.

estimateSvaEnmixControls(
  RGSet,
  ctrlSvaPercVar = 0.9,
  ctrlSvaFlag = 1,
  verbose = FALSE,
  logs = FALSE,
  log_dir = NULL,
  log_file = "log_estimateSvaEnmixControls.txt"
)

Arguments

RGSet

An RGChannelSet.

ctrlSvaPercVar

Numeric. Proportion of variance explained by control probes, passed to ENmix::ctrlsva().

ctrlSvaFlag

Integer. Control-probe flag passed to ENmix::ctrlsva().

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_svaEnmix_sva" containing the surrogate variable matrix and the parameters used to estimate it.

Examples

ex <- dnaEPICO:::exampleMinfiBaseDataDnaEpico()
sva_data <- estimateSvaEnmixControls(
  RGSet = ex$RGSet,
  ctrlSvaPercVar = 0.5,
  ctrlSvaFlag = 1,
  verbose = FALSE,
  logs = FALSE
)
#> 1  surrogate variables explain  60.9329 % of 
#>     data variation
sva_data$K
#> [1] 1