Skip to content

Commit

Permalink
SHAPEIT5_SWITCH Migrate to nf-test (#7066)
Browse files Browse the repository at this point in the history
* Migrate to nf-test

* Remove md5sum

* Update nf-test datasets

---------

Co-authored-by: LouisLeNezet <louislenezet@gmaio.com>
  • Loading branch information
LouisLeNezet and LouisLeNezet authored Dec 4, 2024
1 parent 30e4a82 commit 175e642
Show file tree
Hide file tree
Showing 9 changed files with 209 additions and 84 deletions.
2 changes: 1 addition & 1 deletion modules/nf-core/shapeit5/switch/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ channels:
- conda-forge
- bioconda
dependencies:
- bioconda::shapeit5=1.0.0
- bioconda::shapeit5=5.1.1
24 changes: 12 additions & 12 deletions modules/nf-core/shapeit5/switch/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ process SHAPEIT5_SWITCH {

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/shapeit5:1.0.0--h0c8ee15_0':
'biocontainers/shapeit5:1.0.0--h0c8ee15_0'}"
'https://depot.galaxyproject.org/singularity/shapeit5:5.1.1--hb60d31d_0':
'biocontainers/shapeit5:5.1.1--hb60d31d_0'}"

input:
tuple val(meta) , path(estimate), path(estimate_index), val(region), path(pedigree)
Expand Down Expand Up @@ -43,18 +43,18 @@ process SHAPEIT5_SWITCH {
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def create_cmd = "echo '' | gzip >"
"""
touch ${prefix}.block.switch.txt.gz
touch ${prefix}.calibration.switch.txt.gz
touch ${prefix}.flipsAndSwitches.txt.gz
touch ${prefix}.frequency.switch.txt.gz
touch ${prefix}.sample.switch.txt.gz
touch ${prefix}.sample.typing.txt.gz
touch ${prefix}.type.switch.txt.gz
touch ${prefix}.variant.switch.txt.gz
touch ${prefix}.variant.typing.txt.gz
${create_cmd} ${prefix}.block.switch.txt.gz
${create_cmd} ${prefix}.calibration.switch.txt.gz
${create_cmd} ${prefix}.flipsAndSwitches.txt.gz
${create_cmd} ${prefix}.frequency.switch.txt.gz
${create_cmd} ${prefix}.sample.switch.txt.gz
${create_cmd} ${prefix}.sample.typing.txt.gz
${create_cmd} ${prefix}.type.switch.txt.gz
${create_cmd} ${prefix}.variant.switch.txt.gz
${create_cmd} ${prefix}.variant.typing.txt.gz
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
105 changes: 105 additions & 0 deletions modules/nf-core/shapeit5/switch/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "shapeit5"
tag "shapeit5/switch"
tag "shapeit5/phasecommon"
tag "bcftools/index"

test("homo sapiens - vcf, scaffold, []") {
config "./nextflow.config"
setup {
run("SHAPEIT5_PHASECOMMON") {
script "../../../shapeit5/phasecommon"
params {
shapeit5_phasecommon_args = "--filter-maf 0.001"
}
process {
"""
input[0] = Channel.of([
[ id:'scaffold', single_end:false ], // meta map
file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists: true),
file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists: true),
[],
"chr22",
])
input[1] = Channel.of([[],[],[]])
input[2] = Channel.of([[],[],[]])
input[3] = Channel.of([[],[]])
"""
}
}
run("BCFTOOLS_INDEX") {
script "../../../bcftools/index"
process {
"""
input[0] = SHAPEIT5_PHASECOMMON.out.phased_variant
"""
}
}
}

when {
process {
"""
input[0] = SHAPEIT5_PHASECOMMON.out.phased_variant
.join(BCFTOOLS_INDEX.out.csi)
.combine(Channel.of("chr22"))
.combine(Channel.of([[]]))
input[1] = Channel.of([[ id:'truth_panel'],
file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz",checkIfExists:true),
file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi",checkIfExists:true)
])
input[2] = Channel.of([[ id:'freq_file'],
file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.sites.vcf.gz",checkIfExists:true),
file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.sites.vcf.gz.csi",checkIfExists:true)
])
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.errors.collect { meta, txt -> [ meta, txt.collect{ file(it).name } ] },
process.out.versions
).match() }
)
}

}

