diff --git a/modules/ensemblvep/main.nf b/modules/ensemblvep/main.nf index 8a2c6363..fd2c893a 100644 --- a/modules/ensemblvep/main.nf +++ b/modules/ensemblvep/main.nf @@ -17,11 +17,14 @@ process ENSEMBLVEP { path extra_files output: - 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 + 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 + tuple val(meta), path("*.ann.vcf.gz") , optional:true, emit: vcf_gz + tuple val(meta), path("*.ann.tab.gz") , optional:true, emit: tab_gz + tuple val(meta), path("*.ann.json.gz") , optional:true, emit: json_gz + path "*.summary.html" , emit: report + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when @@ -29,6 +32,7 @@ process ENSEMBLVEP { script: def args = task.ext.args ?: '' def file_extension = args.contains("--vcf") ? 'vcf' : args.contains("--json")? 'json' : args.contains("--tab")? 'tab' : 'vcf' + def compress_out = args.contains("--compress_output") ? '.gz' : '' def prefix = task.ext.prefix ?: "${meta.id}" def dir_cache = cache ? "\${PWD}/${cache}" : "/.vep" def reference = fasta ? "--fasta $fasta" : "" @@ -36,7 +40,7 @@ process ENSEMBLVEP { """ vep \\ -i $vcf \\ - -o ${prefix}.ann.${file_extension} \\ + -o ${prefix}.ann.${file_extension}${compress_out} \\ $args \\ $reference \\ --assembly $genome \\ @@ -48,6 +52,23 @@ process ENSEMBLVEP { --stats_file ${prefix}.summary.html \\ + cat <<-END_VERSIONS > versions.yml + "${task.process}": + ensemblvep: \$( echo \$(vep --help 2>&1) | sed 's/^.*Versions:.*ensembl-vep : //;s/ .*\$//') + END_VERSIONS + """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.ann.vcf + touch ${prefix}.ann.tab + touch ${prefix}.ann.json + touch ${prefix}.ann.vcf.gz + touch ${prefix}.ann.tab.gz + touch ${prefix}.ann.json.gz + touch ${prefix}.summary.html + cat <<-END_VERSIONS > versions.yml "${task.process}": ensemblvep: \$( echo \$(vep --help 2>&1) | sed 's/^.*Versions:.*ensembl-vep : //;s/ .*\$//') diff --git a/tests/modules/ensemblvep/main.nf b/tests/modules/ensemblvep/main.nf index 9e7d87ef..8854d1a2 100644 --- a/tests/modules/ensemblvep/main.nf +++ b/tests/modules/ensemblvep/main.nf @@ -7,6 +7,8 @@ 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' +include { ENSEMBLVEP as ENSEMBLVEP_VCF_BGZIP } from '../../../modules/ensemblvep/main.nf' +include { ENSEMBLVEP as ENSEMBLVEP_VCF_GZIP } from '../../../modules/ensemblvep/main.nf' workflow test_ensemblvep_fasta_json { input = [ @@ -41,6 +43,28 @@ workflow test_ensemblvep_fasta_vcf { ENSEMBLVEP_VCF ( input, "WBcel235", "caenorhabditis_elegans", "106", [], fasta, [] ) } +workflow test_ensemblvep_fasta_vcf_bgzip { + 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_BGZIP ( input, "WBcel235", "caenorhabditis_elegans", "106", [], fasta, [] ) +} + +workflow test_ensemblvep_fasta_vcf_gzip { + 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_GZIP ( input, "WBcel235", "caenorhabditis_elegans", "106", [], 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 1138725b..93b5158b 100644 --- a/tests/modules/ensemblvep/nextflow.config +++ b/tests/modules/ensemblvep/nextflow.config @@ -20,4 +20,14 @@ process { container = 'nfcore/vep:106.1.WBcel235' ext.args = '--vcf' } + + withName: ENSEMBLVEP_VCF_BGZIP { + container = 'nfcore/vep:106.1.WBcel235' + ext.args = '--vcf --compress_output bgzip' + } + + withName: ENSEMBLVEP_VCF_GZIP { + container = 'nfcore/vep:106.1.WBcel235' + ext.args = '--vcf --compress_output gzip' + } } diff --git a/tests/modules/ensemblvep/test.yml b/tests/modules/ensemblvep/test.yml index 5620b9ee..dedd5619 100644 --- a/tests/modules/ensemblvep/test.yml +++ b/tests/modules/ensemblvep/test.yml @@ -22,6 +22,22 @@ - path: output/ensemblvep/test.ann.vcf - path: output/ensemblvep/test.summary.html +- name: ensemblvep test_ensemblvep_fasta_vcf_bgzip + command: nextflow run ./tests/modules/ensemblvep -entry test_ensemblvep_fasta_vcf_bgzip -c ./tests/config/nextflow.config -c ./tests/modules/ensemblvep/nextflow.config + tags: + - ensemblvep + files: + - path: output/ensemblvep/test.ann.vcf.gz + - path: output/ensemblvep/test.summary.html + +- name: ensemblvep test_ensemblvep_fasta_vcf_gzip + command: nextflow run ./tests/modules/ensemblvep -entry test_ensemblvep_fasta_vcf_gzip -c ./tests/config/nextflow.config -c ./tests/modules/ensemblvep/nextflow.config + tags: + - ensemblvep + files: + - path: output/ensemblvep/test.ann.vcf.gz + - 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 tags: @@ -37,3 +53,11 @@ files: - path: output/ensemblvep/test.ann.vcf - path: output/ensemblvep/test.summary.html + +- name: ensemblvep test_ensemblvep_fasta_vcf_stub + command: nextflow run ./tests/modules/ensemblvep -entry test_ensemblvep_fasta_vcf -c ./tests/config/nextflow.config -c ./tests/modules/ensemblvep/nextflow.config -stub + tags: + - ensemblvep + files: + - path: output/ensemblvep/test.ann.vcf + - path: output/ensemblvep/test.summary.html