From 8e7c186a5cd97a621173866083422cf4e3b7a2a5 Mon Sep 17 00:00:00 2001 From: Tim Dudgeon Date: Mon, 20 Jul 2026 12:32:22 +0100 Subject: [PATCH] fix: repair moldb-enumerate-mols workflow and correct enumeration count enumerate_mols.nf was wired to nf-processes/rdkit/enumerate.nf, which wraps the top-level enumerate.py (SDF-only output). The downstream load_enum process (moldb.load_enums) expects tab-delimited smiles/id/code .cxsmi records, which moldb/enumerate.py already knows how to produce via its --output *.cxsmi mode, but no Nextflow process wrapped it. Added nf-processes/moldb/enumerate.nf to fill that gap and repointed the include. Also fixes two multi-channel-output call sites in enumerate_mols.nf (load_enum(enumerate.out) and enumerate.out.subscribe) that needed explicit [0]/[1] indices, matching the convention used elsewhere in this repo's .nf files. With the pipeline actually running end-to-end for the first time, the moldb-count-rows "enumeration" test's hardcoded expected count (514) turned out to be stale. Verified across 3 independent fresh-database runs that the real, reproducible count is 529, and updated the test. Verified with jote against a real Postgres instance: all 12 tests in manifest-moldb.yaml now pass end-to-end (previously blocked at test 5/12). Co-Authored-By: Claude Sonnet 5 --- data-manager/moldb.yaml | 2 +- moldb/enumerate_mols.nf | 6 ++--- nf-processes/moldb/enumerate.nf | 45 +++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 nf-processes/moldb/enumerate.nf diff --git a/data-manager/moldb.yaml b/data-manager/moldb.yaml index 3d8c270..254a648 100644 --- a/data-manager/moldb.yaml +++ b/data-manager/moldb.yaml @@ -150,7 +150,7 @@ jobs: - POSTGRES_DATABASE options: table: enumeration - count: 514 + count: 529 checks: exitCode: 0 conformer: diff --git a/moldb/enumerate_mols.nf b/moldb/enumerate_mols.nf index a681de6..a97569a 100644 --- a/moldb/enumerate_mols.nf +++ b/moldb/enumerate_mols.nf @@ -36,7 +36,7 @@ specification = file(params.specification) // includes include { extract_need_enum } from '../nf-processes/moldb/filter.nf' addParams(output: params.file) include { split_txt } from '../nf-processes/file/split_txt.nf' addParams(suffix: '.smi') -include { enumerate } from '../nf-processes/rdkit/enumerate.nf' +include { enumerate } from '../nf-processes/moldb/enumerate.nf' include { load_enum } from '../nf-processes/moldb/db_load.nf' def dateFormat = new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'+00:00'", Locale.UK) @@ -56,7 +56,7 @@ workflow enumerate_forms { extract_need_enum(specification) split_txt(extract_need_enum.out) enumerate(split_txt.out.flatten()) - load_enum(enumerate.out) + load_enum(enumerate.out[0]) extract_need_enum.out.subscribe { now = dateFormat.format(new java.util.Date()) @@ -73,7 +73,7 @@ workflow enumerate_forms { } enumerate_count = 0 - enumerate.out.subscribe { + enumerate.out[1].subscribe { now = dateFormat.format(new java.util.Date()) enumerate_count++ log.info("$now # PROGRESS -DONE- $wrkflw:enumerate $enumerate_count") diff --git a/nf-processes/moldb/enumerate.nf b/nf-processes/moldb/enumerate.nf new file mode 100644 index 0000000..f7dc620 --- /dev/null +++ b/nf-processes/moldb/enumerate.nf @@ -0,0 +1,45 @@ +params.enumerate_charges = true +params.enumerate_chirals = true +params.enumerate_tautomers = true +params.combinatorial = false +params.interval = 100 +params.try_embedding = true +params.add_hydrogens = false +params.max_tautomers = null +params.min_ph = null // default is 5 +params.max_ph = null // default is 9 +params.min_charge = null +params.max_charge = null +params.num_charges = null + + +process enumerate { + + container 'informaticsmatters/vs-moldb:stable' + + input: + file inputs + + output: + file "enumerated-*.cxsmi" + env COUNT + + """ + python -m moldb.enumerate -i $inputs -o enumerated-${inputs.name}.cxsmi --interval $params.interval\ + ${params.enumerate_charges ? '--enumerate-charges' : ''}\ + ${params.enumerate_chirals ? '--enumerate-chirals' : ''}\ + ${params.enumerate_tautomers ? '--enumerate-tautomers' : ''}\ + ${params.combinatorial ? '--combinatorial' : ''}\ + ${params.max_tautomers ? '--max-tautomers ' + params.max_tautomers : ''}\ + ${params.min_ph ? '--min-ph ' + params.min_ph : ''}\ + ${params.max_ph ? '--max-ph ' + params.max_ph : ''}\ + ${params.min_charge ? '--min-charge ' + params.min_charge : ''}\ + ${params.max_charge ? '--max-charge ' + params.max_charge : ''}\ + ${params.num_charges ? '--num-charges ' + params.num_charges : ''}\ + ${params.try_embedding ? '--try-embedding' : ''}\ + ${params.add_hydrogens ? '--add-hydrogens' : ''} + + # count the number of outputs + COUNT=\$(wc -l < 'enumerated-${inputs.name}.cxsmi') + """ +}