process VEP {
tag "$vcf.simpleName"
publishDir params.outdir, mode: 'copy'
input:
path vcf
path cache // staged as an input so it is visible inside the container
path plugin_data // assets/NO_FILE when plugins are not configured
output:
path "${vcf.simpleName}.vep.tsv", emit: tsv
path "${vcf.simpleName}.vep_summary.html"
script:
// Plugins run only when --vep_plugin_data names a directory holding the plugin modules
// (INSTALL.pl -a p -g CADD,AlphaMissense -r
) and the data files named in params.
def plugins = plugin_data.name == 'NO_FILE' ? '' : [
"--dir_plugins ${plugin_data}",
"--plugin CADD,snv=${plugin_data}/${params.cadd_snv},indels=${plugin_data}/${params.cadd_indels}",
"--plugin AlphaMissense,file=${plugin_data}/${params.alphamissense}",
].join(' ')
// --everything needs the cache (it implies --af_gnomade and friends); the database offers a
// smaller set, but still the consequence, gene, HGVS and ClinVar fields the loader stores.
def source = params.vep_database ? "--database" : "--cache --offline --dir_cache ${cache}"
def fields = params.vep_database ? "--symbol --hgvs --canonical --biotype --variant_class --check_existing" : "--everything"
"""
vep -i $vcf -o ${vcf.simpleName}.vep.tsv --tab \\
--assembly ${params.assembly} ${source} \\
${fields} --pick ${plugins} \\
--stats_file ${vcf.simpleName}.vep_summary.html --fork ${task.cpus}
"""
stub:
"""
touch ${vcf.simpleName}.vep.tsv ${vcf.simpleName}.vep_summary.html
"""
}