Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
create a COBRA model in Julia
using COBRA
# define the stoichiometric matrix
S = [
1 0 0 0 0 0 0
1 -1 0 0 0 0 0
0 -1 0 -1 0 0 0
0 1 0 1 0 0 0
0 1 0 1 0 0 0
0 1 -1 0 0 0 0
0 0 1 -1 1 0 0
0 0 0 1 -1 -1 0
0 0 0 0 -1 0 0
0 0 0 0 1 0 0
]
# define the metabolites
mets = ["glc_D[e]"
"glc_D[c]"
"atp[c]"
"h[c]"
"adp[c]"
"g6p[c]"
"f6p[c]"
"fdp[c]"
"h2o[c]"
"pi[c]"
"g3p[c]"
"dhap[c]"
]
# define the reactions
rxns = [
"GLCt1r"
"HEX1"
"PGI"
"PFK"
"FBP"
"FBA"
"TPI"
]
# retrieve the number of reactions
nRxns = length(rxns)
# define the objective
osense = -1
c = zeros(nRxns)
# define the constraints
b = zeros(length(c))
csense = fill('E',length(b))
# define the upper and lower reaction bounds
lb = [-20, 0, -20, 0, 0, -20, -20]
ub = [20, 20, 20, 20, 20, 20, 20]
# create the model
model = COBRA.LPproblem(S, b, c, lb, ub, osense, csense, rxns, mets)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment