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

Open
wants to merge 4 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
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,7 @@ jobs:
- path: modules/nf-core/parabricks/fq2bammeth
- path: modules/nf-core/parabricks/fq2bam
- path: modules/nf-core/parabricks/applybqsr
- path: modules/nf-core/parabricks/indexgvcf
- profile: conda
path: modules/nf-core/xeniumranger/relabel
- profile: conda
Expand Down Expand Up @@ -698,6 +699,8 @@ jobs:
profile: [docker_self_hosted, singularity]
- path: modules/nf-core/parabricks/fq2bammeth
profile: [docker_self_hosted, singularity]
- path: modules/nf-core/parabricks/indexgvcf
profile: [docker_self_hosted, singularity]
env:
NXF_ANSI_LOG: false

Expand Down
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
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
106 changes: 106 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,106 @@
nextflow_process {

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

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

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)
]
"""
}
}

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)
]
"""
}
}

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

}

}
148 changes: 148 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,148 @@
{
"human - gvcf.gz": {
"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"
]
},
"versions.yml"
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.0"
},
"timestamp": "2024-11-14T16:09:18.936863233"
},
"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"
]
},
"versions.yml:md5,a6c2622b9fd9223dbc349c2a27e9a2e4"
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.0"
},
"timestamp": "2024-11-14T16:11:41.309055746"
},
"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 @@ -461,9 +461,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