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/indexgvcf to nf-test #6996

Merged
merged 22 commits into from
Dec 11, 2024
Merged
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: 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/indexgvcf
- profile: conda
path: modules/nf-core/parabricks/genotypegvcf
28 changes: 10 additions & 18 deletions modules/nf-core/parabricks/indexgvcf/main.nf
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
process PARABRICKS_INDEXGVCF {
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(gvcf, stageAs:'')
tuple val(meta), path(gvcf)

output:
// This tool outputs g.vcf.idx if input is uncompressed, g.vcf.gz.tbi if input is compressed
tuple val(meta), path("*.g.vcf*") , emit: gvcf_index
path "versions.yml" , emit: versions
tuple val(meta), path("*.{idx,tbi}") , emit: gvcf_index
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when
Expand All @@ -21,12 +22,12 @@ process PARABRICKS_INDEXGVCF {
error "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 num_gpus = task.accelerator ? "--num-gpus $task.accelerator.request" : ''
"""
pbrun \\
indexgvcf \\
--input $gvcf \\
$num_gpus \\
$args

cat <<-END_VERSIONS > versions.yml
Expand All @@ -39,19 +40,10 @@ process PARABRICKS_INDEXGVCF {
if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) {
error "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 output_cmd = gvcf.any{ it.name.endsWith(".gz") } ? "touch ${prefix}.g.vcf.gz.tbi" : "touch ${prefix}.g.vcf.idx"
"""
# Different outputs generated depending if file is gzipped
case $gvcf in
*.gz )
touch ${prefix}.g.vcf.gz.tbi
;;
* )
touch ${prefix}.g.vcf.idx
;;
esac
$output_cmd

cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
8 changes: 5 additions & 3 deletions modules/nf-core/parabricks/indexgvcf/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ output:
type: map
description: |
Groovy Map containing output information
- "*.g.vcf*":
type: file
description: Indexed gvcf file
pattern: "*.g.vcf"
- "*.{idx,tbi}":
type: map
description: |
Groovy Map containing output information
pattern: "*.g.vcf"
- versions:
- versions.yml:
Expand Down
109 changes: 109 additions & 0 deletions modules/nf-core/parabricks/indexgvcf/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "parabricks"
tag "parabricks/indexgvcf"
tag "gpu"

test("human - gvcf") {

when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.g.vcf', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
file(process.out.gvcf_index[0][1]).name,
process.out.versions
).match()
}
)
}

}

test("human - gvcf.gz") {

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

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

}

test("human - gvcf - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.g.vcf', checkIfExists: true)
]
"""
}
}

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

}

test("human - gvcf.gz - stub") {

options "-stub"

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

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

}

}
114 changes: 114 additions & 0 deletions modules/nf-core/parabricks/indexgvcf/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
{
"human - gvcf.gz": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test.genome.g.vcf.gz.tbi:md5,a581ec2827af89dbe82d09951c1725ec"
]
],
"1": [
"versions.yml:md5,a6c2622b9fd9223dbc349c2a27e9a2e4"
],
"gvcf_index": [
[
{
"id": "test"
},
"test.genome.g.vcf.gz.tbi:md5,a581ec2827af89dbe82d09951c1725ec"
]
],
"versions": [
"versions.yml:md5,a6c2622b9fd9223dbc349c2a27e9a2e4"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.2"
},
"timestamp": "2024-12-10T10:16:48.994612337"
},
"human - gvcf": {
"content": [
"test.genome.g.vcf.idx",
[
"versions.yml:md5,a6c2622b9fd9223dbc349c2a27e9a2e4"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.2"
},
"timestamp": "2024-12-10T10:21:20.010561875"
},
"human - gvcf - stub": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test.g.vcf.idx:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
"versions.yml:md5,a6c2622b9fd9223dbc349c2a27e9a2e4"
],
"gvcf_index": [
[
{
"id": "test"
},
"test.g.vcf.idx:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,a6c2622b9fd9223dbc349c2a27e9a2e4"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.2"
},
"timestamp": "2024-12-10T10:21:32.292223281"
},
"human - gvcf.gz - stub": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test.g.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
"versions.yml:md5,a6c2622b9fd9223dbc349c2a27e9a2e4"
],
"gvcf_index": [
[
{
"id": "test"
},
"test.g.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,a6c2622b9fd9223dbc349c2a27e9a2e4"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.2"
},
"timestamp": "2024-12-10T10:14:58.744532337"
}
}
3 changes: 0 additions & 3 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,6 @@ parabricks/deepvariant:
parabricks/haplotypecaller:
- modules/nf-core/parabricks/haplotypecaller/**
- tests/modules/nf-core/parabricks/haplotypecaller/**
parabricks/indexgvcf:
- modules/nf-core/parabricks/indexgvcf/**
- tests/modules/nf-core/parabricks/indexgvcf/**
parabricks/mutectcaller:
- modules/nf-core/parabricks/mutectcaller/**
- tests/modules/nf-core/parabricks/mutectcaller/**
Expand Down
53 changes: 0 additions & 53 deletions tests/modules/nf-core/parabricks/indexgvcf/main.nf

This file was deleted.

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

This file was deleted.

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

This file was deleted.

Loading
Loading