diff --git a/modules/nf-core/svtools/vcftobedpe/environment.yml b/modules/nf-core/svtools/vcftobedpe/environment.yml new file mode 100644 index 00000000000..b06a00bd5be --- /dev/null +++ b/modules/nf-core/svtools/vcftobedpe/environment.yml @@ -0,0 +1,7 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - "bioconda::svtools=0.5.1" diff --git a/modules/nf-core/svtools/vcftobedpe/main.nf b/modules/nf-core/svtools/vcftobedpe/main.nf new file mode 100644 index 00000000000..98560e2a013 --- /dev/null +++ b/modules/nf-core/svtools/vcftobedpe/main.nf @@ -0,0 +1,46 @@ +process SVTOOLS_VCFTOBEDPE { + tag "$meta.id" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/svtools:0.5.1--py_0': + 'biocontainers/svtools:0.5.1--py_0' }" + + input: + tuple val(meta), path(vcf) + + output: + tuple val(meta), path("*.bedpe"), emit: bedpe + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: "" + def prefix = task.ext.prefix ?: "${meta.id}" + """ + svtools vcftobedpe \\ + $args + --input $vcf \\ + --output ${prefix}.bedpe \\ + --tempdir ./tmp + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + svtools: \$(svtools --version |& sed '1!d ; s/svtools //') + END_VERSIONS + """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.bedpe + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + svtools: \$(svtools --version |& sed '1!d ; s/svtools //') + END_VERSIONS + """ +} diff --git a/modules/nf-core/svtools/vcftobedpe/meta.yml b/modules/nf-core/svtools/vcftobedpe/meta.yml new file mode 100644 index 00000000000..f42dfa1a2fa --- /dev/null +++ b/modules/nf-core/svtools/vcftobedpe/meta.yml @@ -0,0 +1,49 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "svtools_vcftobedpe" +description: Convert a VCF file to a BEDPE file. +keywords: + - structural + - bedpe + - vcf + - conversion + - variants +tools: + - "svtools": + description: "Tools for processing and analyzing structural variants" + tool_dev_url: "https://github.com/hall-lab/svtools" + licence: ['MIT License'] + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - vcf: + type: file + description: Input VCF file containing structural variants + pattern: "*.{vcf,vcf.gz}" + +output: + - bedpe: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.bedpe": + type: file + description: The converted BEDPE file + pattern: "*.bedpe" + + - versions: + - "versions.yml": + type: file + description: File containing software versions + pattern: "versions.yml" + +authors: + - "@nvnieuwk" +maintainers: + - "@nvnieuwk" diff --git a/modules/nf-core/svtools/vcftobedpe/tests/main.nf.test b/modules/nf-core/svtools/vcftobedpe/tests/main.nf.test new file mode 100644 index 00000000000..c5b4c2ef8de --- /dev/null +++ b/modules/nf-core/svtools/vcftobedpe/tests/main.nf.test @@ -0,0 +1,58 @@ +nextflow_process { + + name "Test Process SVTOOLS_VCFTOBEDPE" + script "../main.nf" + process "SVTOOLS_VCFTOBEDPE" + + tag "modules" + tag "modules_nfcore" + tag "svtools" + tag "svtools/vcftobedpe" + + test("homo_sapiens - vcf") { + + when { + process { + """ + input[0] = [ + [ id:'test'], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/NA24385_sv.vcf.gz', checkIfExists: true), + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("homo_sapiens - vcf - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test'], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/NA24385_sv.vcf.gz', checkIfExists: true), + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/svtools/vcftobedpe/tests/main.nf.test.snap b/modules/nf-core/svtools/vcftobedpe/tests/main.nf.test.snap new file mode 100644 index 00000000000..3299ccf560b --- /dev/null +++ b/modules/nf-core/svtools/vcftobedpe/tests/main.nf.test.snap @@ -0,0 +1,68 @@ +{ + "homo_sapiens - vcf": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.bedpe:md5,78e3231e39d534d26ba32f64f8f5e094" + ] + ], + "1": [ + "versions.yml:md5,1af4f5a32bfc89f4d6d6c94cf1d4afd8" + ], + "bedpe": [ + [ + { + "id": "test" + }, + "test.bedpe:md5,78e3231e39d534d26ba32f64f8f5e094" + ] + ], + "versions": [ + "versions.yml:md5,1af4f5a32bfc89f4d6d6c94cf1d4afd8" + ] + } + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.4" + }, + "timestamp": "2025-02-06T16:08:14.1286306" + }, + "homo_sapiens - vcf - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.bedpe:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,1af4f5a32bfc89f4d6d6c94cf1d4afd8" + ], + "bedpe": [ + [ + { + "id": "test" + }, + "test.bedpe:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,1af4f5a32bfc89f4d6d6c94cf1d4afd8" + ] + } + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.4" + }, + "timestamp": "2025-02-06T16:08:21.008497589" + } +} \ No newline at end of file