diff --git a/modules/nf-core/snakemake/environment.yml b/modules/nf-core/snakemake/environment.yml index 39223df49ef0..66b1e8576593 100644 --- a/modules/nf-core/snakemake/environment.yml +++ b/modules/nf-core/snakemake/environment.yml @@ -4,4 +4,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::snakemake=7.31.0 + - bioconda::snakemake=9.14.0 diff --git a/modules/nf-core/snakemake/main.nf b/modules/nf-core/snakemake/main.nf index d5cccdef9657..1b3acf6c5f8b 100644 --- a/modules/nf-core/snakemake/main.nf +++ b/modules/nf-core/snakemake/main.nf @@ -1,56 +1,51 @@ process SNAKEMAKE { - tag "$meta.id" + tag "${meta.id}" label 'process_low' // You will have to add all modules to this Conda definition and // replace the container definition for one that suits your needs conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/snakemake:7.31.0--hdfd78af_1' : - 'biocontainers/snakemake:7.31.0--hdfd78af_1' }" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/b9/b91b2eddb4c4c0a5e17721d29764e59a50035b9fa9996eb9cb392829f2d7a533/data' + : 'community.wave.seqera.io/library/snakemake:9.14.0--dfee75b6201d25c6'}" input: tuple val(meta), path(inputs) tuple val(meta2), path(snakefile) output: - tuple val(meta), path("[!.snakemake|versions.yml]**") , emit: outputs , optional: true + tuple val(meta), path("[!.snakemake|versions.yml]**"), emit: outputs, optional: true tuple val(meta), path(".snakemake", type: 'dir', hidden: true), emit: snakemake_dir - path "versions.yml" , emit: versions + tuple val("${task.process}"), val("snakemake"), eval('snakemake --version'), topic: versions, emit: versions_snakemake when: task.ext.when == null || task.ext.when script: - def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" - def cores = task.cpus ? "--cores ${task.cpus}" : "--cores all" + def args = task.ext.args ?: '' + def cores = task.cpus ? "--cores ${task.cpus}" : "--cores all" """ + export XDG_CACHE_HOME=\$PWD/snakemake_cache + mkdir -p \$XDG_CACHE_HOME + snakemake \\ - $args \\ - $cores \\ - --snakefile $snakefile - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - snakemake: \$(snakemake --version) - END_VERSIONS + ${args} \\ + ${cores} \\ + --snakefile ${snakefile} """ + stub: - def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" - def cores = task.cpus ? "--cores ${task.cpus}" : "--cores all" + def args = task.ext.args ?: '' + def cores = task.cpus ? "--cores ${task.cpus}" : "--cores all" """ + export XDG_CACHE_HOME=\$PWD/snakemake_cache + mkdir -p \$XDG_CACHE_HOME + snakemake \\ - $args \\ - --snakefile $snakefile \\ - $cores \\ + ${args} \\ + --snakefile ${snakefile} \\ + ${cores} \\ --dry-run - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - snakemake: \$(snakemake --version) - END_VERSIONS """ } diff --git a/modules/nf-core/snakemake/meta.yml b/modules/nf-core/snakemake/meta.yml index 2db26afda00f..71d94dd4609f 100644 --- a/modules/nf-core/snakemake/meta.yml +++ b/modules/nf-core/snakemake/meta.yml @@ -1,8 +1,7 @@ -# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/yaml-schema.json name: "snakemake" -description: The Snakemake workflow management system is a tool to create reproducible - and scalable data analyses. This module runs a simple Snakemake pipeline based on - input snakefile. Expect many limitations." +description: The Snakemake workflow management system is a tool to create + reproducible and scalable data analyses. This module runs a simple Snakemake + pipeline based on input snakefile. Expect many limitations." keywords: - snakemake - workflow @@ -39,7 +38,6 @@ input: Snakefile to use with Snakemake. This is required for proper execution of Snakemake. ontologies: [] output: - #Only when we have meta outputs: - - meta: type: map @@ -59,16 +57,31 @@ output: e.g. [ id:'test', single_end:false ] - .snakemake: type: directory - description: Hidden directory containing Snakemake execution logs and metadata + description: Hidden directory containing Snakemake execution logs and + metadata pattern: ".snakemake" ontologies: [] + versions_snakemake: + - - ${task.process}: + type: string + description: The name of the process + - snakemake: + type: string + description: The name of the tool + - "snakemake --version": + type: eval + description: The expression to obtain the version of the tool +topics: versions: - - versions.yml: - type: file - description: File containing software versions - pattern: "versions.yml" - ontologies: - - edam: http://edamontology.org/format_3750 # YAML + - - ${task.process}: + type: string + description: The name of the process + - snakemake: + type: string + description: The name of the tool + - "snakemake --version": + type: eval + description: The expression to obtain the version of the tool authors: - "@adamrtalbot" maintainers: diff --git a/modules/nf-core/snakemake/tests/main.nf.test b/modules/nf-core/snakemake/tests/main.nf.test index 06205f0dea99..fa99e697a5ef 100644 --- a/modules/nf-core/snakemake/tests/main.nf.test +++ b/modules/nf-core/snakemake/tests/main.nf.test @@ -18,7 +18,7 @@ nextflow_process { [] ] // Snakefile - Channel.of(''' + channel.of(''' rule all: input: "hello.txt" @@ -42,12 +42,57 @@ rule hello_world: } then { + assert process.success assertAll( - { assert process.success }, - { assert snapshot(process.out.outputs, process.out.versions).match() } + { assert snapshot( + process.out.outputs, + process.out.findAll { key, val -> key.startsWith("versions") } + ).match() } ) } - } + test("Should run without failures - stub") { + options "-stub" + when { + process { + """ + // Input file + input[0] = [ + [ id: 'input'], + [] + ] +// Snakefile + channel.of(''' +rule all: + input: "hello.txt" + +rule hello_world: + output: "hello.txt" + shell: "echo Hello World > hello.txt" + +''' + ) + .collectFile(name: 'Snakefile') + .map { file -> + [ + [id: 'Snakefile'], + file + ]} + .set{ snakefile } + + input[1] = snakefile + """ + } + } + then { + assert process.success + assertAll( + { assert snapshot( + process.out.outputs, + process.out.findAll { key, val -> key.startsWith("versions") } + ).match() } + ) + } + } } diff --git a/modules/nf-core/snakemake/tests/main.nf.test.snap b/modules/nf-core/snakemake/tests/main.nf.test.snap index cfd2ee688320..f10a74efa064 100644 --- a/modules/nf-core/snakemake/tests/main.nf.test.snap +++ b/modules/nf-core/snakemake/tests/main.nf.test.snap @@ -1,4 +1,25 @@ { + "Should run without failures - stub": { + "content": [ + [ + + ], + { + "versions_snakemake": [ + [ + "SNAKEMAKE", + "snakemake", + "9.14.0" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2025-11-28T17:17:18.329663" + }, "Should run without failures": { "content": [ [ @@ -9,10 +30,20 @@ "hello.txt:md5,e59ff97941044f85df5297e1c302d260" ] ], - [ - "versions.yml:md5,91f038cba572e2b7b6dfe06e0e088ce5" - ] + { + "versions_snakemake": [ + [ + "SNAKEMAKE", + "snakemake", + "9.14.0" + ] + ] + } ], - "timestamp": "2023-08-17T14:14:11+0000" + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2025-11-28T17:17:01.780244" } } \ No newline at end of file