Skip to content

Commit

Permalink
Convert ngscheckmate/fastq to nf-test (#5680)
Browse files Browse the repository at this point in the history
* Swap ngscheckmate/fastq to nf-test

* Fix linting
  • Loading branch information
SPPearce committed May 26, 2024
1 parent 0b94aea commit 7e11565
Show file tree
Hide file tree
Showing 7 changed files with 204 additions and 154 deletions.
130 changes: 130 additions & 0 deletions modules/nf-core/ngscheckmate/fastq/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
nextflow_process {

name "Test Process NGSCHECKMATE_FASTQ"
script "../main.nf"
process "NGSCHECKMATE_FASTQ"
config "./nextflow.config"

tag "modules"
tag "modules_nfcore"
tag "ngscheckmate"
tag "ngscheckmate/fastq"
tag "ngscheckmate/patterngenerator"
tag "gawk"
tag "bedtools/makewindows"
tag "bowtie/build"

setup {

run("GAWK" , alias: "GAWK_FAI") {
script "../../../gawk/main.nf"
process {
"""
input[0] = [
[ id: 'sarscov2' ],
file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true)
]
input[1] = []
"""
}
}

run("BEDTOOLS_MAKEWINDOWS") {
script "../../../bedtools/makewindows/main.nf"
process {
"""
input[0] = GAWK_FAI.out.output
"""
}
}

run("GAWK" , alias: "GAWK_BED") {
script "../../../gawk/main.nf"
process {
"""
input[0] = BEDTOOLS_MAKEWINDOWS.out.bed
input[1] = []
"""
}
}

run("BOWTIE_BUILD") {
script "../../../bowtie/build/main.nf"
process {
"""
input[0] = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
"""
}
}

run("NGSCHECKMATE_PATTERNGENERATOR") {
script "../../patterngenerator/main.nf"
process {
"""
input[0] = GAWK_BED.out.output
input[1] = [
[ id: 'sarscov2' ],
file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
]
input[2] = BOWTIE_BUILD.out.index
"""
}
}

}

test("sarscov2 - bam") {

when {
process {
"""
input[0] = [
[ id:'test_paired', single_end:false ], // meta map
[
file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true)
]
]
input[1] = NGSCHECKMATE_PATTERNGENERATOR.out.pt
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}

test("sarscov2 - bam - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test_paired', single_end:false ], // meta map
[
file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true)
]
]
input[1] = NGSCHECKMATE_PATTERNGENERATOR.out.pt
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}

}
72 changes: 72 additions & 0 deletions modules/nf-core/ngscheckmate/fastq/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"sarscov2 - bam - stub": {
"content": [
{
"0": [
[
{
"id": "test_paired",
"single_end": false
},
"test_paired.vaf:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
"versions.yml:md5,9a5d7a8d9148b2ca1ad7d53764ca511a"
],
"vaf": [
[
{
"id": "test_paired",
"single_end": false
},
"test_paired.vaf:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,9a5d7a8d9148b2ca1ad7d53764ca511a"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.1"
},
"timestamp": "2024-05-23T08:52:38.804007828"
},
"sarscov2 - bam": {
"content": [
{
"0": [
[
{
"id": "test_paired",
"single_end": false
},
"test_paired.vaf:md5,a2d18480c8bb7045c39c063faef7e1e4"
]
],
"1": [
"versions.yml:md5,9a5d7a8d9148b2ca1ad7d53764ca511a"
],
"vaf": [
[
{
"id": "test_paired",
"single_end": false
},
"test_paired.vaf:md5,a2d18480c8bb7045c39c063faef7e1e4"
]
],
"versions": [
"versions.yml:md5,9a5d7a8d9148b2ca1ad7d53764ca511a"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.1"
},
"timestamp": "2024-05-23T08:52:22.506102602"
}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
process {

publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }

withName: BEDTOOLS_MAKEWINDOWS {
ext.args = '-w 1'
ext.prefix = 'test_split'
}

withName: GAWK_BED {
ext.args2 = '\'NR > 20 && NR < 20000 && FS = OFS = "\t" { print $0 FS "rs1" FS "G" FS "C" }\''
ext.prefix = 'snp'
ext.suffix = "bed"
}

withName: GAWK_FAI {
ext.args2 = '\'BEGIN { FS = OFS = "\t" } { print \$1 FS "0" FS \$2 }\''
ext.prefix = 'fasta'
ext.suffix = "bed"
}

}
2 changes: 2 additions & 0 deletions modules/nf-core/ngscheckmate/fastq/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ngscheckmate/fastq:
- "modules/nf-core/ngscheckmate/fastq/**"
3 changes: 0 additions & 3 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1199,9 +1199,6 @@ ngmaster:
ngmerge:
- modules/nf-core/ngmerge/**
- tests/modules/nf-core/ngmerge/**
ngscheckmate/fastq:
- modules/nf-core/ngscheckmate/fastq/**
- tests/modules/nf-core/ngscheckmate/fastq/**
ngscheckmate/patterngenerator:
- modules/nf-core/ngscheckmate/patterngenerator/**
- tests/modules/nf-core/ngscheckmate/patterngenerator/**
Expand Down
82 changes: 0 additions & 82 deletions tests/modules/nf-core/ngscheckmate/fastq/main.nf

This file was deleted.

63 changes: 0 additions & 63 deletions tests/modules/nf-core/ngscheckmate/fastq/test.yml

This file was deleted.

0 comments on commit 7e11565

Please sign in to comment.