From de1f89691d947ad3dda16fed0361dab471d0a31d Mon Sep 17 00:00:00 2001 From: dweemx Date: Thu, 17 Sep 2020 10:26:21 +0200 Subject: [PATCH] Allow to use list of globs/file paths when using multi-labelled groups in h5ad param Update related docs --- docs/pipelines.rst | 7 +++++-- src/channels/channels.nf | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/pipelines.rst b/docs/pipelines.rst index 54b74f1e..f6c637af 100644 --- a/docs/pipelines.rst +++ b/docs/pipelines.rst @@ -620,7 +620,7 @@ In the generated .config file, make sure the ``file_paths`` parameter is set wit - The ``suffix`` parameter is used to infer the sample name from the file paths (it is removed from the input file path to derive a sample name). -In case there are multiple .h5ad files that need to be processed with different suffixes, the following strategy should be used to define the h5ad param:: +In case there are multiple .h5ad files that need to be processed with different suffixes, the multi-labelled strategy should be used to define the h5ad param:: [...] data { @@ -637,7 +637,10 @@ In case there are multiple .h5ad files that need to be processed with different } [...] -Note: ``GROUP1``, ``GROUP2`` are just example names here. They can be replaced by any value as long as they are alphanumeric (underscores are allowed). +Notes: + +- ``GROUP1``, ``GROUP2`` are just example names here. They can be replaced by any value as long as they are alphanumeric (underscores are allowed). +- ``file_paths`` and ``suffix`` do allow list of paths/globs in the multi-labelled strategy. ---- diff --git a/src/channels/channels.nf b/src/channels/channels.nf index 8866bc9c..f01a8463 100644 --- a/src/channels/channels.nf +++ b/src/channels/channels.nf @@ -87,8 +87,8 @@ workflow getDataChannel { def filePaths = null def suffix = null if(!dataH5ad.containsKey("file_paths") && !dataH5ad.containsKey("suffix")) { - filePaths = dataH5ad.collect { k,v -> v["file_paths"] } - suffix = dataH5ad.collect { k,v -> v["suffix"] } + filePaths = dataH5ad.collect { k,v -> v["file_paths"] }.flatten() + suffix = dataH5ad.collect { k,v -> v["suffix"] }.flatten() } else { filePaths = dataH5ad.file_paths suffix = dataH5ad.suffix