diff --git a/modules/nf-core/vt/decomposeblocksub/environment.yml b/modules/nf-core/vt/decomposeblocksub/environment.yml new file mode 100644 index 00000000000..3f2cbb9b9e1 --- /dev/null +++ b/modules/nf-core/vt/decomposeblocksub/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::vt=2015.11.10" diff --git a/modules/nf-core/vt/decomposeblocksub/main.nf b/modules/nf-core/vt/decomposeblocksub/main.nf new file mode 100644 index 00000000000..8bd77bcfe16 --- /dev/null +++ b/modules/nf-core/vt/decomposeblocksub/main.nf @@ -0,0 +1,59 @@ +process VT_DECOMPOSEBLOCKSUB { + tag "$meta.id" + label 'process_low' + + // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/vt:2015.11.10--h5ef6573_4': + 'biocontainers/vt:2015.11.10--h5ef6573_4' }" + + input: + tuple val(meta), path(vcf), path(index), path(intervals) + + output: + tuple val(meta), path("*.vcf.gz") , emit: vcf + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def args2 = task.ext.args2 ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + + if ("$vcf" == "${prefix}.vcf.gz") { + error "Input and output names are the same, set prefix in module configuration to disambiguate!" + } + + def bed = intervals ? "-i ${intervals}" : "" + """ + vt decompose_blocksub \\ + -o ${prefix}.vcf.gz \\ + ${bed} \\ + ${args} \\ + ${vcf} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + vt: \$(echo \$(vt decompose_blocksub 2>&1 | grep 'decompose_blocksub v' | sed -n 's/.*decompose_blocksub v\\([0-9]\\+\\.[0-9]\\+\\).*/\\1/p' )) + END_VERSIONS + """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + + if ("$vcf" == "${prefix}.vcf.gz") { + error "Input and output names are the same, set prefix in module configuration to disambiguate!" + } + + """ + touch ${prefix}.vcf.gz + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + vt: \$(echo \$(vt decompose_blocksub 2>&1 | grep 'decompose_blocksub v' | sed -n 's/.*decompose_blocksub v\\([0-9]\\+\\.[0-9]\\+\\).*/\\1/p' )) + END_VERSIONS + """ +} diff --git a/modules/nf-core/vt/decomposeblocksub/meta.yml b/modules/nf-core/vt/decomposeblocksub/meta.yml new file mode 100644 index 00000000000..39d67b84ebb --- /dev/null +++ b/modules/nf-core/vt/decomposeblocksub/meta.yml @@ -0,0 +1,63 @@ +name: "vt_decomposeblocksub" +description: Decomposes biallelic block substitutions into its constituent SNPs. +keywords: + - decomposeblocksub + - multiallelic + - small variants + - snps + - indels + - block substitutions +tools: + - "vt": + description: "A tool set for short variant discovery in genetic sequence data" + homepage: "https://genome.sph.umich.edu/wiki/Vt" + documentation: "https://genome.sph.umich.edu/wiki/Vt" + tool_dev_url: "https://github.com/atks/vt" + licence: ["MIT"] + identifier: "" +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'test', single_end:false ]` + - vcf: + type: file + description: The VCF file to decompose + pattern: "*.vcf(.gz)?" + ontologies: + - edam: "http://edamontology.org/format_3016" + - index: + type: file + description: The VCF file to decompose + pattern: "*.tbi" + ontologies: + - edam: "http://edamontology.org/format_3616" + - intervals: + type: file + description: The intervals of the variants of decompose + pattern: "*.bed" + ontologies: + - edam: "http://edamontology.org/format_3003" +output: + - vcf: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'test', single_end:false ]` + - "*.vcf.gz": + type: file + description: The decomposed VCF file + pattern: "*.vcf.gz" + ontologies: + - edam: "http://edamontology.org/format_3016" + - versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@kubranarci" +maintainers: + - "@kubranarci" diff --git a/modules/nf-core/vt/decomposeblocksub/tests/main.nf.test b/modules/nf-core/vt/decomposeblocksub/tests/main.nf.test new file mode 100644 index 00000000000..67b61ee3377 --- /dev/null +++ b/modules/nf-core/vt/decomposeblocksub/tests/main.nf.test @@ -0,0 +1,62 @@ + +nextflow_process { + + name "Test Process VT_DECOMPOSEBLOCKSUB" + script "../main.nf" + process "VT_DECOMPOSEBLOCKSUB" + config "./nextflow.config" + + tag "modules" + tag "modules_nfcore" + tag "vt" + tag "vt/decomposeblocksub" + + test("test-vt-decomposeblocksub") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz.tbi', checkIfExists: true), + [] + ] + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("test-vt-decomposeblocksub-intervals") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf', checkIfExists: true), + [], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/bed/test.bed', checkIfExists: true) + ] + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + +} diff --git a/modules/nf-core/vt/decomposeblocksub/tests/main.nf.test.snap b/modules/nf-core/vt/decomposeblocksub/tests/main.nf.test.snap new file mode 100644 index 00000000000..a5de36ab4d6 --- /dev/null +++ b/modules/nf-core/vt/decomposeblocksub/tests/main.nf.test.snap @@ -0,0 +1,72 @@ +{ + "test-vt-decomposeblocksub-intervals": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "decomposeblocksub.vcf.gz:md5,6dd85c7989b945dccb0a834c2c05407a" + ] + ], + "1": [ + "versions.yml:md5,2e541ec639f0458804a6cd3a58211f66" + ], + "vcf": [ + [ + { + "id": "test", + "single_end": false + }, + "decomposeblocksub.vcf.gz:md5,6dd85c7989b945dccb0a834c2c05407a" + ] + ], + "versions": [ + "versions.yml:md5,2e541ec639f0458804a6cd3a58211f66" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.2" + }, + "timestamp": "2024-12-03T09:38:47.060601884" + }, + "test-vt-decomposeblocksub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "decomposeblocksub.vcf.gz:md5,6dd85c7989b945dccb0a834c2c05407a" + ] + ], + "1": [ + "versions.yml:md5,2e541ec639f0458804a6cd3a58211f66" + ], + "vcf": [ + [ + { + "id": "test", + "single_end": false + }, + "decomposeblocksub.vcf.gz:md5,6dd85c7989b945dccb0a834c2c05407a" + ] + ], + "versions": [ + "versions.yml:md5,2e541ec639f0458804a6cd3a58211f66" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.2" + }, + "timestamp": "2024-12-03T09:38:24.537448596" + } +} \ No newline at end of file diff --git a/modules/nf-core/vt/decomposeblocksub/tests/nextflow.config b/modules/nf-core/vt/decomposeblocksub/tests/nextflow.config new file mode 100644 index 00000000000..c9c00888849 --- /dev/null +++ b/modules/nf-core/vt/decomposeblocksub/tests/nextflow.config @@ -0,0 +1,6 @@ +process { + withName: VT_DECOMPOSEBLOCKSUB { + ext.prefix = "decomposeblocksub" + ext.args = "-a" + } +}