From b95cdee776d670a0763313964ee2901882044600 Mon Sep 17 00:00:00 2001
From: "Gervaise H. Henry" <gervaise.henry@utsouthwestern.edu>
Date: Wed, 20 Jan 2021 00:34:18 -0600
Subject: [PATCH] Fix file structure error detection

---
 workflow/rna-seq.nf | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/workflow/rna-seq.nf b/workflow/rna-seq.nf
index f890b82..f15deb4 100644
--- a/workflow/rna-seq.nf
+++ b/workflow/rna-seq.nf
@@ -564,10 +564,11 @@ process fastqc {
     # run fastqc
     echo -e "LOG: running fastq on raw fastqs" >> ${repRID}.fastqc.log
     fastqcErrorOut=false
-    fastqc *.fastq.gz -o . || fastqcErrorOut=true
+    fastqc *.fastq.gz -o . &> fastqc.out || :
+    fastqcErrorOut=\$(cat fastqc.out | grep -c 'Failed to process file')
     fastqFileError=false
     fastqFileError_details=""
-    if [ "\${fastqcErrorOut}" == "true" ]
+    if [ "\${fastqcErrorOut}" -gt "0" ]
     then
       fastqFileError=true
       fastqFileError_details="**There is an error with the structure of the fastq**"
-- 
GitLab