From 9496c2dbc387360ed9e448d327e4876c2a178d2d Mon Sep 17 00:00:00 2001
From: Laurent Modolo <laurent.modolo@ens-lyon.fr>
Date: Thu, 2 Aug 2018 17:03:29 +0200
Subject: [PATCH] FastQC: add id_file var for single-end like for paired-end

---
 src/nf_modules/FastQC/fastqc.nf              | 5 +++--
 src/nf_modules/FastQC/tests/fastqc_single.nf | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/nf_modules/FastQC/fastqc.nf b/src/nf_modules/FastQC/fastqc.nf
index 2a725f4..6e90d45 100644
--- a/src/nf_modules/FastQC/fastqc.nf
+++ b/src/nf_modules/FastQC/fastqc.nf
@@ -18,15 +18,16 @@ log.info "fastq files : ${params.fastq}"
 Channel
   .fromPath( params.fastq )
   .ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" }
+  .map { it -> [(it.baseName =~ /([^\.]*)/)[0][1], it]}
   .set { fastq_files }
 
 process fastqc_fastq {
-  tag "$reads.baseName"
+  tag "$file_id"
   publishDir "results/fastq/fastqc/", mode: 'copy'
   cpus = 1
 
   input:
-    file reads from fastq_files
+  set file_id, file(reads) from fastq_files
 
   output:
     file "*.{zip,html}" into fastqc_report
diff --git a/src/nf_modules/FastQC/tests/fastqc_single.nf b/src/nf_modules/FastQC/tests/fastqc_single.nf
index 318d20c..4598416 100644
--- a/src/nf_modules/FastQC/tests/fastqc_single.nf
+++ b/src/nf_modules/FastQC/tests/fastqc_single.nf
@@ -5,15 +5,16 @@ log.info "fastq files : ${params.fastq}"
 Channel
   .fromPath( params.fastq )
   .ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" }
+  .map { it -> [(it.baseName =~ /([^\.]*)/)[0][1], it]}
   .set { fastq_files }
 
 process fastqc_fastq {
-  tag "$reads.baseName"
+  tag "$file_id"
   publishDir "results/fastq/fastqc/", mode: 'copy'
   cpus = 1
 
   input:
-    file reads from fastq_files
+  set file_id, file(reads) from fastq_files
 
   output:
     file "*.{zip,html}" into fastqc_report
-- 
GitLab