From a5daeb29bbf439a43c9c01c69e02322eb4a75469 Mon Sep 17 00:00:00 2001
From: Blaise Li <blaise.li__git@nsup.org>
Date: Fri, 17 May 2019 18:38:12 +0200
Subject: [PATCH] Switch to newer rpy2.

Interface seems to have changed. There may still be missing changes.
---
 PRO-seq/PRO-seq.snakefile             |  5 +++--
 RNA_Seq_Cecere/RNA-seq.snakefile      |  5 +++--
 Ribo-seq/Ribo-seq.snakefile           | 10 ++++++----
 small_RNA-seq/small_RNA-seq.snakefile |  5 +++--
 4 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/PRO-seq/PRO-seq.snakefile b/PRO-seq/PRO-seq.snakefile
index c992b56..0f3ffef 100644
--- a/PRO-seq/PRO-seq.snakefile
+++ b/PRO-seq/PRO-seq.snakefile
@@ -1198,7 +1198,7 @@ rule merge_bigwig_reps:
 
 
 from rpy2.robjects import Formula, StrVector
-from rpy2.rinterface import RRuntimeError
+#from rpy2.rinterface import RRuntimeError
 rule differential_expression:
     input:
         counts_table = source_counts,
@@ -1227,7 +1227,8 @@ rule differential_expression:
                     contrast = StrVector(["lib", cond, ref])
                     formula = Formula("~ lib")
                     res, size_factors = do_deseq2(COND_NAMES, CONDITIONS, counts_data, formula=formula, contrast=contrast)
-                except RRuntimeError as e:
+                #except RRuntimeError as e:
+                except RuntimeError as e:
                     warnings.warn(
                         "Probably not enough usable data points to perform DESeq2 analyses:\n%s\nSkipping %s_%s_%s" % (
                             str(e), wildcards.contrast, wildcards.orientation, wildcards.biotype))
diff --git a/RNA_Seq_Cecere/RNA-seq.snakefile b/RNA_Seq_Cecere/RNA-seq.snakefile
index 9d94427..2cdada5 100644
--- a/RNA_Seq_Cecere/RNA-seq.snakefile
+++ b/RNA_Seq_Cecere/RNA-seq.snakefile
@@ -1733,7 +1733,7 @@ rule compute_RPM_folds:
 
 
 from rpy2.robjects import Formula, StrVector
-from rpy2.rinterface import RRuntimeError
+#from rpy2.rinterface import RRuntimeError
 rule differential_expression:
     input:
         counts_table = source_counts,
@@ -1769,7 +1769,8 @@ rule differential_expression:
             contrast = StrVector(["lib", cond, ref])
             try:
                 res, size_factors = do_deseq2(COND_NAMES, CONDITIONS, counts_data, formula=formula, contrast=contrast)
-            except RRuntimeError as e:
+            #except RRuntimeError as e:
+            except RuntimeError as e:
                 warnings.warn(
                     "Probably not enough usable data points to perform DESeq2 analyses:\n%s\nSkipping %s_%s_%s" % (
                         str(e), wildcards.contrast, wildcards.orientation, wildcards.biotype))
diff --git a/Ribo-seq/Ribo-seq.snakefile b/Ribo-seq/Ribo-seq.snakefile
index 6ccfee8..f9391b5 100644
--- a/Ribo-seq/Ribo-seq.snakefile
+++ b/Ribo-seq/Ribo-seq.snakefile
@@ -1052,7 +1052,7 @@ rule gather_read_counts_summaries:
 
 
 from rpy2.robjects import Formula, StrVector
-from rpy2.rinterface import RRuntimeError
+#from rpy2.rinterface import RRuntimeError
 rule differential_expression:
     input:
         counts_table = source_counts,
@@ -1092,7 +1092,8 @@ rule differential_expression:
             contrast = StrVector(["lib", cond, ref])
             try:
                 res, size_factors = do_deseq2(COND_NAMES, CONDITIONS, counts_data, formula=formula, contrast=contrast)
-            except RRuntimeError as e:
+            #except RRuntimeError as e:
+            except RuntimeError as e:
                 warnings.warn(
                     "Probably not enough usable data points to perform DESeq2 analyses:\n%s\nSkipping %s_%s_%s_%s" % (
                         str(e), wildcards.read_type, wildcards.contrast, wildcards.orientation, wildcards.biotype))
@@ -2575,7 +2576,7 @@ def plot_counts_scatters(counts_and_res, cols):
 ###################################################
 
 from rpy2.robjects import Formula, StrVector
-from rpy2.rinterface import RRuntimeError
+#from rpy2.rinterface import RRuntimeError
 rule small_RNA_differential_expression:
     input:
         counts_table = source_counts,
@@ -2611,7 +2612,8 @@ rule small_RNA_differential_expression:
             #    raise NotImplementedError("Unknown contrast: %s" % wildcards.contrast)
             try:
                 res, size_factors = do_deseq2(COND_NAMES, CONDITIONS, counts_data, formula=formula, contrast=contrast)
-            except RRuntimeError as e:
+            #except RRuntimeError as e:
+            except RuntimeError as e:
                 warn(
                     "Probably not enough usable data points to perform DESeq2 analyses:\n%s\nSkipping %s_%s_%s" % (
                         str(e), wildcards.contrast, wildcards.orientation, wildcards.small_type))
diff --git a/small_RNA-seq/small_RNA-seq.snakefile b/small_RNA-seq/small_RNA-seq.snakefile
index 8c51610..547017d 100644
--- a/small_RNA-seq/small_RNA-seq.snakefile
+++ b/small_RNA-seq/small_RNA-seq.snakefile
@@ -3636,7 +3636,7 @@ def plot_counts_scatters(counts_and_res, cols):
 ###################################################
 
 from rpy2.robjects import Formula, StrVector
-from rpy2.rinterface import RRuntimeError
+#from rpy2.rinterface import RRuntimeError
 rule small_RNA_differential_expression:
     input:
         counts_table = source_small_RNA_counts,
@@ -3668,7 +3668,8 @@ rule small_RNA_differential_expression:
                 contrast = StrVector(["lib", cond, ref])
                 try:
                     res, size_factors = do_deseq2(COND_NAMES, CONDITIONS, counts_data, formula=formula, contrast=contrast)
-                except RRuntimeError as e:
+                #except RRuntimeError as e:
+                except RuntimeError as e:
                     warn(
                         "Probably not enough usable data points to perform DESeq2 analyses:\n%s\nSkipping %s_%s_%s" % (
                             str(e), wildcards.contrast, wildcards.orientation, wildcards.small_type))
-- 
GitLab