From 6ceb75049893b95e93e2a8cb7a76e7d92bc32afd Mon Sep 17 00:00:00 2001
From: Blaise Li <blaise.li__git@nsup.org>
Date: Fri, 28 Oct 2022 11:36:53 +0200
Subject: [PATCH] Catching more errors due to bad data.

---
 RNA_Seq_Cecere/RNA-seq.snakefile | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/RNA_Seq_Cecere/RNA-seq.snakefile b/RNA_Seq_Cecere/RNA-seq.snakefile
index 663e409..165feb9 100644
--- a/RNA_Seq_Cecere/RNA-seq.snakefile
+++ b/RNA_Seq_Cecere/RNA-seq.snakefile
@@ -139,6 +139,10 @@ from smwrappers import wrappers_dir
 NO_DATA_ERRS = [
     "Empty 'DataFrame': no numeric data to plot",
     "no numeric data to plot"]
+BAD_DATA_ERRS = [
+    "`dataset` input should have multiple elements.",
+    "array must not contain infs or NaNs",
+    "zero-size array to reduction operation fmax which has no identity"]
 
 
 alignment_settings = {"bowtie2": "", "hisat2": "", "crac": "-k 20 --stranded --use-x-in-cigar"}
@@ -1673,12 +1677,7 @@ rule test_size_factor:
                         else:
                             raise
                     except ValueError as e:
-                        if str(e) == "`dataset` input should have multiple elements.":
-                            warn("\n".join([
-                                "Got ValueError:", f"{str(e)}",
-                                f"Data cannot be plotted for {normalizer}",
-                                f"{data}\n"]))
-                        elif str(e) == "array must not contain infs or NaNs":
+                        if str(e) in BAD_DATA_ERRS:
                             warn("\n".join([
                                 "Got ValueError:", f"{str(e)}",
                                 f"Data cannot be plotted for {normalizer}",
-- 
GitLab