Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SHAPEIT5_LIGATE Migration to nf-test #7060

Merged
merged 14 commits into from
Dec 4, 2024
2 changes: 1 addition & 1 deletion modules/nf-core/shapeit5/ligate/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
14 changes: 7 additions & 7 deletions modules/nf-core/shapeit5/ligate/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ process SHAPEIT5_LIGATE {

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(input_list), path (input_list_index)
tuple val(meta), path(input_list), path(input_list_index)

output:
tuple val(meta), path("*.{vcf,bcf,vcf.gz,bcf.gz}"), emit: merged_variants
Expand Down Expand Up @@ -37,11 +37,11 @@ process SHAPEIT5_LIGATE {
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def suffix = task.ext.suffix ?: "vcf.gz"
def prefix = task.ext.prefix ?: "${meta.id}"
def suffix = task.ext.suffix ?: "vcf.gz"
def create_cmd = suffix.endsWith(".gz") ? "echo '' | gzip >" : "touch"
"""
touch ${prefix}.${suffix}
${create_cmd} ${prefix}.${suffix}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
100 changes: 100 additions & 0 deletions modules/nf-core/shapeit5/ligate/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
nextflow_process {

name "Test Process SHAPEIT5_LIGATE"
script "../main.nf"
process "SHAPEIT5_LIGATE"
LouisLeNezet marked this conversation as resolved.
Show resolved Hide resolved

tag "modules"
tag "modules_nfcore"
tag "shapeit5"
tag "shapeit5/ligate"
tag "bcftools/view"

test("homo sapiens - map, [vcf], [tbi]") {
config "./nextflow.config"
LouisLeNezet marked this conversation as resolved.
Show resolved Hide resolved
setup {
run("BCFTOOLS_VIEW", alias: "BCFTOOLS_VIEW_1") {
script "../../../bcftools/view"
params {
bcftools_args = "--regions chr21:16600000-16750000 -Ob --write-index=csi -e 'GT=\"./.\"||GT=\".\"'"
}
process {
"""
input[0] = [
[ id:'NA12878_1X_1' ], // meta map
file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz", checkIfExists: true),
file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz.csi", checkIfExists: true),
]
input[1] = []
input[2] = []
input[3] = []
"""
}
}
run("BCFTOOLS_VIEW", alias: "BCFTOOLS_VIEW_2") {
script "../../../bcftools/view"
params {
bcftools_args = "--regions chr21:16650000-16800000 -Ob --write-index=csi -e 'GT=\"./.\"||GT=\".\"'"
}
process {
"""
input[0] = [
[ id:'NA12878_1X_2' ], // meta map
file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz", checkIfExists: true),
file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz.csi", checkIfExists: true),
]
input[1] = []
input[2] = []
input[3] = []
"""
}
}
}

when {
process {
"""
input[0] = BCFTOOLS_VIEW_1.out.vcf.view().join(BCFTOOLS_VIEW_1.out.csi)
.mix(BCFTOOLS_VIEW_2.out.vcf.join(BCFTOOLS_VIEW_2.out.csi))
.map { meta, vcf, csi -> [ [id : "NA12878"], vcf, csi ] }
.groupTuple()
.view()
LouisLeNezet marked this conversation as resolved.
Show resolved Hide resolved
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.merged_variants.collect {meta, vcf -> [ meta, path(vcf).vcf.summary ]},
process.out.versions
).match() }
)
}
}

test("homo sapiens - map, [vcf], [tbi] - stub") {
options '-stub'

when {
process {
"""
input[0] = [
[id: 'NA12878' ],
[file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz", checkIfExists: true)],
[file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz.csi", checkIfExists: true)]
]
"""
}
}

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

}
55 changes: 55 additions & 0 deletions modules/nf-core/shapeit5/ligate/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"homo sapiens - map, [vcf], [tbi] - stub": {
"content": [
{
"0": [
[
{
"id": "NA12878"
},
"NA12878.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"1": [
"versions.yml:md5,4b66c655a4fd210ca7bc47b6fe35230b"
],
"merged_variants": [
[
{
"id": "NA12878"
},
"NA12878.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"versions": [
"versions.yml:md5,4b66c655a4fd210ca7bc47b6fe35230b"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-11-22T17:22:34.235879155"
},
"homo sapiens - map, [vcf], [tbi]": {
"content": [
[
[
{
"id": "NA12878"
},
"VcfFile [chromosomes=[chr21], sampleCount=1, variantCount=2042, phased=false, phasedAutodetect=false]"
]
],
[
"versions.yml:md5,4b66c655a4fd210ca7bc47b6fe35230b"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-11-22T17:22:28.218989461"
}
}
6 changes: 6 additions & 0 deletions modules/nf-core/shapeit5/ligate/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
process {
withName: "BCFTOOLS_VIEW_*" {
ext.args = params.bcftools_args
ext.prefix = { "${meta.id}" }
}
}
3 changes: 0 additions & 3 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -522,9 +522,6 @@ sgdemux:
- modules/nf-core/sgdemux/**
- modules/nf-core/untar/**
- tests/modules/nf-core/sgdemux/**
shapeit5/ligate:
- modules/nf-core/shapeit5/ligate/**
- tests/modules/nf-core/shapeit5/ligate/**
shapeit5/phasecommon:
- modules/nf-core/shapeit5/phasecommon/**
- tests/modules/nf-core/shapeit5/phasecommon/**
Expand Down
58 changes: 0 additions & 58 deletions tests/modules/nf-core/shapeit5/ligate/main.nf

This file was deleted.

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

This file was deleted.

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

This file was deleted.

Loading