From 30f72e24822576c6f90a0bf9db678b403c70eccf Mon Sep 17 00:00:00 2001 From: Anders Sune Pedersen <37172585+asp8200@users.noreply.github.com> Date: Wed, 15 Jun 2022 13:52:12 +0200 Subject: [PATCH] Optional output from the VEP-moduel (#1775) * Making the output from the VEP-moduel (ENSEMBLVEP) optionally vcf, json or tab. #1774 * Trying to fix tests * Still trying to fix tests * Fetching the vep-output-file-extension from the args. * Update meta.yml * WIP: Adding tests for vep-output json and tab * updated the test.yml Co-authored-by: nvnieuwk <101190534+nvnieuwk@users.noreply.github.com> Co-authored-by: nvnieuwk --- modules/ensemblvep/main.nf | 17 +++++------ modules/ensemblvep/meta.yml | 14 +++++++-- tests/modules/ensemblvep/main.nf | 37 ++++++++++++++++++++++++ tests/modules/ensemblvep/nextflow.config | 14 +++++++++ tests/modules/ensemblvep/test.yml | 28 ++++++++++++++++-- 5 files changed, 97 insertions(+), 13 deletions(-) diff --git a/modules/ensemblvep/main.nf b/modules/ensemblvep/main.nf index d2efe35f..391a182d 100644 --- a/modules/ensemblvep/main.nf +++ b/modules/ensemblvep/main.nf @@ -17,25 +17,26 @@ process ENSEMBLVEP { path extra_files output: - tuple val(meta), path("*.ann.vcf"), emit: vcf - path "*.summary.html" , emit: report - path "versions.yml" , emit: versions + tuple val(meta), path("*.ann.vcf") , optional:true, emit: vcf + tuple val(meta), path("*.ann.tab") , optional:true, emit: tab + tuple val(meta), path("*.ann.json") , optional:true, emit: json + path "*.summary.html" , emit: report + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when script: def args = task.ext.args ?: '' + def file_extension = args.contains("--vcf") ? 'vcf' : args.contains("--json")? 'json' : args.contains("--tab")? 'tab' : 'vcf' def prefix = task.ext.prefix ?: "${meta.id}" def dir_cache = cache ? "\${PWD}/${cache}" : "/.vep" def reference = fasta ? "--fasta $fasta" : "" """ - mkdir $prefix - vep \\ -i $vcf \\ - -o ${prefix}.ann.vcf \\ + -o ${prefix}.ann.${file_extension} \\ $args \\ $reference \\ --assembly $genome \\ @@ -44,10 +45,8 @@ process ENSEMBLVEP { --cache_version $cache_version \\ --dir_cache $dir_cache \\ --fork $task.cpus \\ - --vcf \\ - --stats_file ${prefix}.summary.html + --stats_file ${prefix}.summary.html \\ - rm -rf $prefix cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/ensemblvep/meta.yml b/modules/ensemblvep/meta.yml index 9891815d..a4dde8a6 100644 --- a/modules/ensemblvep/meta.yml +++ b/modules/ensemblvep/meta.yml @@ -1,5 +1,5 @@ name: ENSEMBLVEP -description: Ensembl Variant Effect Predictor (VEP) +description: Ensembl Variant Effect Predictor (VEP). The output-file-format is controlled through `task.ext.args`. keywords: - annotation tools: @@ -49,8 +49,18 @@ output: - vcf: type: file description: | - annotated vcf + annotated vcf (optional) pattern: "*.ann.vcf" + - tab: + type: file + description: | + tab file with annotated variants (optional) + pattern: "*.ann.tab" + - json: + type: file + description: | + json file with annotated variants (optional) + pattern: "*.ann.json" - report: type: file description: VEP report file diff --git a/tests/modules/ensemblvep/main.nf b/tests/modules/ensemblvep/main.nf index 3c8afada..9aaa47a3 100644 --- a/tests/modules/ensemblvep/main.nf +++ b/tests/modules/ensemblvep/main.nf @@ -4,6 +4,43 @@ nextflow.enable.dsl = 2 include { ENSEMBLVEP } from '../../../modules/ensemblvep/main.nf' +include { ENSEMBLVEP as ENSEMBLVEP_JSON } from '../../../modules/ensemblvep/main.nf' +include { ENSEMBLVEP as ENSEMBLVEP_TAB } from '../../../modules/ensemblvep/main.nf' +include { ENSEMBLVEP as ENSEMBLVEP_VCF } from '../../../modules/ensemblvep/main.nf' + +workflow test_ensemblvep_fasta_json { + input = [ + [ id:'test' ], // meta map + file(params.test_data['sarscov2']['illumina']['test_vcf'], checkIfExists: true) + ] + + fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + + ENSEMBLVEP_JSON ( input, "WBcel235", "caenorhabditis_elegans", "104", [], fasta, [] ) +} + +workflow test_ensemblvep_fasta_tab { + input = [ + [ id:'test' ], // meta map + file(params.test_data['sarscov2']['illumina']['test_vcf'], checkIfExists: true) + ] + + fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + + ENSEMBLVEP_TAB ( input, "WBcel235", "caenorhabditis_elegans", "104", [], fasta, [] ) +} + +workflow test_ensemblvep_fasta_vcf { + input = [ + [ id:'test' ], // meta map + file(params.test_data['sarscov2']['illumina']['test_vcf'], checkIfExists: true) + ] + + fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + + ENSEMBLVEP_VCF ( input, "WBcel235", "caenorhabditis_elegans", "104", [], fasta, [] ) +} + workflow test_ensemblvep_fasta { input = [ [ id:'test' ], // meta map diff --git a/tests/modules/ensemblvep/nextflow.config b/tests/modules/ensemblvep/nextflow.config index f13d62e9..42aeb5ee 100644 --- a/tests/modules/ensemblvep/nextflow.config +++ b/tests/modules/ensemblvep/nextflow.config @@ -6,4 +6,18 @@ process { container = 'nfcore/vep:104.3.WBcel235' } + withName: ENSEMBLVEP_JSON { + container = 'nfcore/vep:104.3.WBcel235' + ext.args = '--json' + } + + withName: ENSEMBLVEP_TAB { + container = 'nfcore/vep:104.3.WBcel235' + ext.args = '--tab' + } + + withName: ENSEMBLVEP_VCF { + container = 'nfcore/vep:104.3.WBcel235' + ext.args = '--vcf' + } } diff --git a/tests/modules/ensemblvep/test.yml b/tests/modules/ensemblvep/test.yml index 7e94d5fc..5620b9ee 100644 --- a/tests/modules/ensemblvep/test.yml +++ b/tests/modules/ensemblvep/test.yml @@ -1,5 +1,29 @@ +- name: ensemblvep test_ensemblvep_fasta_json + command: nextflow run ./tests/modules/ensemblvep -entry test_ensemblvep_fasta_json -c ./tests/config/nextflow.config -c ./tests/modules/ensemblvep/nextflow.config + tags: + - ensemblvep + files: + - path: output/ensemblvep/test.ann.json + - path: output/ensemblvep/test.summary.html + +- name: ensemblvep test_ensemblvep_fasta_tab + command: nextflow run ./tests/modules/ensemblvep -entry test_ensemblvep_fasta_tab -c ./tests/config/nextflow.config -c ./tests/modules/ensemblvep/nextflow.config + tags: + - ensemblvep + files: + - path: output/ensemblvep/test.ann.tab + - path: output/ensemblvep/test.summary.html + +- name: ensemblvep test_ensemblvep_fasta_vcf + command: nextflow run ./tests/modules/ensemblvep -entry test_ensemblvep_fasta_vcf -c ./tests/config/nextflow.config -c ./tests/modules/ensemblvep/nextflow.config + tags: + - ensemblvep + files: + - path: output/ensemblvep/test.ann.vcf + - path: output/ensemblvep/test.summary.html + - name: ensemblvep test_ensemblvep_fasta - command: nextflow run ./tests/modules/ensemblvep -entry test_ensemblvep_fasta -c ./tests/config/nextflow.config -c ./tests/modules/ensemblvep/nextflow.config + command: nextflow run ./tests/modules/ensemblvep -entry test_ensemblvep_fasta -c ./tests/config/nextflow.config -c ./tests/modules/ensemblvep/nextflow.config tags: - ensemblvep files: @@ -7,7 +31,7 @@ - path: output/ensemblvep/test.summary.html - name: ensemblvep test_ensemblvep_no_fasta - command: nextflow run ./tests/modules/ensemblvep -entry test_ensemblvep_no_fasta -c ./tests/config/nextflow.config -c ./tests/modules/ensemblvep/nextflow.config + command: nextflow run ./tests/modules/ensemblvep -entry test_ensemblvep_no_fasta -c ./tests/config/nextflow.config -c ./tests/modules/ensemblvep/nextflow.config tags: - ensemblvep files: