Skip to content

Commit 53675cf

Browse files
maxulyssemashehu
authored andcommitted
update and add topics to snakemake module (#9454)
* update and add topics * add new topics structure * add stub test and capture version in snapshot * update to 9.14.0 * fix singularity be setting cache_dir * fix stub --------- Co-authored-by: Matthias Hörtenhuber <mashehu@users.noreply.github.com> Co-authored-by: mashehu <mashehu3@gmail.com>
1 parent 819155d commit 53675cf

File tree

5 files changed

+133
-49
lines changed

5 files changed

+133
-49
lines changed

modules/nf-core/snakemake/environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ channels:
44
- conda-forge
55
- bioconda
66
dependencies:
7-
- bioconda::snakemake=7.31.0
7+
- bioconda::snakemake=9.14.0

modules/nf-core/snakemake/main.nf

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,51 @@
11
process SNAKEMAKE {
2-
tag "$meta.id"
2+
tag "${meta.id}"
33
label 'process_low'
44

55
// You will have to add all modules to this Conda definition and
66
// replace the container definition for one that suits your needs
77
conda "${moduleDir}/environment.yml"
8-
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
9-
'https://depot.galaxyproject.org/singularity/snakemake:7.31.0--hdfd78af_1' :
10-
'biocontainers/snakemake:7.31.0--hdfd78af_1' }"
8+
container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container
9+
? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/b9/b91b2eddb4c4c0a5e17721d29764e59a50035b9fa9996eb9cb392829f2d7a533/data'
10+
: 'community.wave.seqera.io/library/snakemake:9.14.0--dfee75b6201d25c6'}"
1111

1212
input:
1313
tuple val(meta), path(inputs)
1414
tuple val(meta2), path(snakefile)
1515

1616
output:
17-
tuple val(meta), path("[!.snakemake|versions.yml]**") , emit: outputs , optional: true
17+
tuple val(meta), path("[!.snakemake|versions.yml]**"), emit: outputs, optional: true
1818
tuple val(meta), path(".snakemake", type: 'dir', hidden: true), emit: snakemake_dir
19-
path "versions.yml" , emit: versions
19+
tuple val("${task.process}"), val("snakemake"), eval('snakemake --version'), topic: versions, emit: versions_snakemake
2020

2121
when:
2222
task.ext.when == null || task.ext.when
2323

2424
script:
25-
def args = task.ext.args ?: ''
26-
def prefix = task.ext.prefix ?: "${meta.id}"
27-
def cores = task.cpus ? "--cores ${task.cpus}" : "--cores all"
25+
def args = task.ext.args ?: ''
26+
def cores = task.cpus ? "--cores ${task.cpus}" : "--cores all"
2827
"""
28+
export XDG_CACHE_HOME=\$PWD/snakemake_cache
29+
mkdir -p \$XDG_CACHE_HOME
30+
2931
snakemake \\
30-
$args \\
31-
$cores \\
32-
--snakefile $snakefile
33-
34-
cat <<-END_VERSIONS > versions.yml
35-
"${task.process}":
36-
snakemake: \$(snakemake --version)
37-
END_VERSIONS
32+
${args} \\
33+
${cores} \\
34+
--snakefile ${snakefile}
3835
"""
3936

37+
4038
stub:
41-
def args = task.ext.args ?: ''
42-
def prefix = task.ext.prefix ?: "${meta.id}"
43-
def cores = task.cpus ? "--cores ${task.cpus}" : "--cores all"
39+
def args = task.ext.args ?: ''
40+
def cores = task.cpus ? "--cores ${task.cpus}" : "--cores all"
4441
"""
42+
export XDG_CACHE_HOME=\$PWD/snakemake_cache
43+
mkdir -p \$XDG_CACHE_HOME
44+
4545
snakemake \\
46-
$args \\
47-
--snakefile $snakefile \\
48-
$cores \\
46+
${args} \\
47+
--snakefile ${snakefile} \\
48+
${cores} \\
4949
--dry-run
50-
51-
cat <<-END_VERSIONS > versions.yml
52-
"${task.process}":
53-
snakemake: \$(snakemake --version)
54-
END_VERSIONS
5550
"""
5651
}

