diff --git a/modules/vcflib/vcfuniq/main.nf b/modules/vcflib/vcfuniq/main.nf new file mode 100644 index 00000000..37fc51bc --- /dev/null +++ b/modules/vcflib/vcfuniq/main.nf @@ -0,0 +1,32 @@ +def VERSION = '1.0.2' // Version information not provided by tool on CLI + +process VCFLIB_VCFUNIQ { + tag "$meta.id" + label 'process_low' + + conda (params.enable_conda ? "bioconda::vcflib=1.0.2" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/vcflib:1.0.2--h3198e80_5': + 'quay.io/biocontainers/vcflib:1.0.2--h3198e80_5' }" + + input: + tuple val(meta), path(vcf), path(tbi) + + output: + tuple val(meta), path("*.gz"), emit: vcf + path "versions.yml" , emit: versions + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + vcfuniq \\ + $vcf \\ + | bgzip -c $args > ${prefix}.vcf.gz + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + vcflib: $VERSION + END_VERSIONS + """ +} diff --git a/modules/vcflib/vcfuniq/meta.yml b/modules/vcflib/vcfuniq/meta.yml new file mode 100644 index 00000000..3bfc679b --- /dev/null +++ b/modules/vcflib/vcfuniq/meta.yml @@ -0,0 +1,46 @@ +name: vcflib_vcfuniq +description: List unique genotypes. Like GNU uniq, but for VCF records. Remove records which have the same position, ref, and alt as the previous record. +keywords: + - vcf + - uniq + - deduplicate +tools: + - vcflib: + description: Command-line tools for manipulating VCF files + homepage: https://github.com/vcflib/vcflib + documentation: https://github.com/vcflib/vcflib#USAGE + doi: "https://doi.org/10.1101/2021.05.21.445151" + licence: ['MIT'] + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - vcf: + type: file + description: Compressed VCF file + pattern: "*.vcf.gz" + - tbi: + type: file + description: Index of VCF file + pattern: "*.vcf.gz.tbi" + +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - vcf: + type: file + description: Compressed VCF file + pattern: "*.vcf.gz" + +authors: + - "@drpatelh" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 2938d311..cc95a06c 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1485,6 +1485,10 @@ variantbam: - modules/variantbam/** - tests/modules/variantbam/** +vcflib/vcfuniq: + - modules/vcflib/vcfuniq/** + - tests/modules/vcflib/vcfuniq/** + vcftools: - modules/vcftools/** - tests/modules/vcftools/** diff --git a/tests/modules/vcflib/vcfuniq/main.nf b/tests/modules/vcflib/vcfuniq/main.nf new file mode 100644 index 00000000..f2c8e6f8 --- /dev/null +++ b/tests/modules/vcflib/vcfuniq/main.nf @@ -0,0 +1,16 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { VCFLIB_VCFUNIQ } from '../../../../modules/vcflib/vcfuniq/main.nf' + +workflow test_vcflib_vcfuniq { + + input = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_vcf_gz'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test_vcf_gz_tbi'], checkIfExists: true) + ] + + VCFLIB_VCFUNIQ ( input ) +} diff --git a/tests/modules/vcflib/vcfuniq/nextflow.config b/tests/modules/vcflib/vcfuniq/nextflow.config new file mode 100644 index 00000000..ca824085 --- /dev/null +++ b/tests/modules/vcflib/vcfuniq/nextflow.config @@ -0,0 +1,9 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + + withName: VCFLIB_VCFUNIQ { + ext.prefix = { "${meta.id}.uniq" } + } + +} diff --git a/tests/modules/vcflib/vcfuniq/test.yml b/tests/modules/vcflib/vcfuniq/test.yml new file mode 100644 index 00000000..6d998225 --- /dev/null +++ b/tests/modules/vcflib/vcfuniq/test.yml @@ -0,0 +1,8 @@ +- name: vcflib vcfuniq + command: nextflow run ./tests/modules/vcflib/vcfuniq -entry test_vcflib_vcfuniq -c ./tests/config/nextflow.config -c ./tests/modules/vcflib/vcfuniq/nextflow.config + tags: + - vcflib + - vcflib/vcfuniq + files: + - path: output/vcflib/test.uniq.vcf.gz + md5sum: fc178eb342a91dc0d1d568601ad8f8e2