From c34921483819e7bb6d0f914aab79315cd8f0e071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Famke=20B=C3=A4uerle?= <45968370+famosab@users.noreply.github.com> Date: Fri, 12 Jul 2024 23:13:28 +0200 Subject: [PATCH] port `gridss/gridss` to nf-test (#5933) * port * remove pytest files * fix meta * Update meta.yml * fix indentation * update test with bam plugin * fix indents, try other test * remove --assembly flag for now --------- Co-authored-by: Maxime U Garcia --- modules/nf-core/gridss/gridss/main.nf | 11 +- modules/nf-core/gridss/gridss/meta.yml | 18 +-- .../nf-core/gridss/gridss/tests/main.nf.test | 145 ++++++++++++++++++ .../gridss/gridss/tests/main.nf.test.snap | 83 ++++++++++ modules/nf-core/gridss/gridss/tests/tags.yml | 2 + tests/config/pytest_modules.yml | 3 - tests/modules/nf-core/gridss/gridss/main.nf | 80 ---------- .../nf-core/gridss/gridss/nextflow.config | 10 -- tests/modules/nf-core/gridss/gridss/test.yml | 43 ------ 9 files changed, 238 insertions(+), 157 deletions(-) create mode 100644 modules/nf-core/gridss/gridss/tests/main.nf.test create mode 100644 modules/nf-core/gridss/gridss/tests/main.nf.test.snap create mode 100644 modules/nf-core/gridss/gridss/tests/tags.yml delete mode 100644 tests/modules/nf-core/gridss/gridss/main.nf delete mode 100644 tests/modules/nf-core/gridss/gridss/nextflow.config delete mode 100644 tests/modules/nf-core/gridss/gridss/test.yml diff --git a/modules/nf-core/gridss/gridss/main.nf b/modules/nf-core/gridss/gridss/main.nf index 60e8b76f9e7..1f7551de667 100644 --- a/modules/nf-core/gridss/gridss/main.nf +++ b/modules/nf-core/gridss/gridss/main.nf @@ -8,14 +8,13 @@ process GRIDSS_GRIDSS { 'biocontainers/gridss:2.13.2--h270b39a_0' }" input: - tuple val(meta), path(inputs), path(assembly) + tuple val(meta) , path(inputs) tuple val(meta2), path(fasta) tuple val(meta3), path(fasta_fai) tuple val(meta4), path(bwa_index) output: - tuple val(meta), path("*.vcf.gz") , emit: vcf, optional:true - tuple val(meta), path("*.assembly.bam") , emit: assembly, optional:true + tuple val(meta), path("*.vcf.gz") , emit: vcf path "versions.yml" , emit: versions when: @@ -26,7 +25,6 @@ process GRIDSS_GRIDSS { def prefix = task.ext.prefix ?: "${meta.id}" def VERSION = '2.13.2' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. - def assembly_bam = assembly ? "--assembly ${assembly}" : "" def bwa = bwa_index ? "cp -s ${bwa_index}/* ." : "" """ @@ -36,7 +34,6 @@ process GRIDSS_GRIDSS { --output ${prefix}.vcf.gz \\ --reference ${fasta} \\ --threads ${task.cpus} \\ - ${assembly} \\ --jvmheap ${task.memory.toGiga() - 1}g \\ --otherjvmheap ${task.memory.toGiga() - 1}g \\ ${inputs} @@ -55,11 +52,9 @@ process GRIDSS_GRIDSS { def steps = args.contains("-s ") ? args.split('-s ')[-1].split(" ")[0] : args.contains("--steps ") ? args.split('--steps ')[-1].split(" ")[0] : "all" - def vcf = steps.contains("call") || steps.contains("all") ? "touch ${prefix}.vcf.gz" : "" - def assembly_bam = steps.contains("assembly") || steps.contains("all") ? "touch ${prefix}.assembly.bam" : "" + def vcf = steps.contains("call") || steps.contains("all") ? "echo '' | gzip > ${prefix}.vcf.gz" : "" """ ${vcf} - ${assembly_bam} cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/gridss/gridss/meta.yml b/modules/nf-core/gridss/gridss/meta.yml index bf5539c104f..a75bb46df9d 100644 --- a/modules/nf-core/gridss/gridss/meta.yml +++ b/modules/nf-core/gridss/gridss/meta.yml @@ -7,26 +7,22 @@ keywords: - cram - vcf tools: - - "gridss": + - gridss: description: "GRIDSS: the Genomic Rearrangement IDentification Software Suite" documentation: "https://github.com/PapenfussLab/gridss/wiki/GRIDSS-Documentation" tool_dev_url: "https://github.com/PapenfussLab/gridss" doi: "10.1186/s13059-021-02423-x" - licence: "['GPL v3']" + licence: ["GPL v3"] input: - meta: type: map description: | Groovy Map containing sample information - e.g. [ id:'test', single_end:false ] + e.g. [ id:'test'] - inputs: - type: file(s) + type: file description: One or more input BAM/CRAM file(s) pattern: "*.{bam,cram}" - - assembly: - type: file - description: OPTIONAL - An assembly BAM file created by the assembly step of Gridss - pattern: "*.bam" - fasta: type: file description: The reference fasta @@ -43,7 +39,7 @@ output: type: map description: | Groovy Map containing sample information - e.g. [ id:'test', single_end:false ] + e.g. [ id:'test' ] - versions: type: file description: File containing software versions @@ -52,10 +48,6 @@ output: type: file description: The called VCF file created by Gridss' call step pattern: "*.vcf.gz" - - assembly: - type: file - description: The assembly BAM file created by Gridss' assembly step - pattern: "*.assembly.bam" authors: - "@nvnieuwk" maintainers: diff --git a/modules/nf-core/gridss/gridss/tests/main.nf.test b/modules/nf-core/gridss/gridss/tests/main.nf.test new file mode 100644 index 00000000000..610dfd5eba9 --- /dev/null +++ b/modules/nf-core/gridss/gridss/tests/main.nf.test @@ -0,0 +1,145 @@ +nextflow_process { + + name "Test Process GRIDSS_GRIDSS" + script "../main.nf" + process "GRIDSS_GRIDSS" + + tag "modules" + tag "modules_nfcore" + tag "gridss" + tag "gridss/gridss" + tag "bwa/index" + + setup { + + run("BWA_INDEX") { + script "../../../bwa/index/main.nf" + process { + """ + input[0] = [ [id:'fasta'], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) + ] + """ + } + } + + } + + test("human - bam - bwa") { + + when { + process { + """ + input[0] = [ [ id:'test' ], // meta map + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), //inputs + ] + input[1] = [ [id:'fasta'], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) + ] + input[2] = [ [id:'fasta_fai'], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true) + ] + input[3] = BWA_INDEX.out.index + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.versions).match() }, + { assert path(process.out.vcf.get(0).get(1)).linesGzip.contains("##fileformat=VCFv4.2") } + ) + } + + } + + test("human - bam") { + + when { + process { + """ + input[0] = [ [ id:'test' ], // meta map + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), //inputs + ] + input[1] = [ [id:'fasta'], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) + ] + input[2] = [ [id:'fasta_fai'], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true) + ] + input[3] = [ [], [] ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.versions).match() }, + { assert path(process.out.vcf.get(0).get(1)).linesGzip.contains("##fileformat=VCFv4.2") } + ) + } + + } + + test("human - cram") { + + when { + process { + """ + input[0] = [ [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram', checkIfExists: true), //inputs + ] + input[1] = [ [id:'fasta'], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) + ] + input[2] = [ [id:'fasta_fai'], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true) + ] + input[3] = [ [], [] ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.versions).match() }, + { assert path(process.out.vcf.get(0).get(1)).linesGzip.contains("##fileformat=VCFv4.2") } + ) + } + + } + + test("human - bam - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ [ id:'test' ], // meta map + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), //inputs + ] + input[1] = [ [id:'fasta'], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) + ] + input[2] = [ [id:'fasta_fai'], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true) + ] + input[3] = [ [], [] ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/gridss/gridss/tests/main.nf.test.snap b/modules/nf-core/gridss/gridss/tests/main.nf.test.snap new file mode 100644 index 00000000000..3ccf4f6d74b --- /dev/null +++ b/modules/nf-core/gridss/gridss/tests/main.nf.test.snap @@ -0,0 +1,83 @@ +{ + "human - bam - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "1": [ + "versions.yml:md5,139867df5d7eaf22a89ae574f08e8d80" + ], + "vcf": [ + [ + { + "id": "test" + }, + "test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "versions": [ + "versions.yml:md5,139867df5d7eaf22a89ae574f08e8d80" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-07-10T11:48:56.7778" + }, + "human - bam - bwa": { + "content": [ + [ + "versions.yml:md5,139867df5d7eaf22a89ae574f08e8d80" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-07-10T11:47:23.943354" + }, + "human - bam": { + "content": [ + [ + "versions.yml:md5,139867df5d7eaf22a89ae574f08e8d80" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-07-10T11:48:06.074469" + }, + "human - cram": { + "content": [ + [ + "versions.yml:md5,139867df5d7eaf22a89ae574f08e8d80" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-07-10T11:48:45.270441" + }, + "human - bam - assembly": { + "content": [ + [ + "versions.yml:md5,139867df5d7eaf22a89ae574f08e8d80" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-07-09T14:13:21.550069" + } +} \ No newline at end of file diff --git a/modules/nf-core/gridss/gridss/tests/tags.yml b/modules/nf-core/gridss/gridss/tests/tags.yml new file mode 100644 index 00000000000..82d6ad62ae0 --- /dev/null +++ b/modules/nf-core/gridss/gridss/tests/tags.yml @@ -0,0 +1,2 @@ +gridss/gridss: + - "modules/nf-core/gridss/gridss/**" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 53d6de82c75..1070af3b8df 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -656,9 +656,6 @@ graphtyper/vcfconcatenate: grids/gridsssomaticfilter: - modules/nf-core/grids/gridsssomaticfilter/** - tests/modules/nf-core/grids/gridsssomaticfilter/** -gridss/gridss: - - modules/nf-core/gridss/gridss/** - - tests/modules/nf-core/gridss/gridss/** gridss/gridssgenerateponbedpe: - modules/nf-core/gridss/gridssgenerateponbedpe/** - tests/modules/nf-core/gridss/gridssgenerateponbedpe/** diff --git a/tests/modules/nf-core/gridss/gridss/main.nf b/tests/modules/nf-core/gridss/gridss/main.nf deleted file mode 100644 index bd9bf34c097..00000000000 --- a/tests/modules/nf-core/gridss/gridss/main.nf +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { GRIDSS_GRIDSS } from '../../../../../modules/nf-core/gridss/gridss/main.nf' -include { BWA_INDEX } from '../../../../../modules/nf-core/bwa/index/main.nf' - -workflow test_gridss_gridss_bwa { - - input = [ - [ id:'test' ], // meta map - file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true), - [] - ] - fasta = [[id:'fasta'],file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true)] - fasta_fai = [[id:'fasta_fai'],file(params.test_data['homo_sapiens']['genome']['genome_fasta_fai'], checkIfExists: true)] - - bwa_index = BWA_INDEX(fasta).index - - GRIDSS_GRIDSS( - input, - fasta, - fasta_fai, - bwa_index - ) -} - -workflow test_gridss_gridss_no_bwa { - - input = [ - [ id:'test' ], // meta map - file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true), - [] - ] - fasta = [[id:'fasta'],file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true)] - fasta_fai = [[id:'fasta_fai'],file(params.test_data['homo_sapiens']['genome']['genome_fasta_fai'], checkIfExists: true)] - - GRIDSS_GRIDSS( - input, - fasta, - fasta_fai, - [[], []] - ) -} - -workflow test_gridss_gridss_assembly { - - input = [ - [ id:'test' ], // meta map - file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true), - file(params.test_data['homo_sapiens']['illumina']['test2_paired_end_sorted_bam'], checkIfExists: true) - ] - fasta = [[id:'fasta'],file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true)] - fasta_fai = [[id:'fasta_fai'],file(params.test_data['homo_sapiens']['genome']['genome_fasta_fai'], checkIfExists: true)] - - GRIDSS_GRIDSS( - input, - fasta, - fasta_fai, - [[], []] - ) -} - -workflow test_gridss_gridss_cram { - - input = [ - [ id:'test' ], // meta map - file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram'], checkIfExists: true), - [] - ] - fasta = [[id:'fasta'],file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true)] - fasta_fai = [[id:'fasta_fai'],file(params.test_data['homo_sapiens']['genome']['genome_fasta_fai'], checkIfExists: true)] - - GRIDSS_GRIDSS( - input, - fasta, - fasta_fai, - [[], []] - ) -} diff --git a/tests/modules/nf-core/gridss/gridss/nextflow.config b/tests/modules/nf-core/gridss/gridss/nextflow.config deleted file mode 100644 index 9b843bee987..00000000000 --- a/tests/modules/nf-core/gridss/gridss/nextflow.config +++ /dev/null @@ -1,10 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName: BWA_INDEX { - publishDir = [ - enabled: false - ] - } -} diff --git a/tests/modules/nf-core/gridss/gridss/test.yml b/tests/modules/nf-core/gridss/gridss/test.yml deleted file mode 100644 index ebbc758687e..00000000000 --- a/tests/modules/nf-core/gridss/gridss/test.yml +++ /dev/null @@ -1,43 +0,0 @@ -- name: gridss gridss test_gridss_gridss_bwa - command: nextflow run ./tests/modules/nf-core/gridss/gridss -entry test_gridss_gridss_bwa -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/gridss/gridss/nextflow.config - tags: - - gridss/gridss - - gridss - files: - - path: output/gridss/test.vcf.gz - md5sum: 6ac04867c8cbc05dc2d6ff9921df721e - - path: output/gridss/test.vcf.gz.assembly.bam - - path: output/gridss/versions.yml - -- name: gridss gridss test_gridss_gridss_no_bwa - command: nextflow run ./tests/modules/nf-core/gridss/gridss -entry test_gridss_gridss_no_bwa -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/gridss/gridss/nextflow.config - tags: - - gridss/gridss - - gridss - files: - - path: output/gridss/test.vcf.gz - md5sum: 6ac04867c8cbc05dc2d6ff9921df721e - - path: output/gridss/test.vcf.gz.assembly.bam - - path: output/gridss/versions.yml - -- name: gridss gridss test_gridss_gridss_assembly - command: nextflow run ./tests/modules/nf-core/gridss/gridss -entry test_gridss_gridss_assembly -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/gridss/gridss/nextflow.config - tags: - - gridss/gridss - - gridss - files: - - path: output/gridss/test.vcf.gz - md5sum: da92736933bc31554df1d085b17a3360 - - path: output/gridss/test.vcf.gz.assembly.bam - - path: output/gridss/versions.yml - -- name: gridss gridss test_gridss_gridss_cram - command: nextflow run ./tests/modules/nf-core/gridss/gridss -entry test_gridss_gridss_cram -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/gridss/gridss/nextflow.config - tags: - - gridss/gridss - - gridss - files: - - path: output/gridss/test.vcf.gz - md5sum: 6ac04867c8cbc05dc2d6ff9921df721e - - path: output/gridss/test.vcf.gz.assembly.bam - - path: output/gridss/versions.yml