From c28fcce24b0a7aa58cf4fbe5b1b59e835c5cb21d Mon Sep 17 00:00:00 2001
From: "Gervaise H. Henry" <gervaise.henry@utsouthwestern.edu>
Date: Tue, 19 Jan 2021 22:47:57 -0600
Subject: [PATCH] Fix fastq file error detection

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

diff --git a/workflow/rna-seq.nf b/workflow/rna-seq.nf
index f9c9b3a..d45ae8b 100644
--- a/workflow/rna-seq.nf
+++ b/workflow/rna-seq.nf
@@ -558,15 +558,18 @@ process fastqc {
 
     # run fastqc
     echo -e "LOG: running fastq on raw fastqs" >> ${repRID}.fastqc.log
-    fastqc *.fastq.gz -o . 2> fastqcErrorOut.txt
-    fastqcErrorOut=\$(cat fastqcErrorOut.txt | grep -o 'Failed to process file')
+    fastqcErrorOut=false
+    fastqc *.fastq.gz -o . || fastqcErrorOut=true
     fastqFileError=false
     fastqFileError_details=""
-    if [ "\${fastqcErrorOut}" != "" ]
+    if [ "\${fastqcErrorOut}" == "true" ]
     then
       fastqFileError=true
       fastqFileError_details="**There is an error with the structure of the fastq**"
+      echo -e "LOG: There is an error with the structure of the fastq" >> ${repRID}.fastqc.log
       touch dummy_fastqc.zip
+    else
+      echo -e "LOG: The structure of the fastq is correct" >> ${repRID}.fastqc.log
     fi
 
     # count raw reads
-- 
GitLab