Skip to content
Snippets Groups Projects
Commit ebc6a448 authored by Mayo Roettger's avatar Mayo Roettger
Browse files

Version 2.2.0. Fixed two functions calling closeAllConnection. Added...

Version 2.2.0. Fixed two functions calling closeAllConnection. Added functionality of setSolverParm and getSolverParm methods for clpAPI. Updated URLs and corrected keyword definition.
parent b68a5e76
Branches
No related tags found
No related merge requests found
Package: sybil
Type: Package
Title: Efficient Constrained Based Modelling
Version: 2.1.5
Date: 2019-03-07
Version: 2.2.0
Date: 2021-05-31
Authors@R: c(
person("Mayo", "Roettger", role = c("cre"), email = "mayo.roettger@hhu.de"),
person("Gabriel", "Gelius-Dietrich", role = "aut"),
......@@ -18,7 +18,7 @@ Imports: methods
Suggests: glpkAPI (>= 1.2.8), cplexAPI (>= 1.2.4), clpAPI (>= 1.2.4),
lpSolveAPI (>= 5.5.2.0), parallel, grid
URL:
http://www.cs.hhu.de/lehrstuehle-und-arbeitsgruppen/computational-cell-biology/software/sybil.html
https://www.cs.hhu.de/lehrstuehle-und-arbeitsgruppen/computational-cell-biology/software-contributions/sybil
Description: This Systems Biology Package (Gelius-Dietrich et. al. (2012) <doi:10.1186/1752-0509-7-125>) implements algorithms for constraint based analyses of metabolic networks, e.g. flux-balance analysis (FBA), minimization of metabolic adjustment (MOMA), regulatory on/off minimization (ROOM), robustness analysis and flux variability analysis. The package is easily extendable for additional algorithms. Most of the current LP/MILP solvers are supported via additional packages.
LazyLoad: yes
License: GPL-3 | file LICENSE
......@@ -56,7 +56,7 @@ Collate: generics.R validmodelorg.R validoptsol.R validreactId.R validreact.R
sysBiolAlg_mtfClass.R sysBiolAlg_mtfEasyConstraintClass.R
sysBiolAlg_roomClass.R sybilLogClass.R upgradeModelorg.R
mergeReact2Modelorg.R
Packaged: 2019-03-07 10:20:00 UTC; mayo
Packaged: 2021-05-31 10:32:00 UTC; mayo
Author: Mayo Roettger [cre],
Gabriel Gelius-Dietrich [aut],
C. Jonathan Fritzemeier [ctb],
......
......@@ -38,8 +38,6 @@ modelorg2ExPA <- function(model,
suffix = "expa",
tol = SYBIL_SETTINGS("TOLERANCE")) {
on.exit( closeAllConnections() )
if (!is(model, "modelorg")) {
stop("needs an object of class modelorg!")
}
......@@ -57,8 +55,9 @@ modelorg2ExPA <- function(model,
fh <- try(file(tofile, "wt"), silent = TRUE)
if (is(fh, "try-error")) {
warning("cannot write ExPA file!")
fh <- FALSE
stop("cannot write ExPA file ", sQuote(fh))
} else {
on.exit(close(fh))
}
# exclude reactions
......@@ -171,12 +170,6 @@ modelorg2ExPA <- function(model,
}
# ------------------------------------------------------------------------ #
if (is(fh, "file")) {
close(fh)
}
#--------------------------------------------------------------------------#
# end
#--------------------------------------------------------------------------#
......
......@@ -36,7 +36,6 @@ modelorg2tsv <- function(model, prefix, suffix, extMetFlag = "b",
fpath = SYBIL_SETTINGS("PATH_TO_MODEL"),
...) {
## on.exit( closeAllConnections() )
if (!is(model, "modelorg")) {
stop("needs an object of class modelorg!")
......
......@@ -107,25 +107,45 @@ setMethod("backupProb", signature(lp = "optObj_clpAPI"),
setMethod("setSolverParm", signature(lp = "optObj_clpAPI"),
function(lp, solverParm) {
# at the moment, only parameters 'numberIterations', 'maximumIterations',
# and 'maximumSeconds' can be set by this function. In clpAPI,
# these are actually set by three individual functions. In order to
# stay similar to e.g. cplexAPI, we also use the setSolverParm method
# for clpAPI in sybil.
out <- NULL
out <- FALSE
if ( ! ((is.data.frame(solverParm)) || (is.list(solverParm))) ) {
stop(sQuote(solverParm), " must be list or data.frame")
}
wrong_solver_msg(lp, "setSolverParm")
if (any(is.na(solverParm))) {
stop(sQuote(solverParm), " contains NA values")
}
# if ( ! ((is.data.frame(solverParm)) || (is.list(solverParm))) ) {
# stop(sQuote(solverParm), " must be list or data.frame")
# }
#
# if (any(is.na(solverParm))) {
# stop(sQuote(solverParm), " contains NA values")
# }
numericParm <- sapply(solverParm, is.numeric)
num <- solverParm[numericParm]
if (length(num) != length(solverParm)) {
stop(sQuote(solverParm), " contains non numeric values")
}
# no parameters in COIN-OR CLP yet.
# lp@oobj <- clpAPI::initProbCLP()
# clpAPI::setLogLevelCLP(lp@oobj, 0)
if (length(num) > 0) {
# get parameter names:
numericp <- names(num)
return(out)
for (i in seq(along = num)) {
if (numericp[i] == "numberIterations") {
out <- clpAPI::setNumberIterationsCLP(lp@oobj, num[["numberIterations"]])
} else if (numericp[i] == "maximumIterations") {
out <- clpAPI::setMaximumIterationsCLP(lp@oobj, num[["maximumIterations"]])
} else if (numericp[i] == "maximumSeconds") {
out <- clpAPI::setMaximumSecondsCLP(lp@oobj, num[["maximumSeconds"]])
} else {
stop(sQuote("solverParm"), " contains unknown parameter ", sQuote(numericp))
}
}
}
return(out)
}
)
......@@ -138,9 +158,14 @@ setMethod("getSolverParm", signature(lp = "optObj_clpAPI"),
out <- FALSE
wrong_solver_msg(lp, "getSolverParm")
out <- list(
"hitMaximumIterations" = clpAPI::getHitMaximumIterationsCLP(lp@oobj),
"maximumIterations" = clpAPI::getMaximumIterationsCLP(lp@oobj),
"maximumSeconds" = clpAPI::getMaximumSecondsCLP(lp@oobj)
)
return(out)
}
)
......
......@@ -124,8 +124,11 @@ setMethod("setSolverParm", signature(lp = "optObj_cplexAPI"),
intdbl <- sapply(solverParm, is.integer)
strparm <- sapply(solverParm, is.numeric)
# parameters of type integer:
int <- solverParm[intdbl]
# parameters of type double:
dbl <- solverParm[intdbl == FALSE & strparm == TRUE]
# parameters of type character:
char <- solverParm[strparm == FALSE]
if (length(int) > 0) {
......@@ -137,6 +140,7 @@ setMethod("setSolverParm", signature(lp = "optObj_cplexAPI"),
}
if (length(dbl) > 0) {
# get
dblp <- sapply(names(dbl), function(x) eval(parse(text = x)))
dblv <- unlist(dbl)
for (i in seq(along = dbl)) {
......
......@@ -85,12 +85,16 @@
# number of entries
num_genes <- length(genes)
# vector with unique gene numbers like "x[1]", "x[2]", "x[1]", ...
# a unique vector with all genes
gene_uniq <- unique(genes)
newTok <- match(genes, gene_uniq)
newTok <- sapply(newTok, function(x) paste("x[", x, "]", sep = ""))
# rule <-
#bla <- rbind(genes, newTok)
......@@ -98,8 +102,9 @@
#rule <- apply(bla, 2, function(x) gsub(x[1], x[2], rule, fixed = TRUE))
#apply(bla, 1, function(x) print(x[1]))
for (i in 1:num_genes) {
# replace gene names in rule by their newTok string (which is x[gene_number]):
for (i in 1:num_genes) {
rule <- sub(genes[i], newTok[i], rule, fixed = TRUE)
#start <- gregexpr(genes[i], gpr, fixed = TRUE)
#start <- start[[1]]
......@@ -208,6 +213,8 @@
# gene = "bla"
# rule = "blubber"
# return vector with unique gene names and the rule where numbers correspond to unique gene names
return(list(gene = gene_uniq, rule = rule))
}
......
......@@ -37,8 +37,6 @@ promptSysBiolAlg <- function(algorithm,
stopifnot(is(algorithm, "character"))
on.exit( closeAllConnections() )
# classname
cname <- paste(prefix, algorithm, sep = sep)
......@@ -52,6 +50,8 @@ promptSysBiolAlg <- function(algorithm,
if (is(sbfh, "try-error")) {
stop("can not write to file ", sQuote(sbfh))
} else {
on.exit(close(sbfh))
}
#--------------------------------------------------------------------------#
......@@ -168,10 +168,6 @@ promptSysBiolAlg <- function(algorithm,
# end
#--------------------------------------------------------------------------#
if ( (is(sbfh, "file")) && (isOpen(sbfh)) ) {
close(sbfh)
}
message("created file ", sQuote(sbfile))
return(invisible(NULL))
......
......@@ -13,7 +13,7 @@ citEntry(
year = "2013",
number = "1",
pages = "125",
url = "http://www.biomedcentral.com/1752-0509/7/125",
url = "https://bmcsystbiol.biomedcentral.com/articles/10.1186/1752-0509-7-125",
doi = "10.1186/1752-0509-7-125",
issn = "1752-0509",
textVersion = "Gelius-Dietrich, G. et al. (2013) sybil - Efficient constraint-based modelling in R. BMC Syst Biol 7(1):125"
......
......@@ -7,6 +7,24 @@
\newcommand{\CRANpkg}{\href{https://CRAN.R-project.org/package=#1}{\pkg{#1}}}
% ---------------------------------------------------------------------------- %
\section{Changes in version 2.2.0 2021-05-31}{
\itemize{
\item Changes to functions \code{modelorg2ExPA} and \code{promptSysBiolAlg},
where \code{closeAllConnections} was called \code{on.exit} of the function.
The two functions now only close the connections that they have opened.
\item It is now possible to use the functions \code{setSolverParm} and
\code{getSolverParm} in combination with package \code{clpAPI} to set the
number of iterations, to set or get the maximum number of iterations or
maximum number of seconds and to check, if the maximum number of iterations
(or time) was hit. See also \code{setSolverParm-methods} and
\code{getSolverParm-methods} in the manual.
\item Updated URLs in DESCRIPTION, inst/CITATION and inst/NEWS.Rd and
corrected keyword definition for CRAN submission.
\
}
}
% ---------------------------------------------------------------------------- %
\section{Changes in version 2.1.5 2019-03-07}{
\itemize{
\item Minor changes removing invalid URLs for CRAN submission.
......@@ -43,7 +61,7 @@
\section{Changes in version 2.1.1 2018-07-17}{
\itemize{
\item Package sybilSBML gets rejected on CRAN, but can be downloaded
at \url{http://www.cs.hhu.de/en/research-groups/computational-cell-biology/software.html}.
at \url{https://www.cs.hhu.de/en/research-groups/computational-cell-biology/software.html}.
\item Documentation for \code{react-class} and related methods.
\
}
......
......@@ -30,9 +30,13 @@
\section{Methods}{
\describe{
\item{\code{signature(lp = "optObj_clpAPI")}}{
method to use with package \pkg{optObj_clpAPI}. This method is currently
unused. It is not possible to provide parameters for package \pkg{clpAPI}.
Always \code{FALSE} will be returned.
method to use with package \pkg{optObj_clpAPI}. This method calls
functions \code{clpAPI::getHitMaximumIterationsCLP},
\code{clpAPI::getMaximumIterationsCLP} and \code{clpAPI::getMaximumSecondsCLP}
and returns a list containing \code{hitMaximumIterations},
\code{maximumIterations} and \code{maximumSeconds} respectively.
\code{hitMaximumIterations} should be TRUE, if maximum number of
iteration (or time) bound was hit.
}
\item{\code{signature(lp = "optObj_cplexAPI")}}{
method to use with package \pkg{optObj_cplexAPI}. This method writes
......
......@@ -34,9 +34,11 @@
\section{Methods}{
\describe{
\item{\code{signature(lp = "optObj_clpAPI")}}{
method to use with package \pkg{optObj_clpAPI}. This method is currently
unused. It is not possible to provide parameters for package \pkg{clpAPI}.
Always \code{FALSE} will be returned.
method to use with package \pkg{optObj_clpAPI}. It is possible
to set \code{numberIterations}, \code{maximumIterations} and
\code{maximumSeconds}, which call the respective functions
\code{setNumberIterationsCLP}, \code{setMaximumIterationsCLP} and
\code{setMaximumSecondsCLP} in clpAPI.
}
\item{\code{signature(lp = "optObj_cplexAPI")}}{
method to use with package \pkg{optObj_cplexAPI}. In order to set
......
......@@ -44,5 +44,6 @@
upgradeModelorg(Ec_core)
}
\keyword{upgrade, version}
\keyword{upgrade}
\keyword{version}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment