Apply detection P-value, chromosome, SNP, and probe-exclusion filters to the primary normalized object and return the filtered result.

filterProbesMinfiEwasWater(
  normData,
  RGSet,
  pvalThreshold = 0.01,
  chrToRemove = "chrX,chrY",
  snpsToRemove = "SBE,CpG",
  mafThreshold = 0.1,
  probeExclusionPath,
  probeExclusionIdColumn = NULL,
  useEpicV2Manifest = FALSE,
  epicV2ManifestFlags = c(CH_WGBS_evidence = TRUE, CH_BLAT = TRUE, MissingPos = TRUE,
    MismatchPos = FALSE),
  detPtype = "m+u",
  verbose = FALSE,
  logs = FALSE,
  log_dir = NULL,
  log_file = "log_filterProbesMinfiEwasWater.txt",
  crossReactivePath = NULL,
  crossReactiveIdColumn = NULL
)

Arguments

normData

Object returned by normalizeMinfiEwasWater().

RGSet

Filtered RGChannelSet aligned with normData.

pvalThreshold

Numeric. Probes must have detection P values below this threshold in all samples to be retained.

chrToRemove

Character vector or comma-separated string of chromosome names to remove, for example "chrX,chrY".

snpsToRemove

Character vector or comma-separated string of SNP probe types to remove, for example "SBE,CpG".

mafThreshold

Numeric. Minor allele frequency threshold passed to minfi::dropLociWithSnps().

probeExclusionPath

Character vector or semicolon-separated string of CSV files containing probe IDs to remove.

probeExclusionIdColumn

Character or NULL. Column containing probe IDs. When NULL or "", each file is auto-detected using ProbeID, TargetID, IlmnID, or Name, then falling back to an unlabeled or probe-like first column.

useEpicV2Manifest

Logical. If TRUE, also remove EPICv2 probes flagged in the Peters et al. expanded manifest from AnnotationHub resource AH116484.

epicV2ManifestFlags

Named logical vector controlling which EPICv2 manifest flags are removed. Defaults remove CH_WGBS_evidence, CH_BLAT, and MissingPos, but not MismatchPos.

detPtype

Character. Detection P-value mode passed to minfi::detectionP() for the probe filter. Common values in minfi workflows are "m+u" and "negative".

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.

crossReactivePath

Deprecated alias for probeExclusionPath.

crossReactiveIdColumn

Deprecated alias for probeExclusionIdColumn.

Value

A list with class "dnaEPICO_minfiEwasWater_filter" containing the filtered object and counts for each filtering stage.

Examples

ex <- dnaEPICO:::exampleMinfiWorkflowStateDnaEpico()
#> [preprocessQuantile] Mapping to genome.
#> [preprocessQuantile] Fixing outliers.
#> [preprocessQuantile] Quantile normalizing.
#> Warning: No probe-exclusion IDs overlap the filtered array feature names. Check that probeExclusionPath, probeExclusionIdColumn, and manifest settings match the array platform.
filtered_data <- filterProbesMinfiEwasWater(
  normData = ex$normData,
  RGSet = ex$sampleData$RGSet,
  pvalThreshold = 1,
  chrToRemove = "chrY",
  snpsToRemove = "SBE",
  mafThreshold = 1,
  probeExclusionPath = ex$probeExclusionPath,
  detPtype = "m+u",
  verbose = FALSE,
  logs = FALSE
)
#> Warning: No probe-exclusion IDs overlap the filtered array feature names. Check that probeExclusionPath, probeExclusionIdColumn, and manifest settings match the array platform.
filtered_data$counts[["probeExclusion"]]
#> [1] 485096