DNA methylation preprocessing#

This mini-protocol converts Illumina methylation-array IDAT files into an analysis-ready probe-by-sample phenotype matrix for mQTL analysis.

Miniprotocol Timing#

Timing: TBD

Overview#

Choose either SeSAMe or minfi to preprocess paired red/green IDAT intensities. Both workflows produce beta-value and M-value matrices, convert probe coordinates to BED phenotype files, and annotate probes with nearby genes. M values are generally used as the quantitative phenotype for association testing, whereas beta values remain useful for interpretation.

After calling, phenotype imputation removes probes above the missingness threshold and imputes the remaining missing values. Steps 1 and 2 are alternative starting routes; run only one, then run step 3 on its M-value BED output.

Steps#

Analysis goal

Commands to run, in order

Inputs

Process IDAT files with SeSAMe

1 → 3

input/methylation/protocol_example.methylation.sample_sheet_int.csv; paired input/methylation/*/*_Grn.idat and *_Red.idat files

Process IDAT files with minfi

2 → 3

input/methylation_minfi/protocol_example.methylation.sample_sheet.csv; paired input/methylation_minfi/*/*_Grn.idat and *_Red.idat files

Run the commands for the selected route in numerical order.

1. Call methylation levels with SeSAMe#

What it does: sesame performs probe- and sample-level detection filtering, calculates beta and M values, and formats both matrices as coordinate-sorted BED files.

sos run pipeline/methylation_calling.ipynb sesame   --sample-sheet input/methylation/protocol_example.methylation.sample_sheet_int.csv   --sample-sheet-header-rows 0   --cwd output/methylation

2. Call methylation levels with minfi#

What it does: minfi applies detection-p-value filtering and functional normalization, then writes beta and M values in the same downstream-compatible BED format.

sos run pipeline/methylation_calling.ipynb minfi   --sample-sheet input/methylation_minfi/protocol_example.methylation.sample_sheet.csv   --cwd output/methylation_minfi

3. Filter and impute the M-value matrix#

What it does: bed_filter_na removes probes exceeding the missingness threshold and uses soft-impute for the remaining missing entries.

sos run pipeline/phenotype_imputation.ipynb bed_filter_na   --phenoFile output/methylation/protocol_example.methylation.sample_sheet_int.sesame.M.bed.gz   --cwd .

Output Files#

Route/step

Output filename and relative path

Description

SeSAMe

output/methylation/protocol_example.methylation.sample_sheet_int.sesame.rds

Serialized SeSAMe result object

SeSAMe

output/methylation/protocol_example.methylation.sample_sheet_int.sample_qcs.sesame.tsv

Per-sample quality-control summary

SeSAMe

output/methylation/protocol_example.methylation.sample_sheet_int.sesame.beta.tsv; output/methylation/protocol_example.methylation.sample_sheet_int.sesame.M.tsv

Probe-by-sample beta- and M-value tables

SeSAMe

output/methylation/protocol_example.methylation.sample_sheet_int.sesame.beta.bed.gz; output/methylation/protocol_example.methylation.sample_sheet_int.sesame.M.bed.gz

Indexed BED phenotype matrices

SeSAMe

output/methylation/protocol_example.methylation.sample_sheet_int.sesame.gene_id.annot.tsv

Probe-to-gene annotation

minfi

output/methylation_minfi/protocol_example.methylation.sample_sheet.minfi.rds

Serialized minfi result object

minfi

output/methylation_minfi/protocol_example.methylation.sample_sheet.minfi.beta.tsv; output/methylation_minfi/protocol_example.methylation.sample_sheet.minfi.M.tsv

Probe-by-sample beta- and M-value tables

minfi

output/methylation_minfi/protocol_example.methylation.sample_sheet.minfi.beta.bed.gz; output/methylation_minfi/protocol_example.methylation.sample_sheet.minfi.M.bed.gz

Indexed BED phenotype matrices

minfi

output/methylation_minfi/protocol_example.methylation.sample_sheet.minfi.gene_id.annot.tsv

Probe-to-gene annotation

Step 3

output/methylation/protocol_example.methylation.sample_sheet_int.sesame.M.filter_na.soft.bed.gz

Filtered and imputed M-value phenotype matrix

For the minfi route, give step 3 the minfi M-value BED path instead; the output keeps the minfi filename prefix.

Anticipated Results#

The selected calling route produces beta- and M-value matrices with probes in rows and samples in columns, together with sample QC and probe annotation files. After step 3, the M-value BED contains only retained probes and has no missing phenotype values, making it suitable for covariate preprocessing and methylation-QTL association testing.

Command interface#

sos run pipeline/methylation_calling.ipynb -h
sos run pipeline/phenotype_imputation.ipynb -h