MEGPrep Documentation

MEGPrep Documentation#

MEGPrep is a reproducible Nextflow pipeline for large-scale MEG preprocessing, built on MNE-Python and designed for containerized local, cluster, and cohort-scale workflows.

It provides configurable continuous preprocessing, automated artifact detection, ICA-based cleaning, task or resting-state epoching, MEG-MRI coregistration, source reconstruction, and static quality-control reports.

Core Capabilities#

Reproducible Execution

Docker and Apptainer/Singularity workflows keep runtime environments consistent across workstations, servers, and clusters.

Configurable Preprocessing

Filtering, notch filtering, resampling, Maxwell filtering, artifact detection, ICA, epoching, and source settings are configured in one file.

Automated QC

Bad channels, bad segments, ICA components, coregistration distances, epoch rejection, and workflow completeness are summarized for review.

Task and Resting Data

The continuous preprocessing core is task independent, while optional epoching supports fixed-length resting windows, trigger events, or BIDS event files.

Anatomy and Source Modeling

FreeSurfer or DeepPrep outputs can be reused or generated before BEM, coregistration, forward modeling, and source reconstruction.

Portable Reports

Static HTML reports bundle subject pages, figures, sidecars, CSV files, JSON summaries, workflow metadata, and the effective config snapshot.

Where to Go Next#

Run Locally

Docker command structure, mounts, and common runtime options.

tutorial/tutorial_local.html
Run on a Cluster

SLURM and Singularity/Apptainer execution notes.

tutorial/tutorial_cluster.html
Full Workflow

Anatomy, epochs, covariance, coregistration, and source-level runs.

tutorial/full_workflow.html
Read QC Metrics

How report metrics are computed and how to interpret alarms.

reference/qc_metrics.html