From 3d586b729d5862c9deab97852b0da8712454bf56 Mon Sep 17 00:00:00 2001
From: Claus Jonathan Fritzemeier <clausjonathan.fritzemeier@hhu.de>
Date: Tue, 17 May 2016 14:52:41 +0200
Subject: [PATCH] updated documentation for version modelorg

---
 NAMESPACE                   |  1 +
 R/upgradeModelorg.R         |  2 +-
 inst/NEWS.Rd                | 13 ++++++++-
 man/SYBIL_SETTINGS.Rd       | 13 ++++++---
 man/checkVersion-methods.Rd | 58 +++++++++++++++++++++++++++++++++++++
 man/modelorg-class.Rd       | 13 +++++++++
 man/upgradeModelorg.Rd      | 46 +++++++++++++++++++++++++++++
 7 files changed, 140 insertions(+), 6 deletions(-)
 create mode 100644 man/checkVersion-methods.Rd
 create mode 100644 man/upgradeModelorg.Rd

diff --git a/NAMESPACE b/NAMESPACE
index 737bebc..e782ef4 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -7,6 +7,7 @@ import(lattice)
 importFrom("grDevices", "colorRampPalette", "grey")
 importFrom("graphics", "arrows", "hist", "points", "polygon", "segments")
 importFrom("utils", "combn", "edit", "read.table", "str", "write.table")
+importFrom("utils", "compareVersion")
 
 exportPattern("^[^\\.]")
 
diff --git a/R/upgradeModelorg.R b/R/upgradeModelorg.R
index f85fa69..54031c1 100644
--- a/R/upgradeModelorg.R
+++ b/R/upgradeModelorg.R
@@ -38,7 +38,7 @@ upgradeModelorg <- function(object){
 		# just add version slot and run again.
 		object@version <- "2.0"
 		
-		rules <- lapply(gpr(object), sybil:::.parseBoolean)
+		rules <- lapply(gpr(object), .parseBoolean)
 		genes(object) <- sapply(rules, "[[", "gene")
 		gprRules(object) <- sapply(rules, "[[", "rule")
 		
diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd
index 69f03dd..37e5130 100644
--- a/inst/NEWS.Rd
+++ b/inst/NEWS.Rd
@@ -6,7 +6,18 @@
 
 \newcommand{\CRANpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}}
 
-
+\section{Changes in version 2.0.0 2016-05-17}{
+  \itemize{
+  	\item \code{modelorg}-class has changed and thus a slot \code{version} was introduced.
+  	the method \code{upgradeModelorg} can convert from earlier instances of this
+  	 class. This method is only needed if \code{modelorg}-Objects were loaded 
+  	 with \code{load} from disk. 
+    \item \code{gprRules} were stored in an impractical format. This lead to bugs
+    in \code{rmReact} and further \code{geneDel}.
+    \item updated the manual of various files.
+  }
+}
+% ---------------------------------------------------------------------------- %
 \section{Changes in version 1.3.4 2016-04-18}{
   \itemize{
     \item \code{doubleGeneDel} messed up the order of deletions when using exlicit gene lists.
diff --git a/man/SYBIL_SETTINGS.Rd b/man/SYBIL_SETTINGS.Rd
index 75810ed..471edb6 100644
--- a/man/SYBIL_SETTINGS.Rd
+++ b/man/SYBIL_SETTINGS.Rd
@@ -93,14 +93,15 @@
       for a particular \code{"SOLVER"}, the corresponding default value will
       be used in such a case.
     }
-    \item{\code{"TOLERANCE"}}{
-      Tolerance value.\cr
-      Default: \code{1E-6}.
-    }
     \item{\code{"MAXIMUM"}}{
       Absolute maximum value.\cr
       Default: \code{1000}.
     }
+    \item{\code{"MODELORG_VERSION"}}{
+      Currtent version of \code{modelorg}-Class.\cr
+      Value: \code{"2.0"}.\cr
+      This value must not be changed.
+    }
     \item{\code{"ALGORITHM"}}{
       Algorithm to use in order to analyze metabolic networks.
       Possible values are:
@@ -145,6 +146,10 @@
       (e.g. GLPK).\cr
       Default: \code{as.data.frame(NA)}.
     }
+    \item{\code{"TOLERANCE"}}{
+      Tolerance value.\cr
+      Default: \code{1E-6}.
+    }
   }
 }
 
