diff --git a/.github/conda_skip.yml b/.github/conda_skip.yml index 14da877f04d..8e7683a4d55 100644 --- a/.github/conda_skip.yml +++ b/.github/conda_skip.yml @@ -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 diff --git a/modules/nf-core/parabricks/indexgvcf/main.nf b/modules/nf-core/parabricks/indexgvcf/main.nf index bc082fca255..378f3a8b88b 100644 --- a/modules/nf-core/parabricks/indexgvcf/main.nf +++ b/modules/nf-core/parabricks/indexgvcf/main.nf @@ -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 @@ -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 @@ -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}": diff --git a/modules/nf-core/parabricks/indexgvcf/meta.yml b/modules/nf-core/parabricks/indexgvcf/meta.yml index be57547075a..bc0e277660a 100644 --- a/modules/nf-core/parabricks/indexgvcf/meta.yml +++ b/modules/nf-core/parabricks/indexgvcf/meta.yml @@ -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: diff --git a/modules/nf-core/parabricks/indexgvcf/tests/main.nf.test b/modules/nf-core/parabricks/indexgvcf/tests/main.nf.test new file mode 100644 index 00000000000..a6c0c79946e --- /dev/null +++ b/modules/nf-core/parabricks/indexgvcf/tests/main.nf.test @@ -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() } + ) + } + + } + +} diff --git a/modules/nf-core/parabricks/indexgvcf/tests/main.nf.test.snap b/modules/nf-core/parabricks/indexgvcf/tests/main.nf.test.snap new file mode 100644 index 00000000000..e25496cc885 --- /dev/null +++ b/modules/nf-core/parabricks/indexgvcf/tests/main.nf.test.snap @@ -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" + } +} \ No newline at end of file diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 65451e16eb6..adfddd44dad 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -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/** diff --git a/tests/modules/nf-core/parabricks/indexgvcf/main.nf b/tests/modules/nf-core/parabricks/indexgvcf/main.nf deleted file mode 100644 index 0be4206915d..00000000000 --- a/tests/modules/nf-core/parabricks/indexgvcf/main.nf +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { PARABRICKS_INDEXGVCF } from '../../../../../modules/nf-core/parabricks/indexgvcf/main.nf' - -workflow test_parabricks_indexgvcf { - - input = [ - [ id:'test' ], // meta map - file(params.test_data['homo_sapiens']['illumina']['test_genome_vcf'], checkIfExists: true) - ] - - process stage { - input: - tuple val(meta), path(gvcf) - - output: - tuple val(meta), path("*.g.vcf") - - script: - """ - mv $gvcf test.genome.g.vcf - """ - } - - PARABRICKS_INDEXGVCF ( stage ( input ) ) -} - -workflow test_parabricks_indexgvcf_gz { - - input = [ - [ id:'test' ], // meta map - file(params.test_data['homo_sapiens']['illumina']['test_genome_vcf_gz'], checkIfExists: true) - ] - - process stage_gz { - stageInMode "copy" - - input: - tuple val(meta), path(gvcf) - - output: - tuple val(meta), path("*.g.vcf.gz") - - script: - """ - mv $gvcf test.genome.g.vcf.gz - """ - } - - PARABRICKS_INDEXGVCF ( stage_gz ( input ) ) -} diff --git a/tests/modules/nf-core/parabricks/indexgvcf/nextflow.config b/tests/modules/nf-core/parabricks/indexgvcf/nextflow.config deleted file mode 100644 index 8730f1c4b93..00000000000 --- a/tests/modules/nf-core/parabricks/indexgvcf/nextflow.config +++ /dev/null @@ -1,5 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - -} diff --git a/tests/modules/nf-core/parabricks/indexgvcf/test.yml b/tests/modules/nf-core/parabricks/indexgvcf/test.yml deleted file mode 100644 index d13fd56c4b1..00000000000 --- a/tests/modules/nf-core/parabricks/indexgvcf/test.yml +++ /dev/null @@ -1,19 +0,0 @@ -- name: parabricks indexgvcf test_parabricks_indexgvcf - command: nextflow run ./tests/modules/nf-core/parabricks/indexgvcf -entry test_parabricks_indexgvcf -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/parabricks/indexgvcf/nextflow.config -stub-run - tags: - - parabricks - - parabricks/indexgvcf - files: - - path: output/parabricks/test.g.vcf.idx - should_exist: true - - path: output/parabricks/versions.yml - -- name: parabricks indexgvcf test_parabricks_indexgvcf_gz - command: nextflow run ./tests/modules/nf-core/parabricks/indexgvcf -entry test_parabricks_indexgvcf_gz -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/parabricks/indexgvcf/nextflow.config -stub-run - tags: - - parabricks - - parabricks/indexgvcf - files: - - path: output/parabricks/test.g.vcf.gz.tbi - should_exist: true - - path: output/parabricks/versions.yml diff --git a/tests/modules/nf-core/parabricks/indexgvcf/test_GPU_config.txt b/tests/modules/nf-core/parabricks/indexgvcf/test_GPU_config.txt deleted file mode 100644 index 7d5cca922bd..00000000000 --- a/tests/modules/nf-core/parabricks/indexgvcf/test_GPU_config.txt +++ /dev/null @@ -1,9 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - memory = "15.GB" - cpus = 4 - accelerator = 1 -} -docker.runOptions = "--gpus all" -singularity.runOptions = "--nv" diff --git a/tests/modules/nf-core/parabricks/indexgvcf/test_GPU_yml.txt b/tests/modules/nf-core/parabricks/indexgvcf/test_GPU_yml.txt deleted file mode 100644 index fde28ba6cd0..00000000000 --- a/tests/modules/nf-core/parabricks/indexgvcf/test_GPU_yml.txt +++ /dev/null @@ -1,19 +0,0 @@ -- name: parabricks indexgvcf test_parabricks_indexgvcf - command: nextflow run ./tests/modules/nf-core/parabricks/indexgvcf -entry test_parabricks_indexgvcf -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/parabricks/indexgvcf/test_GPU_config.txt - tags: - - parabricks - - parabricks/indexgvcf - files: - - path: output/parabricks/test.g.vcf.idx - md5sum: 40eef3bc2d5cd28b576d3db308674a1d - - path: output/parabricks/versions.yml - -- name: parabricks indexgvcf test_parabricks_indexgvcf_gz - command: nextflow run ./tests/modules/nf-core/parabricks/indexgvcf -entry test_parabricks_indexgvcf_gz -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/parabricks/indexgvcf/test_GPU_config.txt - tags: - - parabricks - - parabricks/indexgvcf - files: - - path: output/parabricks/test.g.vcf.gz.tbi - md5sum: a581ec2827af89dbe82d09951c1725ec - - path: output/parabricks/versions.yml