test("homo sapiens - vcf, scaffold, [] - stub") {
options "-stub"
when {
process {
"""
input[0] = Channel.of([
[id:'truth_panel'],
file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz",checkIfExists:true),
file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi",checkIfExists:true),
"chr21",
[]
])
input[1] = [[], [], []]
input[2] = [[], [], []]
"""
}
}

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

}

}
86 changes: 86 additions & 0 deletions modules/nf-core/shapeit5/switch/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"homo sapiens - vcf, scaffold, [] - stub": {
"content": [
{
"0": [
[
{
"id": "truth_panel"
},
[
"truth_panel.block.switch.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940",
"truth_panel.calibration.switch.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940",
"truth_panel.flipsAndSwitches.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940",
"truth_panel.frequency.switch.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940",
"truth_panel.sample.switch.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940",
"truth_panel.sample.typing.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940",
"truth_panel.type.switch.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940",
"truth_panel.variant.switch.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940",
"truth_panel.variant.typing.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
]
],
"1": [
"versions.yml:md5,95238962a141557f464b8e22c8057211"
],
"errors": [
[
{
"id": "truth_panel"
},
[
"truth_panel.block.switch.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940",
"truth_panel.calibration.switch.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940",
"truth_panel.flipsAndSwitches.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940",
"truth_panel.frequency.switch.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940",
"truth_panel.sample.switch.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940",
"truth_panel.sample.typing.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940",
"truth_panel.type.switch.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940",
"truth_panel.variant.switch.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940",
"truth_panel.variant.typing.txt.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
]
],
"versions": [
"versions.yml:md5,95238962a141557f464b8e22c8057211"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-11-22T19:04:42.303883153"
},
"homo sapiens - vcf, scaffold, []": {
"content": [
[
[
{
"id": "scaffold",
"single_end": false
},
[
"scaffold.block.switch.txt.gz",
"scaffold.calibration.switch.txt.gz",
"scaffold.flipsAndSwitches.txt.gz",
"scaffold.frequency.switch.txt.gz",
"scaffold.sample.switch.txt.gz",
"scaffold.sample.typing.txt.gz",
"scaffold.type.switch.txt.gz",
"scaffold.variant.switch.txt.gz",
"scaffold.variant.typing.txt.gz"
]
]
],
[
"versions.yml:md5,95238962a141557f464b8e22c8057211"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-11-22T19:13:32.038870261"
}
}
5 changes: 5 additions & 0 deletions modules/nf-core/shapeit5/switch/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {
withName: SHAPEIT5_PHASECOMMON {
ext.args = params.shapeit5_phasecommon_args
}
}
3 changes: 0 additions & 3 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -510,9 +510,6 @@ sgdemux:
shapeit5/phaserare:
- modules/nf-core/shapeit5/phaserare/**
- tests/modules/nf-core/shapeit5/phaserare/**
shapeit5/switch:
- modules/nf-core/shapeit5/switch/**
- tests/modules/nf-core/shapeit5/switch/**
shigeifinder:
- modules/nf-core/shigeifinder/**
- tests/modules/nf-core/shigeifinder/**
Expand Down
41 changes: 0 additions & 41 deletions tests/modules/nf-core/shapeit5/switch/main.nf

This file was deleted.

5 changes: 0 additions & 5 deletions tests/modules/nf-core/shapeit5/switch/nextflow.config

This file was deleted.

22 changes: 0 additions & 22 deletions tests/modules/nf-core/shapeit5/switch/test.yml

This file was deleted.

0 comments on commit 175e642

Please sign in to comment.