-
Notifications
You must be signed in to change notification settings - Fork 4
Closed
Description
Hello,
Nice package, thank you very much!
There might be an issue with how you split your reactions that causes reversible parts of reactions to drop out from the enzyme constraint.
I was looking at the bounds of the enzyme-constraint reactions and noticed that cobrapy and optlang bounds are occasionally different. It seems like the reversible reactions get flipped once more when they go into optlang and then are no longer part of the enzyme constraint, so the model can use them in the reverse direction "for free". It's possible that I missed something but you may want to check.
import sys
sys.path.append('../../../../ECMpy/code/')
from cobrapy_ec_model_function import *
json_model_path="../../../../ECMpy/model/iML1515_irr_enz_constraint_adj_round2.json"
enz_model=get_enzyme_constraint_model(json_model_path)
# Look for reactions that are part of the enzyme constraint, but have contradictory optlang and cobrapy bounds
enzyme_constraint = [c for c in enz_model.constraints if c.ub>0][0]
reacs = []
for v in enzyme_constraint.variables:
cp_ub = float(enz_model.reactions.get_by_id(v.name).upper_bound)
cp_lb = float(enz_model.reactions.get_by_id(v.name).lower_bound)
if v.ub != cp_ub or v.lb != cp_lb:
reacs.append(v.name)
print("Variable: "+v.name)
print("optlang bounds: "+str(v))
print("cobrapy bounds: "+str(cp_lb)+" <= "+str(v.name)+" <= "+str(cp_ub))
if len(reacs) >= 3:
break
print("=== variable lookup in enzyme constraint ===")
# Look if these reactions exist somewhere in the model under a different name
for r in reacs:
for v in enz_model.variables:
if r in str(v):
print(("" if v in enzyme_constraint.variables else "NOT ")+"in enzyme constraint: "+str(v))
produces
Variable: SHK3Dr_reverse
optlang bounds: 0 <= SHK3Dr_reverse <= 0.0
cobrapy bounds: -1000.0 <= SHK3Dr_reverse <= 0.0
Variable: ACOAD2f
optlang bounds: 0 <= ACOAD2f <= 0.0
cobrapy bounds: -1000.0 <= ACOAD2f <= 0.0
Variable: ACACT4r_num2
optlang bounds: 0 <= ACACT4r_num2 <= 0.0
cobrapy bounds: -1000.0 <= ACACT4r_num2 <= 0.0
=== variable lookup in enzyme constraint ===
NOT in enzyme constraint: 0 <= SHK3Dr_reverse_d5c8f <= -0.0
in enzyme constraint: 0 <= SHK3Dr_reverse <= 0.0
NOT in enzyme constraint: 0 <= SHK3Dr_reverse_reverse_f4102 <= 1000.0
in enzyme constraint: 0 <= ACOAD2f <= 0.0
NOT in enzyme constraint: 0 <= ACOAD2f_reverse_6e942 <= 1000.0
in enzyme constraint: 0 <= ACACT4r_num2 <= 0.0
NOT in enzyme constraint: 0 <= ACACT4r_num2_reverse_47058 <= 1000.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels