Skip to content

Commit

Permalink
Port parabricks/dbsnp to nf-test (#6977)
Browse files Browse the repository at this point in the history
* port dbsnp

* modify paths

* modify paths

* add process_gpu

* update container

* add snap

* Update .github/workflows/test.yml

* add stageInMode copy and snap

* [automated] Fix linting with Prettier

* remove old folder

* remove test.yml

* add to conda_skip

* switch config and add tag gpu

* update snap

* Delete modules/nf-core/parabricks/dbsnp/tests/nextflow.config

* Update modules/nf-core/parabricks/dbsnp/main.nf

* Update modules/nf-core/parabricks/dbsnp/tests/main.nf.test

---------

Co-authored-by: nf-core-bot <core@nf-co.re>
  • Loading branch information
famosab and nf-core-bot authored Dec 11, 2024
1 parent a62c798 commit 356e5e6
Show file tree
Hide file tree
Showing 10 changed files with 126 additions and 62 deletions.
2 changes: 2 additions & 0 deletions .github/conda_skip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ 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/indexgvcf
- profile: conda
Expand Down
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
67 changes: 67 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,67 @@
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") {

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 @@ -392,9 +392,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.

0 comments on commit 356e5e6

Please sign in to comment.