From dbbbac3011e1bff6d893c3f6596daeb755156c6d Mon Sep 17 00:00:00 2001 From: Laurent Modolo <laurent.modolo@ens-lyon.fr> Date: Wed, 14 Apr 2021 18:52:31 +0200 Subject: [PATCH] CONTRIBUTING.md: add info on channel creation --- CONTRIBUTING.md | 17 +++++++++++++++++ src/nf_modules/bowtie2/main.nf | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e40f4a60..1f341df9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -130,6 +130,23 @@ If you want to use information within the `file_id` to name outputs in your `scr ``` and use the `file_prefix` variable. +This also means that channel emitting `path` item should be transformed with at least the following map function: + +``` +.map { it -> [it.simpleName, it]} +```` + +for example: + +``` +channel + .fromPath( params.fasta ) + .ifEmpty { error "Cannot find any fasta files matching: ${params.fasta}" } + .map { it -> [it.simpleName, it]} + .set { fasta_files } +``` + + The rational behind taking a `file_id` and emitting the same `file_id` is to facilitate complex channel operations in pipelines without having to rewrite the `process` blocks. ### dealing with paired-end and single-end data diff --git a/src/nf_modules/bowtie2/main.nf b/src/nf_modules/bowtie2/main.nf index 1dc0780d..efd0ceb3 100644 --- a/src/nf_modules/bowtie2/main.nf +++ b/src/nf_modules/bowtie2/main.nf @@ -46,7 +46,7 @@ process mapping_fastq { tuple val(file_id), path(reads) output: - tuple val(file_id), path("*.bam"), emit: bam + tuple val(), path("*.bam"), emit: bam path "*_report.txt", emit: report script: -- GitLab