Skip to content

Add DeepMAsED for deep learning evaluation of metagenomic de novo assemblies#1051

Open
SkyLexS wants to merge 33 commits into
nf-core:devfrom
SkyLexS:deep_mased_imp
Open

Add DeepMAsED for deep learning evaluation of metagenomic de novo assemblies#1051
SkyLexS wants to merge 33 commits into
nf-core:devfrom
SkyLexS:deep_mased_imp

Conversation

@SkyLexS

@SkyLexS SkyLexS commented Jun 17, 2026

Copy link
Copy Markdown

PR checklist

  • DeepMAsED features extracts alignment-based statistics from a BAM file and assembly FASTA to produce per-contig feature tables, which are then consumed by DeepMAsED predict to assign each contig a misassembly score between 0 (correctly assembled) and 1 (likely misassembly) using a pre-trained neural network.
  • If you've fixed a bug or added code that should be tested, add tests!
  • If you've added a new tool - have you followed the pipeline conventions in the contribution docs
  • If necessary, also make a PR on the nf-core/mag branch on the nf-core/test-datasets repository.
  • Make sure your code lints (nf-core pipelines lint).
  • Ensure the test suite passes (nextflow run . -profile test,docker --outdir <OUTDIR>).
  • Check for unexpected warnings in debug mode (nextflow run . -profile debug,test,docker --outdir <OUTDIR>).
  • Usage Documentation in docs/usage.md is updated.
  • Output Documentation in docs/output.md is updated.
  • CHANGELOG.md is updated.
  • README.md is updated (including new tool citations and authors/contributors).

@nf-core-bot

Copy link
Copy Markdown
Member

Warning

Newer version of the nf-core template is available.

Your pipeline is using an old version of the nf-core template: 3.5.2.
Please update your pipeline to the latest version.

For more documentation on how to update your pipeline, please see the nf-core documentation and Synchronisation documentation.

@jfy133 jfy133 changed the title Deep mased imp Add DeepMAsED for deep learning evaluation of metagenomic de novo assemblies Jun 18, 2026

@jfy133 jfy133 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial pass, but I leave the proper review to @dialvarezs :)

Comment thread conf/modules.config Outdated
Comment on lines +449 to +451
cpus = { 12 * task.attempt }
memory = { 120.GB * task.attempt }
time = { 96.h * task.attempt }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default resource requests should be moved to base.config

Comment thread conf/modules.config Outdated
cpus = { 12 * task.attempt }
memory = { 120.GB * task.attempt }
time = { 96.h * task.attempt }
ext.args = params.deepmased_features_gzip ? '--gzip' : ''

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At a minimum should be wrapped in a closure, see other sfor examples

Comment thread conf/modules.config Outdated
memory = { 120.GB * task.attempt }
time = { 96.h * task.attempt }
ext.args = params.deepmased_features_gzip ? '--gzip' : ''
containerOptions = '--shm-size=8g'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again something that should be in base.config ,but I worry about hardcoding such a thing - what is that exactly?

Comment thread conf/modules.config Outdated
memory = { 24.GB * task.attempt }
time = { 4.h * task.attempt }
ext.args = [ params.deepmased_cpu_only ? '--cpu-only' : '', "--seed ${params.deepmased_predict_seed}" ].join(' ').trim()
containerOptions = '--shm-size=8g'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comments as above

