From 14905fef3205fb79593fa54d4312494e5ca687b0 Mon Sep 17 00:00:00 2001
From: Claus Jonathan Fritzemeier <clausjonathan.fritzemeier@hhu.de>
Date: Wed, 17 Jun 2015 10:30:43 +0200
Subject: [PATCH] .parseboolean fix for empty gpr like "( )"

---
 R/parseBoolean.R | 18 ++++++------------
 inst/NEWS.Rd     |  1 +
 2 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/R/parseBoolean.R b/R/parseBoolean.R
index 2e4c77c..77c52c0 100644
--- a/R/parseBoolean.R
+++ b/R/parseBoolean.R
@@ -32,6 +32,7 @@
 
 
 .parseBoolean <- function(gprRule, tokens = "()&|~") {
+	print(gprRule)
 
 #.parseBoolean <- function(gprRule,
 #                          tokens = "()&|~",
@@ -41,6 +42,11 @@
   if ( is.na(gprRule) || (gprRule == "") ) {
       return(list(gene = "", rule = ""))
   }
+  
+  if( grepl("\\s*\\(\\s*\\)\\s*", gprRule) ){
+  	warning("found empty expression rule: '( )'. check if this is intended.")
+  	return(list(gene = "", rule = ""))
+  }
 
   # quit, if there is no gene association
 #  if ( (gprRule == "UNKNOWN") || (gprRule == "SPONTANEOUS") ) {
@@ -167,18 +173,6 @@
 
 
 
-
-
-
-
-
-
-
-
-
-
-
-
   
 #  for (i in 1:length(genes[[1]])) {
 #      #current_tok <- gsub("(^\\s+)|(\\s+$)", "", genes[[1]][i], perl = TRUE)
diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd
index 0182814..83b0820 100644
--- a/inst/NEWS.Rd
+++ b/inst/NEWS.Rd
@@ -14,6 +14,7 @@
     \item modified \code{multiDel} to not use \code{require}
     \item \code{doubleFluxDel} had a bug if \code{react1} or \code{react2} contained duplicated entries.
     \item documentation of \code{hasEffect} in \code{optsol_genedel} is now clearer.
+    \item \code{.parseBoolean} now gives a warning, but handles empty gpr in a intuitive way.
   }
 }
 
-- 
GitLab