These are chat archives for opencobra/cobrapy
Was reading the AGORA paper and about to carry some calculations out. for example:
"To model the metabolic dependency between the two organisms in a realistic manner, additional constraints were implemented, such that the flux of reaction i (e.g., from the mouse) and of reaction rxnC (e.g., mouse biomass reaction) were proportional (vi: vrxnC). We bound the ratio between reaction i and reaction rxnC using a factor c, such that for irreversible reactions: vi − c × vrxnC ≥ u, and for reversible reactions: vi − c × vrxnC ≥ u in the forward direction and vi + c × vrxnC ≤ u in the reverse direction. The parameter u ≥ 0 allowed a small reaction flux when vrxnC = 0 "
My schema was to convert a paired model (modelA and modelB) into irreversible, then for each forward non-exchange reactions, add a constraint model.problem.Constraint(v_i.flux_expression+CBio1,lb=u); where v_i is Model.reactions[i], for all i belonging to modelA , and Bio1 is the biomass expression for modelA; and for reverse reactions it would be
model.problem.Constraint(v_i.flux_expression-CBio1,lb=u) ; with the constraints for modelB following a similar format. Wondering if I interpreted the paper and the tailored constraints correctly...
cobra.Reaction.flux_expression = cobra.Reaction.forward_variable - cobra.Reaction.reverse_variable.
develseems to be broken for symengine:
self = <cobra.test.test_solver_model.TestReaction object at 0x7f9b0cc725c0>, model = <Model e_coli_core at 0x7f9b0cc7a128> def test_reaction_imul(self, model): with model: model.reactions.EX_glc__D_e *= 100 > assert model.constraints.glc__D_e.expression.coeff( model.variables.EX_glc__D_e) == -100 E assert -100.0 == -100 E + where -100.0 = <built-in method coeff of Add object at 0x7f9b0c9b0e08>(0.0 <= EX_glc__D_e <= 1000.0) E + where <built-in method coeff of Add object at 0x7f9b0c9b0e08> = -100.0*EX_glc__D_e + 100.0*EX_glc__D_e_reverse_af641 - 1.0*GLCpts + 1.0*GLCpts_reverse_a52ae.coeff E + where -100.0*EX_glc__D_e + 100.0*EX_glc__D_e_reverse_af641 - 1.0*GLCpts + 1.0*GLCpts_reverse_a52ae = <optlang.glpk_interface.Constraint object at 0x7f9b0c85cb38>.expression E + where <optlang.glpk_interface.Constraint object at 0x7f9b0c85cb38> = <optlang.container.Container object at 0x7f9b0cad6b00>.glc__D_e E + where <optlang.container.Container object at 0x7f9b0cad6b00> = <Model e_coli_core at 0x7f9b0cc7a128>.constraints E + and 0.0 <= EX_glc__D_e <= 1000.0 = <optlang.container.Container object at 0x7f9b0cad6e10>.EX_glc__D_e E + where <optlang.container.Container object at 0x7f9b0cad6e10> = <Model e_coli_core at 0x7f9b0cc7a128>.variables cobra/test/test_solver_model.py:469: AssertionError