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 15 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,3 +182,5 @@ exclude:
path: modules/nf-core/xeniumranger/resegment
- profile: conda
path: modules/nf-core/xeniumranger/import-segmentation
- profile: conda
path: modules/nf-core/parabricks/indexgvcf
25 changes: 9 additions & 16 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'

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("*") , emit: gvcf_index
famosab marked this conversation as resolved.
Show resolved Hide resolved
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when
Expand All @@ -22,11 +23,12 @@ process PARABRICKS_INDEXGVCF {
}
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 +41,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.collect{ it.getExtension().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"
- "*":
type: map
description: |
Groovy Map containing output information
pattern: "*.g.vcf"
- versions:
- versions.yml:
Expand Down
107 changes: 107 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,107 @@
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(process.out).match() }
)
}

}

test("human - gvcf.gz") {

when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
file('https://github.com/nf-core/test-datasets/raw/0f9d382fb977a63114e2ae3d59a320dbedba0311/data/genomics/homo_sapiens/illumina/gvcf/test.genome.g.vcf.gz')
//file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.g.vcf.gz', checkIfExists: true)
famosab marked this conversation as resolved.
Show resolved Hide resolved
]
"""
}
}

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('https://github.com/nf-core/test-datasets/raw/0f9d382fb977a63114e2ae3d59a320dbedba0311/data/genomics/homo_sapiens/illumina/gvcf/test.genome.g.vcf.gz')
//file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.g.vcf.gz', checkIfExists: true)
famosab marked this conversation as resolved.
Show resolved Hide resolved
]
"""
}
}

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

}

}
146 changes: 146 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,146 @@
{
"human - gvcf.gz": {
"content": [
{
"0": [
[
{
"id": "test"
},
"versions.yml:md5,a6c2622b9fd9223dbc349c2a27e9a2e4"
]
],
"1": [
"versions.yml:md5,a6c2622b9fd9223dbc349c2a27e9a2e4"
],
famosab marked this conversation as resolved.
Show resolved Hide resolved
"gvcf_index": [
[
{
"id": "test"
},
"versions.yml:md5,a6c2622b9fd9223dbc349c2a27e9a2e4"
]
],
"versions": [
"versions.yml:md5,a6c2622b9fd9223dbc349c2a27e9a2e4"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.2"
},
"timestamp": "2024-12-09T15:26:59.639869164"
},
"human - gvcf": {
"content": [
{
"0": [
[
{
"id": "test"
},
"versions.yml:md5,a6c2622b9fd9223dbc349c2a27e9a2e4"
]
],
"1": [
"versions.yml:md5,a6c2622b9fd9223dbc349c2a27e9a2e4"
],
"gvcf_index": [
[
{
"id": "test"
},
"versions.yml:md5,a6c2622b9fd9223dbc349c2a27e9a2e4"
]
],
"versions": [
"versions.yml:md5,a6c2622b9fd9223dbc349c2a27e9a2e4"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.2"
},
"timestamp": "2024-12-09T15:26:53.046037224"
},
"human - gvcf - stub": {
"content": [
{
"0": [
[
{
"id": "test"
},
[
"test.g.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e",
"versions.yml:md5,a6c2622b9fd9223dbc349c2a27e9a2e4"
]
]
],
"1": [
"versions.yml:md5,a6c2622b9fd9223dbc349c2a27e9a2e4"
],
"gvcf_index": [
[
{
"id": "test"
},
[
"test.g.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e",
"versions.yml:md5,a6c2622b9fd9223dbc349c2a27e9a2e4"
]
]
],
"versions": [
"versions.yml:md5,a6c2622b9fd9223dbc349c2a27e9a2e4"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.0"
},
"timestamp": "2024-11-14T16:07:41.345829979"
},
"human - gvcf.gz - stub": {
"content": [
{
"0": [
[
{
"id": "test"
},
[
"test.g.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e",
"versions.yml:md5,a6c2622b9fd9223dbc349c2a27e9a2e4"
]
]
],
"1": [
"versions.yml:md5,a6c2622b9fd9223dbc349c2a27e9a2e4"
],
"gvcf_index": [
[
{
"id": "test"
},
[
"test.g.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e",
"versions.yml:md5,a6c2622b9fd9223dbc349c2a27e9a2e4"
]
]
],
"versions": [
"versions.yml:md5,a6c2622b9fd9223dbc349c2a27e9a2e4"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.0"
},
"timestamp": "2024-11-14T16:07:47.461957869"
}
}
3 changes: 0 additions & 3 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -407,9 +407,6 @@ parabricks/genotypegvcf:
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.

Loading
Loading