modules/nf-core/snakemake/meta.yml

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/yaml-schema.json
21
name: "snakemake"
3-
description: The Snakemake workflow management system is a tool to create reproducible
4-
and scalable data analyses. This module runs a simple Snakemake pipeline based on
5-
input snakefile. Expect many limitations."
2+
description: The Snakemake workflow management system is a tool to create
3+
reproducible and scalable data analyses. This module runs a simple Snakemake
4+
pipeline based on input snakefile. Expect many limitations."
65
keywords:
76
- snakemake
87
- workflow
@@ -39,7 +38,6 @@ input:
3938
Snakefile to use with Snakemake. This is required for proper execution of Snakemake.
4039
ontologies: []
4140
output:
42-
#Only when we have meta
4341
outputs:
4442
- - meta:
4543
type: map
@@ -59,16 +57,31 @@ output:
5957
e.g. [ id:'test', single_end:false ]
6058
- .snakemake:
6159
type: directory
62-
description: Hidden directory containing Snakemake execution logs and metadata
60+
description: Hidden directory containing Snakemake execution logs and
61+
metadata
6362
pattern: ".snakemake"
6463
ontologies: []
64+
versions_snakemake:
65+
- - ${task.process}:
66+
type: string
67+
description: The name of the process
68+
- snakemake:
69+
type: string
70+
description: The name of the tool
71+
- "snakemake --version":
72+
type: eval
73+
description: The expression to obtain the version of the tool
74+
topics:
6575
versions:
66-
- versions.yml:
67-
type: file
68-
description: File containing software versions
69-
pattern: "versions.yml"
70-
ontologies:
71-
- edam: http://edamontology.org/format_3750 # YAML
76+
- - ${task.process}:
77+
type: string
78+
description: The name of the process
79+
- snakemake:
80+
type: string
81+
description: The name of the tool
82+
- "snakemake --version":
83+
type: eval
84+
description: The expression to obtain the version of the tool
7285
authors:
7386
- "@adamrtalbot"
7487
maintainers:

modules/nf-core/snakemake/tests/main.nf.test

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ nextflow_process {
1818
[]
1919
]
2020
// Snakefile
21-
Channel.of('''
21+
channel.of('''
2222
rule all:
2323
input: "hello.txt"
2424

@@ -42,12 +42,57 @@ rule hello_world:
4242
}
4343

4444
then {
45+
assert process.success
4546
assertAll(
46-
{ assert process.success },
47-
{ assert snapshot(process.out.outputs, process.out.versions).match() }
47+
{ assert snapshot(
48+
process.out.outputs,
49+
process.out.findAll { key, val -> key.startsWith("versions") }
50+
).match() }
4851
)
4952
}
50-
5153
}
54+
test("Should run without failures - stub") {
55+
options "-stub"
56+
when {
57+
process {
58+
"""
59+
// Input file
60+
input[0] = [
61+
[ id: 'input'],
62+
[]
63+
]
64+
// Snakefile
65+
channel.of('''
66+
rule all:
67+
input: "hello.txt"
68+
69+
rule hello_world:
70+
output: "hello.txt"
71+
shell: "echo Hello World > hello.txt"
72+
73+
'''
74+
)
75+
.collectFile(name: 'Snakefile')
76+
.map { file ->
77+
[
78+
[id: 'Snakefile'],
79+
file
80+
]}
81+
.set{ snakefile }
82+
83+
input[1] = snakefile
84+
"""
85+
}
86+
}
5287

88+
then {
89+
assert process.success
90+
assertAll(
91+
{ assert snapshot(
92+
process.out.outputs,
93+
process.out.findAll { key, val -> key.startsWith("versions") }
94+
).match() }
95+
)
96+
}
97+
}
5398
}
Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
11
{
2+
"Should run without failures - stub": {
3+
"content": [
4+
[
5+
6+
],
7+
{
8+
"versions_snakemake": [
9+
[
10+
"SNAKEMAKE",
11+
"snakemake",
12+
"9.14.0"
13+
]
14+
]
15+
}
16+
],
17+
"meta": {
18+
"nf-test": "0.9.3",
19+
"nextflow": "25.10.0"
20+
},
21+
"timestamp": "2025-11-28T17:17:18.329663"
22+
},
223
"Should run without failures": {
324
"content": [
425
[
@@ -9,10 +30,20 @@
930
"hello.txt:md5,e59ff97941044f85df5297e1c302d260"
1031
]
1132
],
12-
[
13-
"versions.yml:md5,91f038cba572e2b7b6dfe06e0e088ce5"
14-
]
33+
{
34+
"versions_snakemake": [
35+
[
36+
"SNAKEMAKE",
37+
"snakemake",
38+
"9.14.0"
39+
]
40+
]
41+
}
1542
],
16-
"timestamp": "2023-08-17T14:14:11+0000"
43+
"meta": {
44+
"nf-test": "0.9.3",
45+
"nextflow": "25.10.0"
46+
},
47+
"timestamp": "2025-11-28T17:17:01.780244"
1748
}
1849
}

0 commit comments

Comments
 (0)