From 25b2862c6b0aa9608784bee72ffb9d1347a3ef1d Mon Sep 17 00:00:00 2001 From: Luisa Santus Date: Wed, 29 Jan 2025 10:55:19 +0000 Subject: [PATCH 1/8] up --- .../nf-core/learnmsa/align/environment.yml | 6 ---- modules/nf-core/learnmsa/align/main.nf | 16 +++++---- .../nf-core/learnmsa/align/tests/main.nf.test | 36 +++++++++++++++---- 3 files changed, 39 insertions(+), 19 deletions(-) delete mode 100644 modules/nf-core/learnmsa/align/environment.yml diff --git a/modules/nf-core/learnmsa/align/environment.yml b/modules/nf-core/learnmsa/align/environment.yml deleted file mode 100644 index 1c1d69fd765..00000000000 --- a/modules/nf-core/learnmsa/align/environment.yml +++ /dev/null @@ -1,6 +0,0 @@ -channels: - - conda-forge - - bioconda -dependencies: - - bioconda::learnmsa=2.0.1 - - conda-forge::pigz=2.8 diff --git a/modules/nf-core/learnmsa/align/main.nf b/modules/nf-core/learnmsa/align/main.nf index 304fb07ced6..f938ec837ad 100644 --- a/modules/nf-core/learnmsa/align/main.nf +++ b/modules/nf-core/learnmsa/align/main.nf @@ -2,10 +2,12 @@ process LEARNMSA_ALIGN { tag "$meta.id" label 'process_medium' - conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/mulled-v2-741e0da5cf2d6d964f559672e2908c2111cbb46b:4930edd009376542543bfd2e20008bb1ae58f841-0' : - 'biocontainers/mulled-v2-741e0da5cf2d6d964f559672e2908c2111cbb46b:4930edd009376542543bfd2e20008bb1ae58f841-0' }" + // Exit if running this module with -profile conda / -profile mamba + if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { + error("LearnMSA align module does not support Conda. Please use Docker / Singularity / Podman instead.") + } + + container "registry.hub.docker.com/felbecker/learnmsa:2.0.9" input: tuple val(meta), path(fasta) @@ -24,9 +26,9 @@ process LEARNMSA_ALIGN { def write_output = compress ? ">(pigz -cp ${task.cpus} > ${prefix}.aln.gz)" : "${prefix}.aln" """ learnMSA \\ - $args \\ - -i <(unpigz -cdf $fasta) \\ - -o $write_output + -i $fasta \\ + -o $write_output \\ + $args cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/learnmsa/align/tests/main.nf.test b/modules/nf-core/learnmsa/align/tests/main.nf.test index 8459ead38d5..4e47666aff3 100644 --- a/modules/nf-core/learnmsa/align/tests/main.nf.test +++ b/modules/nf-core/learnmsa/align/tests/main.nf.test @@ -10,13 +10,13 @@ nextflow_process { tag "learnmsa" tag "learnmsa/align" - test("sarscov2 - fasta - uncompressed") { + test("seatoxin - uncompressed") { when { process { """ - input[0] = [ [ id:'test' ], // meta map - file(params.test_data['sarscov2']['genome']['informative_sites_fas'], checkIfExists: true) + input[0] = [ [ id:'test' ], + file(params.modules_testdata_base_path + "../../multiplesequencealign/testdata/setoxin-ref.fa", checkIfExists: true) ] input[1] = false """ @@ -33,13 +33,13 @@ nextflow_process { } - test("sarscov2 - fasta - compressed") { + test("seatoxin - compressed") { when { process { """ - input[0] = [ [ id:'test' ], // meta map - file(params.test_data['sarscov2']['genome']['informative_sites_fas'], checkIfExists: true) + input[0] = [ [ id:'test' ], + file(params.modules_testdata_base_path + "../../multiplesequencealign/testdata/setoxin-ref.fa", checkIfExists: true) ] input[1] = true """ @@ -56,4 +56,28 @@ nextflow_process { } + test("seatoxin - uncompressed - stub") { + options "-stub" + + when { + process { + """ + input[0] = [ [ id:'test' ], + file(params.modules_testdata_base_path + "../../multiplesequencealign/testdata/setoxin-ref.fa", checkIfExists: true) + ] + input[1] = false + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert path(process.out.alignment.get(0).get(1)).getText().contains(">sample1") }, + { assert snapshot(process.out.versions).match("versions") } + ) + } + + } + } \ No newline at end of file From 0de5ac9057accddcba187ad1a6012101d23fa22f Mon Sep 17 00:00:00 2001 From: Luisa Santus Date: Fri, 31 Jan 2025 13:53:14 +0000 Subject: [PATCH 2/8] Add progress --- modules/nf-core/learnmsa/align/main.nf | 12 ++--- modules/nf-core/learnmsa/align/meta.yml | 5 -- .../nf-core/learnmsa/align/tests/main.nf.test | 54 ++----------------- .../learnmsa/align/tests/main.nf.test.snap | 47 +++++++++------- .../learnmsa/align/tests/nextflow.config | 3 ++ 5 files changed, 39 insertions(+), 82 deletions(-) create mode 100644 modules/nf-core/learnmsa/align/tests/nextflow.config diff --git a/modules/nf-core/learnmsa/align/main.nf b/modules/nf-core/learnmsa/align/main.nf index f938ec837ad..c1342f34edc 100644 --- a/modules/nf-core/learnmsa/align/main.nf +++ b/modules/nf-core/learnmsa/align/main.nf @@ -2,7 +2,7 @@ process LEARNMSA_ALIGN { tag "$meta.id" label 'process_medium' - // Exit if running this module with -profile conda / -profile mamba + // //Exit if running this module with -profile conda / -profile mamba if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { error("LearnMSA align module does not support Conda. Please use Docker / Singularity / Podman instead.") } @@ -11,7 +11,6 @@ process LEARNMSA_ALIGN { input: tuple val(meta), path(fasta) - val(compress) output: tuple val(meta), path("*.aln{.gz,}"), emit: alignment @@ -23,17 +22,15 @@ process LEARNMSA_ALIGN { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def write_output = compress ? ">(pigz -cp ${task.cpus} > ${prefix}.aln.gz)" : "${prefix}.aln" """ learnMSA \\ -i $fasta \\ - -o $write_output \\ + -o "${prefix}.aln" \\ $args cat <<-END_VERSIONS > versions.yml "${task.process}": learnmsa: \$(learnMSA -h | grep 'version' | awk -F 'version ' '{print \$2}' | awk '{print \$1}' | sed 's/)//g') - pigz: \$(echo \$(pigz --version 2>&1) | sed 's/^.*pigz\\w*//' )) END_VERSIONS """ @@ -41,12 +38,11 @@ process LEARNMSA_ALIGN { def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" """ - touch ${prefix}.aln${compress ? '.gz' : ''} + touch ${prefix}.aln cat <<-END_VERSIONS > versions.yml "${task.process}": - learnmsa: \$(learnMSA -h | grep 'version' | awk -F 'version ' '{print \$2}' | awk '{print \$1}' | sed 's/)//g') - pigz: \$(echo \$(pigz --version 2>&1) | sed 's/^.*pigz\\w*//' )) + learnmsa: \$(if command -v learnMSA &>/dev/null; then learnMSA -h | grep 'version' | awk -F 'version ' '{print \$2}' | awk '{print \$1}' | sed 's/)//g'; else echo "STUB_TEST_HARDCODED_VERSION"; fi) END_VERSIONS """ } diff --git a/modules/nf-core/learnmsa/align/meta.yml b/modules/nf-core/learnmsa/align/meta.yml index b3e549fea7b..6b9114621ad 100644 --- a/modules/nf-core/learnmsa/align/meta.yml +++ b/modules/nf-core/learnmsa/align/meta.yml @@ -23,11 +23,6 @@ input: type: file description: Input sequences in FASTA format. May be gz-compressed or uncompressed. pattern: "*.{fa,fasta}{.gz,}" - - - compress: - type: boolean - description: Flag representing whether the output MSA should be compressed. - Set to true to enable/false to disable compression. Compression is done using - pigz, and is multithreaded. output: - alignment: - meta: diff --git a/modules/nf-core/learnmsa/align/tests/main.nf.test b/modules/nf-core/learnmsa/align/tests/main.nf.test index 4e47666aff3..9432414fbaa 100644 --- a/modules/nf-core/learnmsa/align/tests/main.nf.test +++ b/modules/nf-core/learnmsa/align/tests/main.nf.test @@ -2,6 +2,7 @@ nextflow_process { name "Test Process LEARNMSA_ALIGN" + config "./nextflow.config" script "../main.nf" process "LEARNMSA_ALIGN" @@ -10,53 +11,7 @@ nextflow_process { tag "learnmsa" tag "learnmsa/align" - test("seatoxin - uncompressed") { - - when { - process { - """ - input[0] = [ [ id:'test' ], - file(params.modules_testdata_base_path + "../../multiplesequencealign/testdata/setoxin-ref.fa", checkIfExists: true) - ] - input[1] = false - """ - } - } - - then { - assertAll( - { assert process.success }, - { assert path(process.out.alignment.get(0).get(1)).getText().contains(">sample1") }, - { assert snapshot(process.out.versions).match("versions") } - ) - } - - } - - test("seatoxin - compressed") { - - when { - process { - """ - input[0] = [ [ id:'test' ], - file(params.modules_testdata_base_path + "../../multiplesequencealign/testdata/setoxin-ref.fa", checkIfExists: true) - ] - input[1] = true - """ - } - } - - then { - assertAll( - { assert process.success }, - { assert path(process.out.alignment.get(0).get(1)).getTextGzip().contains(">sample1") }, - { assert snapshot(process.out.versions).match("versions1") } - ) - } - - } - - test("seatoxin - uncompressed - stub") { + test("seatoxin - stub") { options "-stub" when { @@ -65,7 +20,6 @@ nextflow_process { input[0] = [ [ id:'test' ], file(params.modules_testdata_base_path + "../../multiplesequencealign/testdata/setoxin-ref.fa", checkIfExists: true) ] - input[1] = false """ } } @@ -73,8 +27,8 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert path(process.out.alignment.get(0).get(1)).getText().contains(">sample1") }, - { assert snapshot(process.out.versions).match("versions") } + { assert snapshot ( process.out ).match() } + ) } diff --git a/modules/nf-core/learnmsa/align/tests/main.nf.test.snap b/modules/nf-core/learnmsa/align/tests/main.nf.test.snap index 981738a276d..5c54c14416e 100644 --- a/modules/nf-core/learnmsa/align/tests/main.nf.test.snap +++ b/modules/nf-core/learnmsa/align/tests/main.nf.test.snap @@ -1,26 +1,35 @@ { - "versions": { + "seatoxin - stub": { "content": [ - [ - "versions.yml:md5,85322b0f038aa768f202fd0d748d6c7c" - ] + { + "0": [ + [ + { + "id": "test" + }, + "test.aln:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,c3886d32309d141ad22aba3a8a119d62" + ], + "alignment": [ + [ + { + "id": "test" + }, + "test.aln:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,c3886d32309d141ad22aba3a8a119d62" + ] + } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "24.10.4" }, - "timestamp": "2024-03-20T16:06:48.867020809" - }, - "versions1": { - "content": [ - [ - "versions.yml:md5,85322b0f038aa768f202fd0d748d6c7c" - ] - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" - }, - "timestamp": "2024-03-20T16:12:13.921813607" + "timestamp": "2025-01-31T13:29:53.669503397" } } \ No newline at end of file diff --git a/modules/nf-core/learnmsa/align/tests/nextflow.config b/modules/nf-core/learnmsa/align/tests/nextflow.config new file mode 100644 index 00000000000..7e64bb248d5 --- /dev/null +++ b/modules/nf-core/learnmsa/align/tests/nextflow.config @@ -0,0 +1,3 @@ +process { + container = "nf-core/ubuntu:22.04" +} From cd9dd04d7f9a3672dd821c43b873752c6b6925fb Mon Sep 17 00:00:00 2001 From: Luisa Santus Date: Fri, 31 Jan 2025 14:04:28 +0000 Subject: [PATCH 3/8] update config --- modules/nf-core/learnmsa/align/tests/nextflow.config | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/nf-core/learnmsa/align/tests/nextflow.config b/modules/nf-core/learnmsa/align/tests/nextflow.config index 7e64bb248d5..7df631fdf79 100644 --- a/modules/nf-core/learnmsa/align/tests/nextflow.config +++ b/modules/nf-core/learnmsa/align/tests/nextflow.config @@ -1,3 +1,5 @@ process { - container = "nf-core/ubuntu:22.04" + withName: LEARNMSA_ALIGN{ + container = "nf-core/ubuntu:22.04" + } } From 5cfac19a42f0129d8c2fcfc05d1d25fe42ecf78c Mon Sep 17 00:00:00 2001 From: Luisa Santus Date: Fri, 31 Jan 2025 14:28:59 +0000 Subject: [PATCH 4/8] fix warning --- modules/nf-core/learnmsa/align/environment.yaml | 3 +++ modules/nf-core/learnmsa/align/main.nf | 9 +++------ 2 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 modules/nf-core/learnmsa/align/environment.yaml diff --git a/modules/nf-core/learnmsa/align/environment.yaml b/modules/nf-core/learnmsa/align/environment.yaml new file mode 100644 index 00000000000..3cebeff05bf --- /dev/null +++ b/modules/nf-core/learnmsa/align/environment.yaml @@ -0,0 +1,3 @@ +channels: + - conda-forge + - bioconda diff --git a/modules/nf-core/learnmsa/align/main.nf b/modules/nf-core/learnmsa/align/main.nf index c1342f34edc..6e08400fbc0 100644 --- a/modules/nf-core/learnmsa/align/main.nf +++ b/modules/nf-core/learnmsa/align/main.nf @@ -1,12 +1,6 @@ process LEARNMSA_ALIGN { tag "$meta.id" label 'process_medium' - - // //Exit if running this module with -profile conda / -profile mamba - if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { - error("LearnMSA align module does not support Conda. Please use Docker / Singularity / Podman instead.") - } - container "registry.hub.docker.com/felbecker/learnmsa:2.0.9" input: @@ -22,6 +16,9 @@ process LEARNMSA_ALIGN { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { + error("LearnMSA align module does not support Conda. Please use Docker / Singularity / Podman instead.") + } """ learnMSA \\ -i $fasta \\ From af3c78d96417ed249522debb2dec4561ab32d00f Mon Sep 17 00:00:00 2001 From: Luisa Santus Date: Fri, 31 Jan 2025 14:50:36 +0000 Subject: [PATCH 5/8] up --- modules/nf-core/learnmsa/align/tests/nextflow.config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/nf-core/learnmsa/align/tests/nextflow.config b/modules/nf-core/learnmsa/align/tests/nextflow.config index 7df631fdf79..dbc909d4fff 100644 --- a/modules/nf-core/learnmsa/align/tests/nextflow.config +++ b/modules/nf-core/learnmsa/align/tests/nextflow.config @@ -1,5 +1,7 @@ process { + withName: LEARNMSA_ALIGN{ container = "nf-core/ubuntu:22.04" } + } From e78ddd5ea88bb695b0365e0f610a2e7197bcaf2d Mon Sep 17 00:00:00 2001 From: Luisa Santus Date: Fri, 31 Jan 2025 16:07:35 +0000 Subject: [PATCH 6/8] fix yml --- .../align/{environment.yaml => environment.yml} | 0 modules/nf-core/learnmsa/align/main.nf | 2 +- modules/nf-core/learnmsa/align/meta.yml | 10 +++++----- 3 files changed, 6 insertions(+), 6 deletions(-) rename modules/nf-core/learnmsa/align/{environment.yaml => environment.yml} (100%) diff --git a/modules/nf-core/learnmsa/align/environment.yaml b/modules/nf-core/learnmsa/align/environment.yml similarity index 100% rename from modules/nf-core/learnmsa/align/environment.yaml rename to modules/nf-core/learnmsa/align/environment.yml diff --git a/modules/nf-core/learnmsa/align/main.nf b/modules/nf-core/learnmsa/align/main.nf index 6e08400fbc0..a16f56259bd 100644 --- a/modules/nf-core/learnmsa/align/main.nf +++ b/modules/nf-core/learnmsa/align/main.nf @@ -7,7 +7,7 @@ process LEARNMSA_ALIGN { tuple val(meta), path(fasta) output: - tuple val(meta), path("*.aln{.gz,}"), emit: alignment + tuple val(meta), path("*.aln"), emit: alignment path "versions.yml" , emit: versions when: diff --git a/modules/nf-core/learnmsa/align/meta.yml b/modules/nf-core/learnmsa/align/meta.yml index 6b9114621ad..7cd4a63c4ee 100644 --- a/modules/nf-core/learnmsa/align/meta.yml +++ b/modules/nf-core/learnmsa/align/meta.yml @@ -21,8 +21,8 @@ input: e.g. `[ id:'test']` - fasta: type: file - description: Input sequences in FASTA format. May be gz-compressed or uncompressed. - pattern: "*.{fa,fasta}{.gz,}" + description: Input sequences in FASTA format. + pattern: "*.{fa,fasta}" output: - alignment: - meta: @@ -30,10 +30,10 @@ output: description: | Groovy Map containing sample information e.g. `[ id:'test']` - - "*.aln{.gz,}": + - "*.aln": type: file - description: Alignment file, in FASTA format. May be gzipped or uncompressed. - pattern: "*.aln{.gz,}" + description: Alignment file, in FASTA format. + pattern: "*.aln" - versions: - versions.yml: type: file From 671eb7f06166c7b9066a8346d7cd76ec96549276 Mon Sep 17 00:00:00 2001 From: Luisa Santus Date: Fri, 31 Jan 2025 16:08:17 +0000 Subject: [PATCH 7/8] fix yml --- modules/nf-core/learnmsa/align/main.nf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/nf-core/learnmsa/align/main.nf b/modules/nf-core/learnmsa/align/main.nf index a16f56259bd..c9d40fd7221 100644 --- a/modules/nf-core/learnmsa/align/main.nf +++ b/modules/nf-core/learnmsa/align/main.nf @@ -7,14 +7,14 @@ process LEARNMSA_ALIGN { tuple val(meta), path(fasta) output: - tuple val(meta), path("*.aln"), emit: alignment + tuple val(meta), path("*.aln") , emit: alignment path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when script: - def args = task.ext.args ?: '' + def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { error("LearnMSA align module does not support Conda. Please use Docker / Singularity / Podman instead.") From 9a91a92c3eea29aa4cfcc3aa039d4213db2bfb9a Mon Sep 17 00:00:00 2001 From: Luisa Santus Date: Fri, 31 Jan 2025 16:16:11 +0000 Subject: [PATCH 8/8] fix yml --- modules/nf-core/learnmsa/align/environment.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/nf-core/learnmsa/align/environment.yml b/modules/nf-core/learnmsa/align/environment.yml index 3cebeff05bf..71e04c3d719 100644 --- a/modules/nf-core/learnmsa/align/environment.yml +++ b/modules/nf-core/learnmsa/align/environment.yml @@ -1,3 +1,5 @@ channels: - conda-forge - bioconda +dependencies: + - conda-forge::coreutils=9.5