Skip to content

Commit 447c91c

Browse files
committed
Write tests for autocycler subsample
1 parent 2b22ffe commit 447c91c

File tree

4 files changed

+67
-17
lines changed

4 files changed

+67
-17
lines changed

modules/nf-core/autocycler/subsample/main.nf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ process AUTOCYCLER_SUBSAMPLE {
4545
"""
4646
4747
mkdir $prefix
48-
touch ${prefix}/sample_00.fastq
48+
touch ${prefix}/sample_00.fastq.gz
4949
5050
cat <<-END_VERSIONS > versions.yml
5151
"${task.process}":

modules/nf-core/autocycler/subsample/tests/main.nf.test

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,26 @@ nextflow_process {
55
name "Test Process AUTOCYCLER_SUBSAMPLE"
66
script "../main.nf"
77
process "AUTOCYCLER_SUBSAMPLE"
8+
config "./nextflow.config"
89

910
tag "modules"
1011
tag "modules_"
1112
tag "autocycler"
1213
tag "autocycler/subsample"
1314

14-
// TODO nf-core: Change the test name preferably indicating the test-data and file-format used
15-
test("sarscov2 - bam") {
16-
17-
// TODO nf-core: If you are created a test for a chained module
18-
// (the module requires running more than one process to generate the required output)
19-
// add the 'setup' method here.
20-
// You can find more information about how to use a 'setup' method in the docs (https://nf-co.re/docs/contributing/modules#steps-for-creating-nf-test-for-chained-modules).
15+
test("Pseudomonas_fluorescens - fastq_gz") {
2116

2217
when {
18+
params{
19+
module_args = '--seed 1234'
20+
}
2321
process {
2422
"""
25-
// TODO nf-core: define inputs of the process here. Example:
26-
2723
input[0] = [
2824
[ id:'test', single_end:false ], // meta map
29-
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true),
25+
file('https://github.com/nf-core/test-datasets/raw/refs/heads/bacass/nanopore/subset15000.fq.gz', checkIfExists: true), // reads
3026
]
27+
input[1] = 30000 // genome size
3128
"""
3229
}
3330
}
@@ -43,28 +40,29 @@ nextflow_process {
4340

4441
}
4542

46-
// TODO nf-core: Change the test name preferably indicating the test-data and file-format used but keep the " - stub" suffix.
47-
test("sarscov2 - bam - stub") {
43+
test("Pseudomonas_fluorescens - fastq_gz - stub") {
4844

4945
options "-stub"
5046

5147
when {
48+
params{
49+
module_args = ''
50+
}
5251
process {
5352
"""
54-
// TODO nf-core: define inputs of the process here. Example:
55-
5653
input[0] = [
5754
[ id:'test', single_end:false ], // meta map
58-
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true),
55+
file('https://github.com/nf-core/test-datasets/raw/refs/heads/bacass/nanopore/subset15000.fq.gz', checkIfExists: true), // reads
5956
]
57+
input[1] = 30000 // genome size
6058
"""
6159
}
6260
}
6361

6462
then {
6563
assertAll(
6664
{ assert process.success },
67-
{ assert snapshot(process.out).match() }
65+
// { assert snapshot(process.out).match() }
6866
//TODO nf-core: Add all required assertions to verify the test output.
6967
)
7068
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"Pseudomonas_fluorescens - fastq_gz": {
3+
"content": [
4+
{
5+
"0": [
6+
[
7+
{
8+
"id": "test",
9+
"single_end": false
10+
},
11+
[
12+
"sample_01.fastq.gz:md5,b1cc8c9ee163474d67d7889e25e4e0ae",
13+
"sample_02.fastq.gz:md5,c3124b6b062158d41e822a9ff16df988",
14+
"sample_03.fastq.gz:md5,3f2db5a32a4a0cfdbb5a58b5a81f3a92",
15+
"sample_04.fastq.gz:md5,28c99f7e4565924229a980500c185802"
16+
]
17+
]
18+
],
19+
"1": [
20+
"versions.yml:md5,0abfe90f7bd1d54716b236993073b514"
21+
],
22+
"subsampled_reads": [
23+
[
24+
{
25+
"id": "test",
26+
"single_end": false
27+
},
28+
[
29+
"sample_01.fastq.gz:md5,b1cc8c9ee163474d67d7889e25e4e0ae",
30+
"sample_02.fastq.gz:md5,c3124b6b062158d41e822a9ff16df988",
31+
"sample_03.fastq.gz:md5,3f2db5a32a4a0cfdbb5a58b5a81f3a92",
32+
"sample_04.fastq.gz:md5,28c99f7e4565924229a980500c185802"
33+
]
34+
]
35+
],
36+
"versions": [
37+
"versions.yml:md5,0abfe90f7bd1d54716b236993073b514"
38+
]
39+
}
40+
],
41+
"meta": {
42+
"nf-test": "0.9.2",
43+
"nextflow": "25.04.4"
44+
},
45+
"timestamp": "2025-10-27T17:18:38.77396493"
46+
}
47+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
process {
2+
withName: 'AUTOCYCLER_SUBSAMPLE' {
3+
ext.args = params.module_args
4+
}
5+
}

0 commit comments

Comments
 (0)