From 6d5f1fac60a5b0b64d264f587e84ececb7760c39 Mon Sep 17 00:00:00 2001 From: Maxime Garcia Date: Tue, 20 Feb 2018 14:43:14 +0100 Subject: [PATCH] add params: outDir and name + factorize script --- main.nf | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/main.nf b/main.nf index 5436d24..f5d1d3d 100755 --- a/main.nf +++ b/main.nf @@ -27,10 +27,12 @@ Maxime Garcia [@MaxUlysse] if (!nextflow.version.matches('>= 0.25.3')) exit 1, "Nextflow version 0.25.3 or greater is needed to run this workflow" -version = '2.0' +version = '2.0.1' params.help = false params.version = false +params.outDir = baseDir +params.name = '' if (params.help) exit 0, helpMessage() if (params.version) exit 0, versionMessage() @@ -54,7 +56,7 @@ startMessage() process RunXelatex { tag {tex} - publishDir ".", mode: 'move' + publishDir params.outDir, mode: 'move' input: file biblio @@ -65,22 +67,16 @@ process RunXelatex { file("*.pdf") into pdf script: - scriptString = tex.baseName.startsWith("CV") ? "cp ${tex.baseName}.pdf CV-MGarcia-latest.pdf" : "" - - if (biblio.exists()) - """ - xelatex -shell-escape ${tex} - biber ${tex.baseName}.bcf - xelatex -shell-escape ${tex} - xelatex -shell-escape ${tex} - ${scriptString} - """ - else - """ - xelatex -shell-escape ${tex} - xelatex -shell-escape ${tex} - ${scriptString} - """ + xelatexScript = "xelatex -shell-escape ${tex}" + biblioScript = biblio.exists() ? "biber ${tex.baseName}.bcf ; ${xelatexScript}" : "" + nameScript = params.name == '' ? "" : "cp ${tex.baseName}.pdf ${params.name}" + + """ + ${xelatexScript} + ${biblioScript} + ${xelatexScript} + ${nameScript} + """ } /*