From 435ca4100ac07d1932cd0cb38226b7c4b2109fc1 Mon Sep 17 00:00:00 2001 From: Mei Wu <25568561+projectoriented@users.noreply.github.com> Date: Thu, 20 Jan 2022 09:46:31 +0100 Subject: [PATCH] New module/vcfanno (#1204) * boilerplate * tests passed * fixed regex Co-authored-by: Chris Cheshire --- modules/vcfanno/main.nf | 34 ++++++++++++++++ modules/vcfanno/meta.yml | 56 +++++++++++++++++++++++++++ tests/config/pytest_modules.yml | 4 ++ tests/modules/vcfanno/main.nf | 19 +++++++++ tests/modules/vcfanno/nextflow.config | 5 +++ tests/modules/vcfanno/test.yml | 9 +++++ 6 files changed, 127 insertions(+) create mode 100644 modules/vcfanno/main.nf create mode 100644 modules/vcfanno/meta.yml create mode 100644 tests/modules/vcfanno/main.nf create mode 100644 tests/modules/vcfanno/nextflow.config create mode 100644 tests/modules/vcfanno/test.yml diff --git a/modules/vcfanno/main.nf b/modules/vcfanno/main.nf new file mode 100644 index 00000000..421fc0fa --- /dev/null +++ b/modules/vcfanno/main.nf @@ -0,0 +1,34 @@ +process VCFANNO { + tag "$meta.id" + label 'process_low' + + conda (params.enable_conda ? "bioconda::vcfanno=0.3.3" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/vcfanno:0.3.3--h9ee0642_0': + 'quay.io/biocontainers/vcfanno:0.3.3--h9ee0642_0' }" + + input: + tuple val(meta), path(vcf), path(tbi) + path vcfanno_config + + output: + tuple val(meta), path("*.vcf"), emit: vcf + path "versions.yml" , emit: versions + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + vcfanno \\ + -p $task.cpus \\ + $args \\ + $vcfanno_config \\ + $vcf \\ + > ${prefix}_annotated.vcf + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + vcfanno: \$(echo \$(vcfanno 2>&1 | grep version | cut -f3 -d' ' )) + END_VERSIONS + """ +} diff --git a/modules/vcfanno/meta.yml b/modules/vcfanno/meta.yml new file mode 100644 index 00000000..bbd2ab16 --- /dev/null +++ b/modules/vcfanno/meta.yml @@ -0,0 +1,56 @@ +name: vcfanno +description: quickly annotate your VCF with any number of INFO fields from any number of VCFs or BED files +keywords: + - vcf + - bed + - annotate + - variant +tools: + - vcfanno: + description: annotate a VCF with other VCFs/BEDs/tabixed files + homepage: None + documentation: https://github.com/brentp/vcfanno#vcfanno + tool_dev_url: https://github.com/brentp/vcfanno + doi: "10.1186/s13059-016-0973-5" + licence: ["MIT"] + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - vcf: + type: file + description: query VCF file + pattern: "*.{vcf.gz}" + - vcf.tbi: + type: file + description: query VCF file index + pattern: "*.{vcf.gz.tbi}" + - vcfanno_config: + type: file + description: | + A simple configuration file is used to specify both the source files + and the set of attributes (in the case of VCF) + or columns (in the case of BED or other tab-delimited formats) + that should be added to the query file. + pattern: "*.{toml}" + +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: Annotated VCF file + pattern: "*.{vcf}" + +authors: + - "@projectoriented" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index fc062e58..967b7d9f 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1493,6 +1493,10 @@ variantbam: - modules/variantbam/** - tests/modules/variantbam/** +vcfanno: + - modules/vcfanno/** + - tests/modules/vcfanno/** + vcflib/vcfuniq: - modules/vcflib/vcfuniq/** - tests/modules/vcflib/vcfuniq/** diff --git a/tests/modules/vcfanno/main.nf b/tests/modules/vcfanno/main.nf new file mode 100644 index 00000000..c46afa8f --- /dev/null +++ b/tests/modules/vcfanno/main.nf @@ -0,0 +1,19 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { VCFANNO } from '../../../modules/vcfanno/main.nf' + +workflow test_vcfanno { + + 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) + ] + + toml = file("https://raw.githubusercontent.com/nf-core/test-datasets/8fbd9f99a2feb3f9e39cd3bcdc4a9176a5835673/data/delete_me/vcfanno.toml", + checkIfExists: true) + + VCFANNO ( input, toml ) +} diff --git a/tests/modules/vcfanno/nextflow.config b/tests/modules/vcfanno/nextflow.config new file mode 100644 index 00000000..50f50a7a --- /dev/null +++ b/tests/modules/vcfanno/nextflow.config @@ -0,0 +1,5 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + +} \ No newline at end of file diff --git a/tests/modules/vcfanno/test.yml b/tests/modules/vcfanno/test.yml new file mode 100644 index 00000000..0b5394d2 --- /dev/null +++ b/tests/modules/vcfanno/test.yml @@ -0,0 +1,9 @@ +- name: vcfanno test_vcfanno + command: nextflow run tests/modules/vcfanno -entry test_vcfanno -c tests/config/nextflow.config + tags: + - vcfanno + files: + - path: output/vcfanno/test_annotated.vcf + md5sum: 34259cf6b0a4698a2917ad3554b50c0f + - path: output/vcfanno/versions.yml + md5sum: 62d13540503b22f04a2280c91942cb03