DecoNFlow Pipeline¶
v3.0.0 - 2026-10-16¶
โ ๏ธ Breaking changes¶
- Minimum Nextflow version raised to 26.04.0. The pipeline is migrated to the Nextflow strict syntax and rebuilt on the nf-core template (nf-core/tools 4.1.0), with parameter validation through the
nf-schemaplugin. - Removed DMR selection methods: DMRfinder and wgbstools, together with the UXM deconvolution tool (
DMRfinderPrep,wgbstoolsanduxmsubworkflows and their modules, plus the bundled hg19 genome files inassets/genome/). Limma is now the only DMR selection method and the--DMRselectionparameter has been removed. - Removed parameters tied to the dropped tools:
--DMRselection,--merged_matrix,--ref_bams,--test_bams,--fasta,--groups_file,--uxm,--uxm_atlas,--dmrfinder_pvalue,--dmrfinder_qvalue,--max_bp,--min_cpg_uxm,--rlenand--only_hypo. - Renamed
--test_setto--bulk_samplesfor the samplesheet of the bulk samples to deconvolve. - Stricter parameter validation at launch:
--bulk_samplesis now required,--regions,--ref_matrixand--bulk_samplesmust point to existing files, and--direction,--collapse_method,--adj_methodand--prmeth_modonly accept their documented values.--clustersmust be at least 2 and--topat least 1. Values that used to fail midway through a run (e.g. a typo in--direction, which only failed at the limma step) are now rejected before anything runs. - Removed
--big_covsand--genome_order: the preprocessing now handles coverage files of any size without them (see Improvements), so the coverage files no longer need to be sorted and no genome file is needed. - limma DMR selection fits the model on M-values instead of beta values (
test_DMR.R). DMRs are still ranked and split into hyper/hypo by their delta beta, but the p-values, and therefore the DMRs passing--adjp, can differ from previous versions. To avoid infinite M-values, only the betas of 0 and 1 are clamped to [0.01, 0.99], instead of adding an offset to every beta.
๐ Improvements¶
- Effect size filter for the limma DMR selection (
--min_delta_beta,-moftest_DMR.R): DMRs passing the adjusted p-value threshold can also be required to have a minimum absolute delta beta, so that small but significant differences (e.g. in low-noise regions aggregating many CpGs) are removed. Disabled by default (0). When no DMR is left for a cell type, the error now names the cell type and the thresholds to relax. - Memory-efficient preprocessing of big coverage files (e.g. WGBS) in
PREPROCESSING,TEST_PREPROCESSING,CELFIE_PREPROCESSINGandREFREE_PREPROCESSING: the coverage file is now streamed throughbedtools intersect(-a) and only the regions (-b) are kept in memory, instead of the other way around, and the counts of each region are summed in a single pass. On 20 million CpGs the peak memory drops from 6.3 GB to 143 MB, with identical outputs. The coverage files no longer need to be sorted, so--big_covsand--genome_orderare no longer needed for any genome, and the filtered coverage files are no longer written to disk. - Reference matrices for CelFiE and MetDecode (
--celfie_ref_matrix,--metdecode_ref_matrix): each tool can use its own reference matrix of read counts (<cell type>_meth/<cell type>_depthcolumns, the atlas format of MetDecode) instead of the atlas built from the reference samples. The matrices are checked by a newPROCESS_COUNT_MATRIXmodule, the bulk samples are preprocessed on the regions of each matrix, and the reference samples, the limma DMR selection and the regions are only needed if a selected tool has no reference matrix of its own. Each selected tool uses one reference (its reference matrix if given, otherwise the reference samples), so--ref_matrixand--inputcan now be combined (e.g.--ref_matrixfor meth_atlas and--inputfor CelFiE), while giving--inputwhen every selected tool uses a reference matrix is an error. The ground truth (--ground_truth) is checked against each reference used. The atlas of read counts built from the reference samples is now built once and shared by CelFiE and MetDecode, and with--save_intermedsthe merged bulk samples of each tool are saved in its own results folder (reference_based/celfie,reference_based/metdecode). - CpG islands as regions (
--cgi_genome): instead of a regions file, the CpG islands ofhg19,hg38,mm10ormm39can be used as regions. They are downloaded from UCSC by a newCGI_REGIONSmodule, converted to the 1-based coordinates used by the pipeline and restricted to the primary chromosomes. Thanks to @wkgardner for the suggestion ([#5(https://github.com/VIBTOBIlab/DecoNFlow/issues/5)]). - Evaluation against a ground truth (
--ground_truth): if the expected cell type proportions of the bulk samples are provided, the report includes the MSE, RMSE and Spearman correlation of each reference-based tool, with an interactive plot of the estimated vs expected proportions (select the tools and cell types to show, with the metrics of the selection), and the metrics are saved inevaluation_metrics.csv. The cell types of the ground truth are checked against the reference when the pipeline starts. - MethylDackel bedGraph files (
.bedGraph/.bedGraph.gz, fromMethylDackel extract) are now accepted for the reference and bulk samples, in addition to Bismark coverage files (.cov/.cov.gz). A newFORMAT_COVERAGEmodule converts the MethylDackel positions (0-based) to the 1-based positions of the Bismark coverage files before the preprocessing, so both formats give the same results, and rejects bedGraph files without read counts (e.g. frombismark2bedGraph). The bulk samples are now read and converted once, instead of once for reference-based and once for reference-free deconvolution. - Renamed the main workflow from
DNAmDeconvtoDECONFLOWand the limma DMR selection subworkflow frominHousePreptomarkerSelection. Local modules and subworkflows now live inmodules/local/andsubworkflows/local/. - Limma marker selection now only runs when a reference-based tool needs the reference atlas. Reference-free runs (MeDeCom, RefFreeCellMix) no longer preprocess the reference samples or run limma.
- Updated the documentation, citations and README.
- New HTML report (
deconvolution_report.html,DECONV_REPORTmodule) with a per-sample comparison of all reference-based tools (stacked bars plus the mean, SD and range of each cell type across tools) and the results of each tool (stacked bars per sample and tables). - Reference-based and reference-free results are now saved separately, in
combined_results_refbased.csvandcombined_results_reffree.csv, instead of a singlecombined_results.csv. Reference-free tools estimate unlabelled components (e.g.LMC1,V1) rather than the cell types of the reference, so combining them in one table mixed unrelated columns.
๐ Bug fixes¶
- Regions file named
regions.bed: the limma DMR selection preprocessing wrote its sorted regions toregions.bed, overwriting a regions file (--regions) with that name and leaving every sample empty. - Reference matrix (
--ref_matrix) runs were always rejected by a faulty parameter check, which also required--regionsalthough the reference matrix route does not use it. Both now work as intended. - Reference-free runs without reference samples were rejected unless both MeDeCom and RefFreeCellMix were selected. A single reference-free tool can now be run with only
--bulk_samplesand--regions. - CelFiE and MetDecode with a reference matrix: they need read counts (the reference samples or their own reference matrix), so with only
--ref_matrix(including through--benchmark) they are now skipped with a warning instead of being silently dropped. The run fails with a clear error if no other tool is left. - Unused inputs: a warning is printed when
--inputor--ref_matrixis given but no reference-based tool is selected, and the reference matrix is no longer processed in that case. - Reference matrix check (
check_file.py): an invalid matrix now stops the run with the reason (it used to exit successfully and fail later with a missingreference.csv), and duplicated cell type names are now detected.
๐ง Maintenance¶
- Parameter checks are grouped in
validateInputParameters()(combinations of parameters) andnextflow_schema.json(single parameters), with the selected tools defined once and shared with theDECONFLOWworkflow. - Cleaned up and documented the helper scripts (
build_matrix.py,check_file.py,combine_files.py,intersect.py,merge_tables.py), with identical outputs. - Fixed the config type warnings in
nextflow.configandconf/base.config. - bedtools from bioconda:
FORMAT_COVERAGE,CGI_REGIONSand the preprocessing modules (PREPROCESSING,TEST_PREPROCESSING,CELFIE_PREPROCESSING,REFREE_PREPROCESSING) use the BioContainers image ofbioconda::bedtools==2.31.1(the Galaxy depot image with Singularity) instead of the customegiuili/bedtools_preprocessing:v2container (bedtools 2.29.2), with identical outputs, and acondadirective so they also run with-profile conda. bedtools 2.31.1 is the first version with conda packages for Apple Silicon (osx-arm64) and Linux on ARM (linux-aarch64). - pandas and limma from bioconda: the Python helper scripts (
RUN_DECONV,MERGE_TABLES,COMBINE_FILES,DECONV_REPORT,INTERSECT,MERGE_SAMPLES,PROCESS_COUNT_MATRIX,PROCESS_REF_MATRIX) use the BioContainers image ofconda-forge::pandas==1.5.2instead ofegiuili/python3-3.9.16:v1, andLIMMAusesbioconda::bioconductor-limma==3.62.1instead ofegiuili/r-v4.4.1:v1, with outputs identical to the previous containers. For this,celfie.pyno longer imports the unused bottleneck package,test_DMR.Rno longer depends on dplyr and tibble, and the Spearman correlation of the report is computed on the ranks with pandas instead of through scipy. - EpiDISH from bioconda:
EPIDISH,CIBERSORT,HOUSEMAN_EQandHOUSEMAN_INEQuse the BioContainers image ofbioconda::bioconductor-epidish==2.22.0instead ofegiuili/epidish:v1(EpiDISH 2.20.0), and the wrapper script is nowbin/EpiDISH.R. EpiDISH (RPC) and CIBERSORT (CBS) give identical results. Houseman's CP (HOUSEMAN_EQ,HOUSEMAN_INEQ) results change for bulk samples with missing regions: EpiDISH 2.20.0 built the quadratic term of the CP fit from all the reference regions instead of only those present in the sample, which EpiDISH 2.22.0 fixes. - Wrapper scripts in
bin/: the EpiSCORE, MethylResolver, MeDeCom and PRMeth/RefFreeCellMix wrappers (run_episcore.R,run_methylresolver.R,run_medecom.R,run_prmeth.R) are now versioned inbin/instead of being copied into their containers, which still provide the tools.PRMETHandREF_FREECELL_MIXnow share the samerun_prmeth.R(previously two versions inegiuili/prmeth:v2andv3). The code of the tools themselves is also inbin/: MetDecode (run_metdecode.pyand themetdecodepackage, MIT license, with the changes for the DecoNFlow file formats and fractions instead of percentages listed at the top ofrun_metdecode.pyandmetdecode/io.py), meth_atlas (run_deconv.py, with its Software Research License inbin/meth_atlas/README.md) and PRMeth (bin/PRMeth/R, unchanged, sourced byrun_prmeth.R). Their containers now only provide the dependencies, and the outputs are identical. - Conda environments (
environment.yml, following the nf-core module guidelines) forMETDECODE,METH_ATLAS,PRMETH,REF_FREECELL_MIX,EPISCOREandMETHYL_RESOLVER, with the versions of their containers, so that they also run with-profile conda(identical outputs to the containers). Thecondaandmambaprofiles are added back tonextflow.config, and the modules decompress the coverage files withgzip -dcinstead ofzcat, which only reads.Zfiles on macOS (busyboxzcat -fin the BioContainers images also did not pass uncompressed files through). For EpiSCORE (onlywRPC(), the function used) and MethylResolver, which are only available on GitHub, the R code is now inbin/EpiSCOREandbin/MethylResolverand sourced by their wrappers, so that their environments only list dependencies (EpiSCORE uses MASS 7.3-64, as conda-forge has no 7.3-61).MEDECOMstill needs its container, as MeDeCom has C++ code to compile: running it with conda (--medecom, or--benchmark) now stops at launch with an error.
๐งช Tests and CI¶
- End-to-end tests now use bulk samples (
--bulk_samples), and the snapshots have been updated. - New end-to-end tests for the reference matrix route (
tests/refmatrix.nf.test), including the CelFiE warning and error cases, and a module test forDECONV_REPORT. - The nf-test GitHub action now also runs on pushes to
main,masteranddev-refactoring(the previousbranch:trigger was invalid), and tests against Nextflow 26.04.0 andlatest-everything.
v2.5.0 - 2026-09-26¶
- Update the RefFreeCellMix module to also output the methylation components for downstream latent component analysis.
v2.4.0 - 2026-07-21¶
- Update the MeDeCom module to also output the entire object generated by MeDeCom package for latent component analysis.
v2.3.0 - 2025-11-03¶
- Changed the name from PRMeth_RF to the actual name RefFreeCellMix and added the corresponding citation.
- Added 2 new modules, being Houseman's CP equality and inequality. Before, to run these modalities you had to specify the --mod EpiDISH parameter. Now this parameter is deprecated and to run the above two tools you just have to specify the corresponding new flag --houseman_eq and --houseman_ineq.
- Changed the Docker container of CIBERSORT module with the EpiDISH container since EpiDISH package contains the CIBERSORT modality.
- Readapted the output directories and files in the modules/conf to have a more clear structure.
- Added tests on each individual module in the tests/modules/ folder.
- Added pipeline end-to-end tests and nf-test actions on PR and new release.
v2.2.0 - 2025-07-02¶
- Added the test profile to test the pipeline on public, test data.
- Removed unnecessary files from assets/ directory and updated the documentation.
v2.1.0 - 2025-06-18¶
๐ Bug Fixes¶
- Limma module:
Modified container and module to prevent errors when
--topexceeds the available number of DMRs.
- FINDMARKERS module:
Added the
--sort_by delta_meansflag. Previously, when using--only_hyper, markers were incorrectly sorted by chromosome location instead of delta means as intended. _Note: a GitHub issue should be opened in thewgbs_toolsrepository regarding this behavior.
- convert_atlas container:
Updated to properly handle the new entity structure (with
_) introduced in version 2.0.0.
- wgbstools subworkflow:
Adjusted to include
_in the entity structure to avoid processing errors.
- UXM subworkflow:
Added
params.ref_matrixto the conditional (if) gate, ensuring that the workflow proceeds when no DMR selection method is specified but a reference matrix is provided.
- Preprocessing modules:
Added
sort -T /tmp/to preventsortfrom using unavailable directories. See related discussion.
- CelFiE preprocessing:
Included missing
params.big_covsparameter.
๐ Minor Improvements¶
- MERGE_SAMPLES module:
Renamed the
stepparameter for clarity and consistency with the latest container version.
- Container cleanup:
Removed unnecessary containers and added a
/bindirectory for utility scripts.
- test_DMR.R script optimization:
Reduced container size by removing
tidyversefromtest_DMR.R, keeping onlytibbleanddplyr.
- Limma DMR selection:
Introduced
params.include_naparameter to allow merging of reference samples even when values are missing. This prevents excessive region filtering when the number of samples or entities is high.
- FINDMARKERS module:
Moved
topparameter outside the main script, now passed to the function only when explicitly defined (notnullorfalse).
- COMBINE_FILES module: Changed the way output files are combined: now files are linked directly using Nextflow, eliminating the need for volume bindings.
- Reference coverage option:
Added support to use reference coverage files (
--input) instead of rerunning thebismark_methylationextractionmodule. Applies when usingwgbstoolsfor DMR selection andmeth_atlas(or other tools except UXM) for deconvolution.
- Bulk sample filtering parameters:
Replaced
refree_min_countsandrefree_min_cpgswithbulk_min_countsandbulk_min_cpgsfor more flexible CpG and region filtering on bulk samples. By default they are both set to 0 (meaning, no filtering on the bulk samples).
๐ Updates to MetDecode & CelFiE Subworkflows¶
- Previously, only atlas markers present in all bulk samples were used for deconvolution.
- Now, if a marker is missing in any bulk sample, a value of 0 is assigned (instead of
NA) for both methylation and depth, ensuring smoother downstream processing.
v2.0.0 - 2024-12-26¶
Bugs fixed¶
- Thanks to @kaschoof, major bug has been fixed in the TEST_PROCESSING module that was grouping according to wrong columns when more than 2 cell types are specified in the atlas.
- Fixed problems with check_max function and base.config file not properly imported in nextflow.config
- Updated bedtools container version to the version 2.29.2 to fix a bug present in the previous version (see #643).
- Updated CelFiE container adding random seeds to make it generating reproducible results.
- Updated the PRMeth container to solve a bug on the number of cells (ncells) parameters when using the NMF modality.
- Updated nf-core schema plugin to version 2.2.0
- Changed the function to read the input file (from meta.clone() to def meta)
New features¶
- Added lib directory with two functions for parameters checking, string citations, string version, for dumping parameters .json file and for nfcore logo.
- Added DSS as an alternative DMR selection tool.
- Added UXM deconvolution tool, wgbs_tools as DMR selection tool and other modules to convert the structure from uxm-like to standard ref-based structure
- Added MetDecode tool
- Added possibility to start from a reference matrix already built.
- Added possibility to start from a merged matrix with reference samples on columns and regions on rows.
- In the entity column of the reference samples is now possible to include numbers.
Minor changes¶
- Restructuring of the pipeline structure
- Removed
merging_approachandchunk_sizeflags from the documentation (not used anymore). - Changed parameter custom of the flag
DMRselectioninto limma. - Added possibility of specifying "-sorted" and "-g" to the bedtools intersect in the preprocessing to keep the memory usage low when using big coverage files (e.g. WGBS covs).
- Sort the columns of the matrices in MERGE_SAMPLES module to make the files always the same
- Updated MERGE_SAMPLES container to always output sorted samples for reproducibility
- Added gitignore, pre-commit and CODEOWNERS for PR
- Added metromap to the README
- Added instituional config options
- Changed methyl_atlas into meth_atlas
- Added prefix chr check between region file and coverage files in limma preprocessing
v1.0.1 - 2024-07-26¶
Parameters changes¶
nsamplesparameter has been removed (it's now automatically computed)
Speed of the preprocessing¶
- The preprocessing of the reference and testing samples, including the preprocessing adopted in the reference-free tools, has been modified. It now uses bedtools and runs in bash. The preprocessing is now much faster (10x) and less computationally intensive (20x).
merge_samplescontainer and module has been added to merge all the files together once they have been preprocessed in order to give to the deconv tools the entire reference and testing matrix.
Input files validation¶
- The validation of the
inputandtest_setfiles has been moved in the DNAmDeconv workflow. Moreover, the samples are now being passed one by one to the preprocessing step: this allows parallelization of these steps, reduces the amount of memory needed and ultimately avoid run out of memory issues.
limma DMRs¶
Version two of the container has been released. With this version, it's now possible to perform DMR selection with even only one sample per group.
v1.0.0 - 2024-07-16¶
The DNAmDeconv pipeline is designed to perform DNA methylation deconvolution on bulk DNA samples. This pipeline uses a Nextflow framework to streamline and automate the analysis process, ensuring reproducible and efficient results.