From d41379063fa260526bf0e0f7898009d3f8a70a31 Mon Sep 17 00:00:00 2001 From: Nikhil Kumar Date: Thu, 4 Jun 2026 12:01:47 -0400 Subject: [PATCH] Update phylowgs multievolve to combine generation and write_results steps --- modules/msk/phylowgs/multievolve/main.nf | 18 +++++++ modules/msk/phylowgs/multievolve/meta.yml | 30 ++++++++++++ .../phylowgs/multievolve/tests/main.nf.test | 10 +++- .../multievolve/tests/main.nf.test.snap | 47 +++++++------------ subworkflows/msk/phylowgs/main.nf | 10 ++-- 5 files changed, 77 insertions(+), 38 deletions(-) diff --git a/modules/msk/phylowgs/multievolve/main.nf b/modules/msk/phylowgs/multievolve/main.nf index a821b664..cbd42f60 100644 --- a/modules/msk/phylowgs/multievolve/main.nf +++ b/modules/msk/phylowgs/multievolve/main.nf @@ -10,6 +10,9 @@ process PHYLOWGS_MULTIEVOLVE { output: tuple val(meta), path("chains/trees.zip") , emit: trees + tuple val(meta), path("*.summ.json.gz") , emit: summ + tuple val(meta), path("*.muts.json.gz") , emit: muts + tuple val(meta), path("*.mutass.zip") , emit: mutass path "versions.yml" , emit: versions when: @@ -17,6 +20,7 @@ process PHYLOWGS_MULTIEVOLVE { script: def args = task.ext.args ?: '' + def args2 = task.ext.args2 ?: '' def prefix = task.ext.prefix ?: "${meta.id}" """ @@ -26,6 +30,16 @@ process PHYLOWGS_MULTIEVOLVE { --ssms ${ssm_data} \\ --cnvs ${cnv_data} + python2 \\ + /usr/bin/phylowgs/write_results.py \\ + ${args2} \\ + --include-ssm-names \\ + ${prefix} \\ + chains/trees.zip \\ + ${prefix}.summ.json.gz \\ + ${prefix}.muts.json.gz \\ + ${prefix}.mutass.zip + cat <<-END_VERSIONS > versions.yml "${task.process}": phylowgs: \$PHYLOWGS_TAG @@ -34,10 +48,14 @@ process PHYLOWGS_MULTIEVOLVE { stub: def args = task.ext.args ?: '' + def args2 = task.ext.args2 ?: '' def prefix = task.ext.prefix ?: "${meta.id}" """ mkdir chains touch chains/trees.zip + touch ${prefix}.summ.json.gz + touch ${prefix}.muts.json.gz + touch ${prefix}.mutass.zip cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/msk/phylowgs/multievolve/meta.yml b/modules/msk/phylowgs/multievolve/meta.yml index 68e290b1..442910ac 100644 --- a/modules/msk/phylowgs/multievolve/meta.yml +++ b/modules/msk/phylowgs/multievolve/meta.yml @@ -37,6 +37,36 @@ output: type: file description: Zip file containing the completed trees pattern: "trees.zip" + - summ: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.summ.json.gz": + type: file + description: Output file for JSON-formatted tree summaries + pattern: "*.summ.json.gz" + - muts: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.muts.json.gz": + type: file + description: Output file for JSON-formatted list of mutations + pattern: "*.muts.json.gz" + - mutass: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.mutass.zip": + type: file + description: Output file for JSON-formatted list of SSMs and CNVs + pattern: "*.mutass.zip" - versions: - versions.yml: type: file diff --git a/modules/msk/phylowgs/multievolve/tests/main.nf.test b/modules/msk/phylowgs/multievolve/tests/main.nf.test index c7d4c610..a10b6685 100644 --- a/modules/msk/phylowgs/multievolve/tests/main.nf.test +++ b/modules/msk/phylowgs/multievolve/tests/main.nf.test @@ -28,7 +28,10 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(file(process.out.trees[0][1]).name).match() } + { assert snapshot(file(process.out.trees[0][1]).name, + file(process.out.summ[0][1]).name, + file(process.out.muts[0][1]).name, + file(process.out.mutass[0][1]).name).match() } ) } @@ -54,7 +57,10 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out).match() } + { assert snapshot(file(process.out.trees[0][1]).name, + file(process.out.summ[0][1]).name, + file(process.out.muts[0][1]).name, + file(process.out.mutass[0][1]).name).match() } ) } diff --git a/modules/msk/phylowgs/multievolve/tests/main.nf.test.snap b/modules/msk/phylowgs/multievolve/tests/main.nf.test.snap index b7c9029f..17a7813a 100644 --- a/modules/msk/phylowgs/multievolve/tests/main.nf.test.snap +++ b/modules/msk/phylowgs/multievolve/tests/main.nf.test.snap @@ -1,39 +1,28 @@ { "phylowgs_multievolve - zip": { "content": [ - "trees.zip" + "trees.zip", + "test.summ.json.gz", + "test.muts.json.gz", + "test.mutass.zip" ], - "timestamp": "2024-06-11T18:01:56.174868" + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.4" + }, + "timestamp": "2026-06-04T11:48:34.725751" }, "phylowgs_multievolve - zip - stub": { "content": [ - { - "0": [ - [ - { - "id": "test", - "single_end": false - }, - "trees.zip:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "1": [ - "versions.yml:md5,2eaafdf0e85898fdc2e5d40dbbfee2f7" - ], - "trees": [ - [ - { - "id": "test", - "single_end": false - }, - "trees.zip:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "versions": [ - "versions.yml:md5,2eaafdf0e85898fdc2e5d40dbbfee2f7" - ] - } + "trees.zip", + "test.summ.json.gz", + "test.muts.json.gz", + "test.mutass.zip" ], - "timestamp": "2024-06-11T18:02:03.678335" + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.4" + }, + "timestamp": "2026-06-04T11:56:11.007179" } } \ No newline at end of file diff --git a/subworkflows/msk/phylowgs/main.nf b/subworkflows/msk/phylowgs/main.nf index 6c650cf3..990663aa 100644 --- a/subworkflows/msk/phylowgs/main.nf +++ b/subworkflows/msk/phylowgs/main.nf @@ -36,16 +36,12 @@ workflow PHYLOWGS { ch_versions = ch_versions.mix(PHYLOWGS_MULTIEVOLVE.out.versions) - PHYLOWGS_WRITERESULTS(PHYLOWGS_MULTIEVOLVE.out.trees) - - ch_versions = ch_versions.mix(PHYLOWGS_WRITERESULTS.out.versions) - emit: - summ = PHYLOWGS_WRITERESULTS.out.summ // channel: [ val(meta), [ summ ] ] - muts = PHYLOWGS_WRITERESULTS.out.muts // channel: [ val(meta), [ muts ] ] - mutass = PHYLOWGS_WRITERESULTS.out.mutass // channel: [ val(meta), [ mutass ] ] + summ = PHYLOWGS_MULTIEVOLVE.out.summ // channel: [ val(meta), [ summ ] ] + muts = PHYLOWGS_MULTIEVOLVE.out.muts // channel: [ val(meta), [ muts ] ] + mutass = PHYLOWGS_MULTIEVOLVE.out.mutass // channel: [ val(meta), [ mutass ] ] versions = ch_versions // channel: [ versions.yml ] }