Comment thread docs/usage.md Outdated
Comment on lines +275 to +291
Per-contig assembly error detection is also performed using [DeepMAsED](https://github.com/leylabmpi/DeepMAsED), a deep learning tool that predicts misassemblies from read alignment features. DeepMAsED runs in two sequential steps:

1. **`DeepMAsED features`** (`DEEPMASED_FEATURES`): Extracts alignment-based features from the BAM file and assembly FASTA for each contig. This step is I/O intensive and is the most time-consuming part of the analysis, especially for large assemblies.
2. **`DeepMAsED predict`** (`DEEPMASED_PREDICT`): Runs the pre-trained deep learning model on the feature tables to produce a per-contig misassembly score (0 = correctly assembled, 1 = likely misassembly).

The two steps are implemented as separate modules, allowing Nextflow to resume from `predict` if `features` has already completed successfully. DeepMAsED only runs on short-read assemblies (MEGAHIT, SPAdes).

The following parameters control DeepMAsED execution:

| Parameter | Description |
| --------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| `--skip_deepmased` | Skip DeepMAsED entirely (both features and predict) |
| `--skip_deepmased_predict` | Run only the features step, skip prediction |
| `--skip_deepmased_features` | **Not allowed** unless `--skip_deepmased_predict` is also set — DeepMAsED predict requires features output |
| `--deepmased_cpu_only` | Run DeepMAsED predict in CPU-only mode. Default: `true` (recommended for HPC environments without GPU) |
| `--deepmased_features_gzip` | Gzip feature tables produced by the features step. Useful for large assemblies to reduce disk usage. Default: `false` |
| `--deepmased_predict_seed` | Random seed for numpy in DeepMAsED predict. Set for reproducible results. Default: `12` |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do'nt think any of thesea re related to repdocubility (the section it is in). I also feel it is a lot of partly unnecessary detail that can be derived from the tool's docs itself? At a minimum (if you want to keep them), move to the end under the 'Note on....' sections at teh bottom of this page.

Comment thread workflows/mag.nf Outdated
Comment on lines +322 to +323
ch_versions = ch_versions.mix(DEEPMASED_FEATURES.out.versions_deepmased.ifEmpty([]))
ch_versions = ch_versions.mix(DEEPMASED_FEATURES.out.versions_setuptools.ifEmpty([]))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ch_versions = ch_versions.mix(DEEPMASED_FEATURES.out.versions_deepmased.ifEmpty([]))
ch_versions = ch_versions.mix(DEEPMASED_FEATURES.out.versions_setuptools.ifEmpty([]))

Not needed when the module is using topics for version reporting

Comment thread workflows/mag.nf Outdated
Comment on lines +327 to +328
ch_versions = ch_versions.mix(DEEPMASED_PREDICT.out.versions_deepmased.ifEmpty([]))
ch_versions = ch_versions.mix(DEEPMASED_PREDICT.out.versions_setuptools.ifEmpty([]))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ch_versions = ch_versions.mix(DEEPMASED_PREDICT.out.versions_deepmased.ifEmpty([]))
ch_versions = ch_versions.mix(DEEPMASED_PREDICT.out.versions_setuptools.ifEmpty([]))

Not needed when the module is using topics for version reporting

Comment thread CHANGELOG.md Outdated
- [#1041](https://github.com/nf-core/mag/pull/1041) - Refined and corrected unclear section of metromap (by @jfy133)
- [#1044](https://github.com/nf-core/mag/pull/1044) - Add new `--gtdbtk_place_species` parameter (by @dialvarezs)
- [#1047](https://github.com/nf-core/mag/issues/1007) - Add `--gtdbtk_single_job` to run GTDB-Tk classification for all bins in a single job (requested by @sarah-shah-bioinf, by @dialvarezs)
- Add DeepMAsED assembly error detection to the MAG workflow as two sequential steps (`features` and `predict`) for short-read assemblies.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing PR number and your name

Comment thread CHANGELOG.md Outdated
Comment on lines +25 to +26
- Update DeepMAsED module tests to the current `sanitizeOutput(process.out)` snapshot pattern and regenerate snapshots.
- Update version aggregation compatibility to support topic-based module version tuples.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Update DeepMAsED module tests to the current `sanitizeOutput(process.out)` snapshot pattern and regenerate snapshots.
- Update version aggregation compatibility to support topic-based module version tuples.

The aggregation support should already be in through the template? Is that not the case? (and the cause of the stuff at the top)?

Comment thread CHANGELOG.md Outdated
- [#1021](https://github.com/nf-core/mag/pull/1021) - Prevent execution of `gtdbtk/summary` when no bins pass QC (reported by @jfy133, fix by @dialvarezs)
- [#1031](https://github.com/nf-core/mag/pull/1031) - Fix hybrid co-assembly with SPAdes (short & long reads with `--coassemble_group`) (fix by @d4straub)
- [#1049](https://github.com/nf-core/mag/pull/1049) - Fix publishing issue with `gtdbtk/classifywf` (by @dialvarezs)
- Validate DeepMAsED skip-parameter dependencies early, preventing invalid combinations where `predict` would run without `features` outputs.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Validate DeepMAsED skip-parameter dependencies early, preventing invalid combinations where `predict` would run without `features` outputs.

Not necessary as DeepMAsED is not in any past release ;)

SkyLexS and others added 3 commits June 21, 2026 02:26
… the nftignore because deepmased uses Deep Learning TensorFlow and when you run predictions for the same input the output could be of by one decimal and fail the test
@jfy133

jfy133 commented Jun 24, 2026

Copy link
Copy Markdown
Member

Still have test various failures due to variation in the snapshot...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants