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

Port parabricks/dbsnp to nf-test #6977

Merged
merged 23 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from 20 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: 2 additions & 0 deletions .github/conda_skip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,7 @@ exclude:
path: modules/nf-core/xeniumranger/resegment
- profile: conda
path: modules/nf-core/xeniumranger/import-segmentation
- profile: conda
path: modules/nf-core/parabricks/dbsnp
- profile: conda
path: modules/nf-core/parabricks/genotypegvcf
15 changes: 7 additions & 8 deletions modules/nf-core/parabricks/dbsnp/main.nf
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
process PARABRICKS_DBSNP {
tag "$meta.id"
label 'process_high'
label 'process_gpu'
stageInMode 'copy' // needed by the module to work properly - might be removed when this is fixed upstream

container "nvcr.io/nvidia/clara/clara-parabricks:4.3.0-1"
container "nvcr.io/nvidia/clara/clara-parabricks:4.4.0-1"

input:
tuple val(meta), path(vcf_file), path(dbsnp_file), path(tabix_file)
Expand All @@ -15,22 +17,20 @@ process PARABRICKS_DBSNP {
task.ext.when == null || task.ext.when

script:

// Exit if running this module with -profile conda / -profile mamba
if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) {
exit 1, "Parabricks module does not support Conda. Please use Docker / Singularity / Podman instead."
}

def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def ann_vcf = "${prefix}.vcf"
def num_gpus = task.accelerator ? "--num-gpus $task.accelerator.request" : ''
"""

pbrun \\
dbsnp \\
--in-vcf $vcf_file \\
--in-dbsnp-file $dbsnp_file \\
--out-vcf $ann_vcf \\
--out-vcf ${prefix}.vcf \\
$num_gpus \\
$args

cat <<-END_VERSIONS > versions.yml
Expand All @@ -42,9 +42,8 @@ process PARABRICKS_DBSNP {
stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def ann_vcf = "${prefix}.vcf"
"""
touch $ann_vcf
touch ${prefix}.vcf

cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
69 changes: 69 additions & 0 deletions modules/nf-core/parabricks/dbsnp/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "parabricks"
tag "parabricks/dbsnp"
tag "gpu"

test("human - vcf") {

config './nextflow.config'
famosab marked this conversation as resolved.
Show resolved Hide resolved

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/test.rnaseq.vcf', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/vcf/dbsnp_146.hg38.vcf.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/vcf/dbsnp_146.hg38.vcf.gz.tbi', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
path(process.out.vcf[0][1]).vcf.variantsMD5,
process.out.versions
).match()
}
)
}

}

test("human - vcf - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/test.rnaseq.vcf', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/vcf/dbsnp_146.hg38.vcf.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/vcf/dbsnp_146.hg38.vcf.gz.tbi', checkIfExists: true)
]
"""
}
}

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

}

}
50 changes: 50 additions & 0 deletions modules/nf-core/parabricks/dbsnp/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"human - vcf": {
"content": [
"242dbff8325d7f958c95b34598146a0d",
[
"versions.yml:md5,08b9f4ea1507e634b70b8e0ab85ab536"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.0"
},
"timestamp": "2024-11-14T14:17:11.379908895"
},
"human - vcf - stub": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
"test.vcf:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
"versions.yml:md5,08b9f4ea1507e634b70b8e0ab85ab536"
],
"vcf": [
[
{
"id": "test",
"single_end": false
},
"test.vcf:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,08b9f4ea1507e634b70b8e0ab85ab536"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.2"
},
"timestamp": "2024-12-09T15:33:22.588142501"
}
}
3 changes: 0 additions & 3 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,6 @@ ncbitools/vecscreen:
oncocnv:
- modules/nf-core/oncocnv/**
- tests/modules/nf-core/oncocnv/**
parabricks/dbsnp:
- modules/nf-core/parabricks/dbsnp/**
- tests/modules/nf-core/parabricks/dbsnp/**
parabricks/deepvariant:
- modules/nf-core/parabricks/deepvariant/**
- tests/modules/nf-core/parabricks/deepvariant/**
Expand Down
17 changes: 0 additions & 17 deletions tests/modules/nf-core/parabricks/dbsnp/main.nf

This file was deleted.

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

This file was deleted.

10 changes: 0 additions & 10 deletions tests/modules/nf-core/parabricks/dbsnp/test.yml

This file was deleted.

9 changes: 0 additions & 9 deletions tests/modules/nf-core/parabricks/dbsnp/test_GPU_config.txt

This file was deleted.

10 changes: 0 additions & 10 deletions tests/modules/nf-core/parabricks/dbsnp/test_GPU_yml.txt

This file was deleted.

Loading