diff --git a/man/checkVersion-methods.Rd b/man/checkVersion-methods.Rd
new file mode 100644
index 0000000..528c275
--- /dev/null
+++ b/man/checkVersion-methods.Rd
@@ -0,0 +1,58 @@
+\name{checkVersion-methods}
+
+\docType{methods}
+\encoding{utf8}
+
+\alias{checkVersion}
+\alias{checkVersion-methods}
+\alias{checkVersion,modelorg}
+\alias{checkVersion,modelorg-method}
+
+\title{checks Version of modelorg}
+
+\description{
+  Checks the Version of the modelorg.
+}
+
+\usage{
+\S4method{checkVersion}{modelorg}(object)
+}
+
+\section{Methods}{
+  \describe{
+    \item{\code{signature(object = "modelorg")}}{
+      method to use with objects of class \code{\linkS4class{modelorg}}.
+    }
+  }
+}
+
+\arguments{
+  \item{object}{
+    An object of class \code{\linkS4class{modelorg}} or of class
+    \code{\linkS4class{summaryOptsol}}.
+  }
+}
+
+\details{
+  This method checks whether this instance of a modelorg-Class is of the currently
+  used version. All methods of sybil create the correct version of modelorg, but 
+  if objects saved to disk may be of an older version. Current version can be 
+  obtained by \code{SYBIL_SETTINGS("VERSION")}.
+}
+
+\author{
+  Claus Jonathan Fritzemeier <clausjonathan.fritzemeier@uni-duesseldorf.de>
+}
+
+
+\value{
+  Returns \code{TRUE} if the version is correct. Otherwise returns a character 
+  stating the reason.
+}
+
+\seealso{
+  Class \code{\linkS4class{modelorg}}, 
+  method \code{\link{upgradeModelorg}} and \code{\link{SYBIL_SETTINGS}}
+}
+
+\keyword{methods}
diff --git a/man/modelorg-class.Rd b/man/modelorg-class.Rd
index 2b34679..c76921d 100644
--- a/man/modelorg-class.Rd
+++ b/man/modelorg-class.Rd
@@ -118,6 +118,10 @@
 \alias{uppbnd,modelorg-method}
 \alias{uppbnd<-}
 \alias{uppbnd}
+\alias{version<-,modelorg-method}
+\alias{version,modelorg-method}
+\alias{version<-}
+\alias{version}
 
 \encoding{utf8}
 
@@ -160,6 +164,9 @@
     \item{\code{mod_name}:}{
       Object of class \code{"character"} indicating the model name.
     }
+    \item{\code{version}:}{
+      Object of class \code{"character"} indicating the model version.
+    }
     \item{\code{mod_id}:}{
       Object of class \code{"character"} indicating the model id.
     }
@@ -430,6 +437,12 @@
     \item{\code{uppbnd}:}{
       \code{signature(object = "modelorg")}: gets the \code{uppbnd} slot.
     }
+    \item{\code{version<-}:}{
+      \code{signature(object = "modelorg")}: sets the \code{version} slot.
+    }
+    \item{\code{version}:}{
+      \code{signature(object = "modelorg")}: gets the \code{version} slot.
+    }
   }
 }
 
diff --git a/man/upgradeModelorg.Rd b/man/upgradeModelorg.Rd
new file mode 100644
index 0000000..45073b3
--- /dev/null
+++ b/man/upgradeModelorg.Rd
@@ -0,0 +1,46 @@
+\name{upgradeModelorg}
+\alias{upgradeModelorg}
+
+\encoding{utf8}
+
+\title{
+  Upgrade modelorg to newer version.
+}
+\description{
+  Performs necessary changes to the object to promote it to a newer version.
+}
+\usage{
+  upgradeModelorg(object)
+}
+
+\arguments{
+  \item{object}{
+    An object of class \code{\linkS4class{modelorg}}.
+  }
+}
+
+\details{
+	This method performs the necessary changes on a modelorg object to promote 
+	it to a newer version.
+	
+	Changes from previous modelorg version (no version slot set) to version 2.0:
+	Representation in the gprRules slot is now incompatible to the earlier versions.
+}
+
+\value{
+  An object of class \code{\linkS4class{modelorg}}, matching the current 
+  version requirements used by sybil.
+}
+
+\author{
+  Claus Jonathan Fritzemeier <clausjonathan.fritzemeier@uni-duesseldorf.de>
+}
+
+
+\examples{
+	data(Ec_core)
+	upgradeModelorg(Ec_core)
+}
+
+\keyword{upgrade, version}
+
-- 
GitLab