Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/nf-core/snakemake/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ channels:
- conda-forge
- bioconda
dependencies:
- bioconda::snakemake=7.31.0
- bioconda::snakemake=9.14.0
51 changes: 23 additions & 28 deletions modules/nf-core/snakemake/main.nf
Original file line number Diff line number Diff line change
@@ -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
"""
}
37 changes: 25 additions & 12 deletions modules/nf-core/snakemake/meta.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down
53 changes: 49 additions & 4 deletions modules/nf-core/snakemake/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ nextflow_process {
[]
]
// Snakefile
Channel.of('''
channel.of('''
rule all:
input: "hello.txt"

Expand All @@ -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() }
)
}
}
}
39 changes: 35 additions & 4 deletions modules/nf-core/snakemake/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -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": [
[
Expand All @@ -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"
}
}
Loading