Commit c024da26 authored by St. Elmo's avatar St. Elmo
Browse files

new equilibrator strategy

parent c5b92ade
using Documenter, CobraTools
makedocs(
sitename="CobraTools.jl",
authors = "St. Elmo Wilken",
......
......@@ -20,8 +20,7 @@ To install this package: `] add CobraTools`.
Some of the features used in this package require external programs to be installed. These are described below:
* To import Matlab formatted models you will need `MATLAB.jl` installed and a working Matlab. Refer to the documentation of `MATLAB.jl` for installation instructions.
* The Equilibrator interface requires that the Equilibrator-API has been installed and can be accessed through Julia's PyCall package. Refer to the [Equilibrator-API website](https://gitlab.com/equilibrator/equilibrator-api) for installation instructions. Within Julia, if you can call `pyimport("equilibrator_api")` successfully, then you will be able to use the functions exposed here.
* The Equilibrator interface requires that the Equilibrator-API has been installed and can be accessed through Julia's PyCall package. Refer to the [Equilibrator-API website](https://gitlab.com/equilibrator/equilibrator-api) for installation instructions. Within Julia, if you can call `pyimport("equilibrator_api")` successfully, then you will be able to use the functions exposed here. To actually use the functions insert `using PyCall` in your main level script (before or after `using CobraTools`).
* To extract turnover numbers, Km, Kcat/Km and Ki from the Brenda database, you will need to download the database as a txt file [available here](https://www.brenda-enzymes.org/download_brenda_without_registration.php) (~250 MB).
The optimization solvers are implemented through `JuMP` and thus this package should be solver agnostic. All tests are conducted using `Gurobi.jl` but other solvers should work.
......
......@@ -20,6 +20,7 @@ include("io_tools.jl")
include("construction_tools.jl")
include("brenda_tools.jl")
include("equilibrator_tools.jl")
# include("basic_analysis.jl")
# include("sampling_tools.jl")
......
using PyCall
@eval py"""
from equilibrator_api import ComponentContribution, Q_
cc = ComponentContribution()
def pygetdg0(fs, ph, ionic):
cc.p_h = Q_(ph) # set pH
cc.ionic_strength = Q_(ionic) # set I
bals = []
mags = []
errs = []
for f in fs:
try:
rxn = cc.parse_reaction_formula(f)
isbal = rxn.is_balanced()
bals += [isbal]
mags += [cc.standard_dg(rxn).value.magnitude]
errs += [cc.standard_dg(rxn).error.magnitude]
except:
bals += [False]
mags += [0.0]
errs += [0.0]
return bals, mags, errs
def pygetdgprime(fs, ph, ionic):
cc.p_h = Q_(ph) # set pH
cc.ionic_strength = Q_(ionic) # set I
bals = []
mags = []
errs = []
for f in fs:
try:
rxn = cc.parse_reaction_formula(f)
isbal = rxn.is_balanced()
bals += [isbal]
mags += [cc.standard_dg_prime(rxn).value.magnitude]
errs += [cc.standard_dg_prime(rxn).error.magnitude]
except:
bals += [False]
mags += [0.0]
errs += [0.0]
return bals, mags, errs
def pygetdgprimephys(fs, ph, ionic):
cc.p_h = Q_(ph) # set pH
cc.ionic_strength = Q_(ionic) # set I
bals = []
mags = []
errs = []
for f in fs:
try:
rxn = cc.parse_reaction_formula(f)
isbal = rxn.is_balanced()
bals += [isbal]
mags += [cc.physiological_dg_prime(rxn).value.magnitude]
errs += [cc.physiological_dg_prime(rxn).error.magnitude]
except:
bals += [False]
mags += [0.0]
errs += [0.0]
return bals, mags, errs
"""
"""
build_rxn_string(rxn::Reaction, compoundtype="kegg")
build_rxn_string(rxn::Reaction, compoundtype="kegg")
Get rxn in string format for Equilibrator.
"""
......
function __init__()
@require PyCall="438e738f-606a-5dbb-bf0a-cddfbfd45ab0" include("equilibrator_tools.jl") # only add the equilibrator functions if PyCall is brought into scope
py"""
try:
from equilibrator_api import ComponentContribution, Q_
cc = ComponentContribution()
def pygetdg0(fs, ph, ionic):
cc.p_h = Q_(ph) # set pH
cc.ionic_strength = Q_(ionic) # set I
bals = []
mags = []
errs = []
for f in fs:
try:
rxn = cc.parse_reaction_formula(f)
isbal = rxn.is_balanced()
bals += [isbal]
mags += [cc.standard_dg(rxn).value.magnitude]
errs += [cc.standard_dg(rxn).error.magnitude]
except:
bals += [False]
mags += [0.0]
errs += [0.0]
return bals, mags, errs
def pygetdgprime(fs, ph, ionic):
cc.p_h = Q_(ph) # set pH
cc.ionic_strength = Q_(ionic) # set I
bals = []
mags = []
errs = []
for f in fs:
try:
rxn = cc.parse_reaction_formula(f)
isbal = rxn.is_balanced()
bals += [isbal]
mags += [cc.standard_dg_prime(rxn).value.magnitude]
errs += [cc.standard_dg_prime(rxn).error.magnitude]
except:
bals += [False]
mags += [0.0]
errs += [0.0]
return bals, mags, errs
def pygetdgprimephys(fs, ph, ionic):
cc.p_h = Q_(ph) # set pH
cc.ionic_strength = Q_(ionic) # set I
bals = []
mags = []
errs = []
for f in fs:
try:
rxn = cc.parse_reaction_formula(f)
isbal = rxn.is_balanced()
bals += [isbal]
mags += [cc.physiological_dg_prime(rxn).value.magnitude]
errs += [cc.physiological_dg_prime(rxn).error.magnitude]
except:
bals += [False]
mags += [0.0]
errs += [0.0]
return bals, mags, errs
except ImportError as e: # in case equilibrator is not installed.
def pygetdg0(fs, ph, ionic):
bals = [0.0]
mags = [0.0]
errs = [0.0]
return bals, mags, errs
def pygetdgprimephys(fs, ph, ionic):
bals = [0.0]
mags = [0.0]
errs = [0.0]
return bals, mags, errs
def pygetdgprime(fs, ph, ionic):
bals = [0.0]
mags = [0.0]
errs = [0.0]
return bals, mags, errs
"""
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment