Skip to content

Commit

Permalink
port gatk4/applyvqsr to nf-test (#5604)
Browse files Browse the repository at this point in the history
* port to nf-test update stub

* add more assertions

* update snap

* update tbi test and snap

* change to check for filename
  • Loading branch information
famosab authored May 15, 2024
1 parent 77ffba9 commit cee8fe3
Show file tree
Hide file tree
Showing 10 changed files with 214 additions and 70 deletions.
2 changes: 1 addition & 1 deletion modules/nf-core/gatk4/applyvqsr/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ process GATK4_APPLYVQSR {
stub:
prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.vcf.gz
echo "" | gzip > ${prefix}.vcf.gz
touch ${prefix}.vcf.gz.tbi
cat <<-END_VERSIONS > versions.yml
Expand Down
5 changes: 5 additions & 0 deletions modules/nf-core/gatk4/applyvqsr/tests/allelspecificity.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {
withName: GATK4_APPLYVQSR {
ext.args = '--mode SNP --truth-sensitivity-filter-level 99.0 -AS'
}
}
106 changes: 106 additions & 0 deletions modules/nf-core/gatk4/applyvqsr/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
nextflow_process {

name "Test Process GATK4_APPLYVQSR"
script "../main.nf"
process "GATK4_APPLYVQSR"

tag "modules"
tag "modules_nfcore"
tag "gatk4"
tag "gatk4/applyvqsr"

test("human - vcf") {

config "./no-allelspecificity.config"

when {
process {
"""
input[0] = [ [ id:'test'], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.ann.vcf.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.ann.vcf.gz.tbi', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/variantrecalibrator/test2.recal', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/variantrecalibrator/test2.recal.idx', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/variantrecalibrator/test2.tranches', checkIfExists: true)
]
input[1] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true)
input[2] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta.fai', checkIfExists: true)
input[3] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.dict', checkIfExists: true)
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out.versions).match("versions") },
{ assert path(process.out.vcf.get(0).get(1)).linesGzip.contains("##fileformat=VCFv4.2") },
{ assert snapshot(file(process.out.tbi.get(0).get(1)).name).match() }
)
}

}

test("human - vcf - allele-specific") {

config "./allelspecificity.config"

when {
process {
"""
input[0] = [ [ id:'test'], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.ann.vcf.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.ann.vcf.gz.tbi', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/variantrecalibrator/test2_allele_specific.recal', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/variantrecalibrator/test2_allele_specific.recal.idx', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/variantrecalibrator/test2_allele_specific.tranches', checkIfExists: true)
]
input[1] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true)
input[2] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta.fai', checkIfExists: true)
input[3] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.dict', checkIfExists: true)
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out.versions).match("versions_allelspecific") },
{ assert path(process.out.vcf.get(0).get(1)).linesGzip.contains("##fileformat=VCFv4.2") },
{ assert snapshot(file(process.out.tbi.get(0).get(1)).name).match() }
)
}

}

test("human - vcf - stub") {

options "-stub"

when {
process {
"""
input[0] = [ [ id:'test'], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.ann.vcf.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/haplotypecaller_calls/test2_haplotc.ann.vcf.gz.tbi', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/variantrecalibrator/test2.recal', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/variantrecalibrator/test2.recal.idx', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/variantrecalibrator/test2.tranches', checkIfExists: true)
]
input[1] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true)
input[2] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta.fai', checkIfExists: true)
input[3] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.dict', checkIfExists: true)
"""
}
}

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

}

}
95 changes: 95 additions & 0 deletions modules/nf-core/gatk4/applyvqsr/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"human - vcf": {
"content": [
"test.vcf.gz.tbi"
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.0"
},
"timestamp": "2024-05-15T13:31:50.727658"
},
"human - vcf - allele-specific": {
"content": [
"test.vcf.gz.tbi"
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.0"
},
"timestamp": "2024-05-15T13:29:42.331816"
},
"versions": {
"content": [
[
"versions.yml:md5,4a6890d486a62ce6f2edfd2f8961da4f"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.0"
},
"timestamp": "2024-05-15T13:00:49.353138"
},
"human - vcf - stub": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"1": [
[
{
"id": "test"
},
"test.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"2": [
"versions.yml:md5,4a6890d486a62ce6f2edfd2f8961da4f"
],
"tbi": [
[
{
"id": "test"
},
"test.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"vcf": [
[
{
"id": "test"
},
"test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"versions": [
"versions.yml:md5,4a6890d486a62ce6f2edfd2f8961da4f"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.0"
},
"timestamp": "2024-05-15T13:01:24.370421"
},
"versions_allelspecific": {
"content": [
[
"versions.yml:md5,4a6890d486a62ce6f2edfd2f8961da4f"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.0"
},
"timestamp": "2024-05-15T13:01:08.104194"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {
withName: GATK4_APPLYVQSR {
ext.args = '--mode SNP --truth-sensitivity-filter-level 99.0'
}
}
2 changes: 2 additions & 0 deletions modules/nf-core/gatk4/applyvqsr/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
gatk4/applyvqsr:
- "modules/nf-core/gatk4/applyvqsr/**"
3 changes: 0 additions & 3 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -582,9 +582,6 @@ gatk/realignertargetcreator:
gatk/unifiedgenotyper:
- modules/nf-core/gatk/unifiedgenotyper/**
- tests/modules/nf-core/gatk/unifiedgenotyper/**
gatk4/applyvqsr:
- modules/nf-core/gatk4/applyvqsr/**
- tests/modules/nf-core/gatk4/applyvqsr/**
gatk4/calibratedragstrmodel:
- modules/nf-core/gatk4/calibratedragstrmodel/**
- tests/modules/nf-core/gatk4/calibratedragstrmodel/**
Expand Down
36 changes: 0 additions & 36 deletions tests/modules/nf-core/gatk4/applyvqsr/main.nf

This file was deleted.

11 changes: 0 additions & 11 deletions tests/modules/nf-core/gatk4/applyvqsr/nextflow.config

This file was deleted.

19 changes: 0 additions & 19 deletions tests/modules/nf-core/gatk4/applyvqsr/test.yml

This file was deleted.

0 comments on commit cee8fe3

Please sign in to comment.