
Find DMPs from methylation array beta values using limma
Source:R/find_dmps_array.R
findDMPsArray.RdThis helper identifies differentially methylated positions (DMPs) from
methylation array beta values using limma, returning the same seed-style
output columns as findDMPsBSSeq().
In contrast to dmpFinder() from minfi, this function supports flexible covariate inclusion
and returns a consistent output format with the BS-seq DMPs for downstream compatibility with CMEnt's region-finding functions.
Usage
findDMPsArray(
beta,
samplesheet,
samplesheet_sep = "\t",
sample_group_col = NULL,
id_col = "Sample_ID",
array = NULL,
genome = NULL,
sorted_locs = NULL,
njobs = getOption("CMEnt.njobs", 1L),
chr = "auto",
case_group = NULL,
covariates = NULL,
output_file = NULL
)Arguments
- beta
A beta input supported by
getBetaHandler(), such as a numeric matrix/data frame or a beta file path. minfiMethylSet/RatioSetinputs are also accepted and converted to beta values.- samplesheet
A data frame or file path to a tab-delimited sample sheet.
- samplesheet_sep
Separator for samplesheet files. Default is tab.
- sample_group_col
Column in
samplesheetcontaining group labels.- id_col
Column in
samplesheetcontaining sample IDs. row.names can also be used by specifyingid_col = "row.names".- array
Array platform passed to
getSortedGenomicLocs()whensorted_locsis not supplied.- genome
Optional genome passed to
getSortedGenomicLocs()whensorted_locsis not supplied. IfNULL, inferred frombetawhen possible, otherwise fromarray.- sorted_locs
Optional data frame of probe locations with row names as site IDs and
chrplusstartorposcolumns.- njobs
Number of jobs used by
getBetaHandler()when reading beta files.- chr
Chromosomes to retain,
"auto"for chr1-chr22, or"all"for chr1-chr22 plus chrX and chrY.- case_group
Group label to treat as case. If
NULL, the first group insample_group_colis used.- covariates
Optional covariate column names, or a comma-separated string, to include in the limma model.
- output_file
Optional tab-delimited output path. Files ending in
.gzare gzipped.
Examples
beta <- matrix(
c(
0.10, 0.12, 0.11, 0.82, 0.80, 0.81,
0.74, 0.72, 0.73, 0.20, 0.22, 0.21,
0.40, 0.42, 0.41, 0.43, 0.44, 0.45
),
nrow = 3,
byrow = TRUE,
dimnames = list(paste0("cg", 1:3), paste0("s", 1:6))
)
samplesheet <- data.frame(
Sample_ID = colnames(beta),
Sample_Group = rep(c("control", "case"), each = 3)
)
sorted_locs <- data.frame(
chr = "chr1",
start = c(100L, 200L, 300L),
row.names = rownames(beta)
)
dmps <- findDMPsArray(
beta = beta,
samplesheet = samplesheet,
sample_group_col = "Sample_Group",
array = "450K",
genome = "hg19",
sorted_locs = sorted_locs,
case_group = "case",
chr = "all"
)
head(dmps)