Skip to content

Commit

Permalink
Optional output from the VEP-moduel (#1775)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Co-authored-by: nvnieuwk <[email protected]>
  • Loading branch information
3 people authored Jun 15, 2022
1 parent 9dbafff commit 30f72e2
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 13 deletions.
17 changes: 8 additions & 9 deletions modules/ensemblvep/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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 \\
Expand All @@ -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}":
Expand Down
14 changes: 12 additions & 2 deletions modules/ensemblvep/meta.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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
Expand Down
37 changes: 37 additions & 0 deletions tests/modules/ensemblvep/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions tests/modules/ensemblvep/nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}
28 changes: 26 additions & 2 deletions tests/modules/ensemblvep/test.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,37 @@
- 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:
- path: output/ensemblvep/test.ann.vcf
- 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:
Expand Down

0 comments on commit 30f72e2

Please sign in to comment.