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_PHASECOMMON Migrate to nf-test #7061

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/nf-core/shapeit5/phasecommon/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/phasecommon/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ process SHAPEIT5_PHASECOMMON {

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), path(input_index), path(pedigree), val(region)
Expand All @@ -23,7 +23,7 @@ process SHAPEIT5_PHASECOMMON {
script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def suffix = task.ext.suffix ?: "vcf.gz"
def suffix = task.ext.suffix ?: "bcf"

if ("$input" == "${prefix}.${suffix}") error "Input and output names are the same, set prefix in module configuration to disambiguate!"

Expand Down Expand Up @@ -51,11 +51,11 @@ process SHAPEIT5_PHASECOMMON {
"""

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 ?: "bcf"
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
106 changes: 106 additions & 0 deletions modules/nf-core/shapeit5/phasecommon/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "shapeit5"
tag "shapeit5/phasecommon"

test("homo sapiens - bcf, [], [], []") {
when {
process {
"""
input[0] = Channel.of([
[ id:'input', single_end:false ], // meta map
file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true),
file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true),
[],
"chr21"
])

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

input[1] = Channel.of([[],[],[]])
input[2] = Channel.of([[],[],[]])
input[3] = Channel.of([[],[]])
"""
}
}

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

}

test("homo sapiens - bcf, [], [], map") {
when {
process {
"""
input[0] = Channel.of([
[ id:'input', single_end:false ], // meta map
file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true),
file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true),
[],
"chr21"
])

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

input[1] = Channel.of([[],[],[]])
input[2] = Channel.of([[],[],[]])
input[3] = Channel.of([
[ id:'map', single_end:false ],
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/chr21.b38.gmap.gz", checkIfExists: true)
])
"""
}
}

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

}

test("homo sapiens - bcf, [], [], [] - stub") {
options '-stub'
when {
process {
"""
input[0] = Channel.of([
[ id:'input', single_end:false ], // meta map
file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true),
file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true),
[],
"chr21"
])

input[1] = Channel.of([[],[],[]])
input[2] = Channel.of([[],[],[]])
input[3] = Channel.of([[],[]])
"""
}
}

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

}

}
79 changes: 79 additions & 0 deletions modules/nf-core/shapeit5/phasecommon/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"homo sapiens - bcf, [], [], []": {
"content": [
[
[
{
"id": "input",
"single_end": false
},
"input.bcf"
]
],
[
"versions.yml:md5,135745eaa06583f1c0402134626f9082"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-11-22T17:42:36.937530107"
},
"homo sapiens - bcf, [], [], map": {
"content": [
[
[
{
"id": "input",
"single_end": false
},
"input.bcf"
]
],
[
"versions.yml:md5,135745eaa06583f1c0402134626f9082"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-11-22T17:43:02.244755417"
},
"homo sapiens - bcf, [], [], [] - stub": {
"content": [
{
"0": [
[
{
"id": "input",
"single_end": false
},
"input.bcf:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
"versions.yml:md5,135745eaa06583f1c0402134626f9082"
],
"phased_variant": [
[
{
"id": "input",
"single_end": false
},
"input.bcf:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,135745eaa06583f1c0402134626f9082"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-11-22T18:43:12.707870434"
}
}
3 changes: 0 additions & 3 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -525,9 +525,6 @@ 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/**
shapeit5/phaserare:
- modules/nf-core/shapeit5/phaserare/**
- tests/modules/nf-core/shapeit5/phaserare/**
Expand Down
40 changes: 0 additions & 40 deletions tests/modules/nf-core/shapeit5/phasecommon/main.nf

This file was deleted.

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

This file was deleted.

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

This file was deleted.

Loading