This repository is a fork of the original MethylVerse/MPACT implementation with an added standalone execution script for batch processing of sequencing-derived methylation data.
The custom pipeline extends the original MPACT workflow with:
- Batch processing of multiple samples from directory structures
- Support for HVW (Human Variation Workflow) bed-format inputs
- Dual prediction modes (raw and regressed)
- Extended output reporting (top-3 class probabilities)
- Custom tumor decomposition implementation
- Centralized logging across runs
Location:
scripts/run_mpact.py
This script acts as a high-level pipeline wrapper around the core MPACT_process_raw functionality.
- Accepts HVW
.bedfiles - Converts to MPACT-compatible temporary format
- Automatically skips empty or invalid inputs
- Recursively scans directories for input files
- Iterates over all matching input files
- Maintains relative directory structure in output
- Skips completed samples unless
REPLACE=True
For each sample:
- Regressed predictions (after contamination removal)
- Raw predictions (no regression)
Outputs top 3 classes with probabilities for both modes.
-
Returns:
- Tumor purity
- Full component decomposition matrix
Per sample directory:
MPACT_regressed_probabilities.tsv
MPACT_raw_probabilities.tsv
MPACT_decomposition.tsv
MPACT_classifications.tsv
MPACT_cnvs.pdf (optional)
- Single universal log file per run
- Timestamped entries
- Captures stdout and stderr
Example:
script/run_mpact_YYYYMMDD_HHMMSS.log
Parameters are defined at the top of the script:
REPLACE = False
KEEP_TMP = False
IMPUTE = True
CALL_CNVS = False
VERBOSE = False
PROBABILITY_THRESHOLD = 0.7
MAX_CONTAMINATION_FRACTION = 0.5Paths:
DRIVE_DIR = Path("/mnt/x")
HVW_DIR = DRIVE_DIR / "Human variation workflow"
WORK_DIR = DRIVE_DIR / "Nanopore_classification/methylverse_MPACT"These should be adapted to the local environment.
conda create -n methylverse python=3.10 -y
conda activate methylverseconda install -c conda-forge -c bioconda \
pysam cython numpy scipy \
setuptools wheel compilers \
make autoconf automake libtool pkg-config \
zlib bzip2 xz libcurl openssl \
-ypython -m pip install -U pip
python -m pip install "setuptools<81" wheel poetry-corepython -m pip install ailist genome_infopython -m pip install --no-build-isolation ngsfragmentspython -m pip install torchpython -m pip install MethylVersepython -c "import ngsfragments, MethylVerse; print('Installation successful')"
python -m MethylVerse MPACT -hActivate environment:
conda activate methylverseRun pipeline:
python scripts/run_mpact.py- The script contains hard-coded paths and is intended for local execution.
- It is not integrated into the package API.
- Refactoring would be required for general-purpose distribution.