GithubHelp home page GithubHelp logo

r2rahul / sybilmosek Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 284 KB

A RMosek optimization interface for the Sybil package

License: GNU General Public License v3.0

R 100.00%
fba r mosek rmosek cobra flux-balance-analysis mosek-solver sybil constraint-based-modeling metabolic-engineering

sybilmosek's Introduction

sybilMosek

sybilMosek is a R package, which connects RMosek Mosek v9.2 x64 bitsolver to the sybil package (Efficient Constrained Based Modelling in R). The package provides optimization support for the following problem types:

  • Linear Programming
  • Mixed Integer Programming
  • Quadratic Programming

SybilMosek draws inspiration from the package sybilGurobi, and interfaces RMosek optimization package to Sybil package for solving optimization problems related to Constraint Based Reconstruction and Analysis (COBRA) models.

Prerequisite Software

These packages must be installed before installing sybilMosek

  • sybil
  • Rmosek. The package is tested on the 64-bit Mosek Solver. So, please install 64 bit Mosek solver.
  • devtools

Installation Instructions

SybilMosek package can be installed through devtools package. The following code will check Sybil and devtools installation. If the packages are not installed, the code will install the packages.

list_packages <- c("sybil", "devtools")
if (length(setdiff(list_packages, rownames(installed.packages()))) > 0) {
  install.packages(setdiff(list_packages, rownames(installed.packages())),
  repos = "https://cloud.r-project.org")  
}

The package assumes that the licence for the Mosek solver is obtained and all the license setup is completed. Please check Mosek website for the license details. To install RMosek follow the instructions provided on the Mosek website Link. Again, the package is tested on 64 bit solver, so install x64 solver.

Now, everything is setup for installing sybilMosek.

library(devtools)

install_github('r2rahul/sybilMosek')

Alternatively,

devtools::install_github('r2rahul/sybilMosek')

Quick Start Guide

A quick linear optimization (LP) example from Sybil vignette [1]. The problem statement

The equivalent sybilMosek implementation

lp <- optObj(solver = "sybilMosek", method = "mosek")
lp <- initProb(lp)
cm <- Matrix(c(0.5, 2, 1, 1), nrow = 2)
loadLPprob(lp, nCols = 2, nRows = 2, mat = cm,
 lb = c(0, 0), ub = rep(1000, 2), obj = c(1, 1),
 rlb = c(0, 0), rub = c(4.5, 9), rtype = c("U", "U"),
 lpdir = "max")
status <- solveLp(lp)
getObjVal(lp)

Example Flux Balance Analysis (FBA)

Here is the example code for using sybilMosek for solving Flux Balance Analysis (FBA) using sybil.

  • Let us initialize the libraries
library(sybil)
library(sybilMosek)
  • Next, we will load the example model from the package sybil.
mp  <- system.file(package = "sybil", "extdata")
mod <- readTSVmod(prefix = "Ec_core", fpath = mp, quoteChar = "\"")
  • Finally, execute the model
optL <- optimizeProb(Ec_core, solver = "sybilMosek", method = "mosek")
summaryOptsol

To further explore the package please go through the package vignette.


library(sybilMosek)

browseVignettes(package = "sybilMosek")

vignette('quickstartsybilMosekR', package = "sybilMosek")

TODO

  • Update Vignettes
  • Add more COBRA tests.

Acknowledgement

The package was originally conceived during my post-doctoral research. Initially, the package was for my personal research. Over the years I further refined the code to be used by the users of Sybil ecosystem of packages.

References

[1] Gelius-Dietrich, G., Amer Desouki, A., Fritzemeier, C.J. and Lercher, M.J. "sybil โ€“ Efficient constraint-based modelling in R". BMC Systems Biology, 2013. 7:125. doi:10.1186/1752-0509-7-125

Article: http://www.biomedcentral.com/1752-0509/7/125

sybilmosek's People

Contributors

r2rahul avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.