From 7907df5bfb4843a80352e8de18265c7331c4ba8a Mon Sep 17 00:00:00 2001 From: Matthew Marshall Date: Wed, 29 Nov 2023 15:49:02 -0500 Subject: [PATCH] Add an early check that two paths are provided when providing a comma-separated list. --- workflows/ampliseq.nf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/workflows/ampliseq.nf b/workflows/ampliseq.nf index 3a332326..a99e71f9 100644 --- a/workflows/ampliseq.nf +++ b/workflows/ampliseq.nf @@ -61,7 +61,12 @@ if (params.dada_ref_tax_custom) { if (params.qiime_ref_tax_custom) { if ("${params.qiime_ref_tax_custom}".contains(",")) { - ch_qiime_ref_taxonomy = Channel.fromPath(Arrays.asList("${params.qiime_ref_tax_custom}".split(",")), checkIfExists: true) + qiime_ref_paths = "${params.qiime_ref_tax_custom}".split(",") + if (qiime_ref_paths.length != 2) { + error "--qiime_ref_tax_custom accepts a single filepath to a directory or tarball, or two files paths separated by a comma. Please review input." + } + + ch_qiime_ref_taxonomy = Channel.fromPath(Arrays.asList(qiime_ref_paths), checkIfExists: true) } else { ch_qiime_ref_taxonomy = Channel.fromPath("${params.qiime_ref_tax_custom}", checkIfExists: true) }