Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doFBAMinSum fails when a new reaction is added to a model #25

Open
willigott opened this issue Jun 7, 2020 · 1 comment
Open

doFBAMinSum fails when a new reaction is added to a model #25

willigott opened this issue Jun 7, 2020 · 1 comment
Assignees
Labels
Milestone

Comments

@willigott
Copy link
Contributor

Let's say I take an existing model and do

import cbmpy as cbm

mod = cbm.CBRead.readSBML3FBC('e_coli_core.xml.gz')
cbm.doFBAMinSum(mod)

everything will work as expected.

However, when I now add a new reaction to this model,

newmod = mod.clone()
newmod.createReaction('foo')
newmod.createReactionReagent('foo', 'M_h_e', -1.)

and try again to minimize the fluxes, I get an error

cbm.doFBAMinSum(newmod)

CPLEX is using solver option: "o"

KeyError Traceback (most recent call last)
/opt/ibm/ILOG/CPLEX_Studio128/cplex/python/3.6/x86-64_linux/cplex/_internal/_aux_functions.py in _cachelookup(item, getindexfunc, cache)
277 try:
--> 278 idx = cache[item]
279 except KeyError:

KeyError: 'foo'

The reason seems to be that the stoichiometric matrix is not updated when a new reaction is added. If I do

newmod.buildStoichMatrix()
cbm.doFBAMinSum(newmod)

it will work fine.

Not sure what the best approach would be to deal with it. Maybe one could also add the build_n=True option to the function call as in doFBA?

@bgoli bgoli self-assigned this Jun 8, 2020
@bgoli bgoli added the bug label Jun 8, 2020
@bgoli bgoli added this to the Release 0.8.0 milestone Jun 8, 2020
@bgoli
Copy link
Member

bgoli commented Jun 8, 2020

Thanks, I'll give this priority

@bgoli bgoli modified the milestones: Release 0.8.0, Release 0.8.1 Feb 2, 2021
@bgoli bgoli modified the milestones: Release 0.8.1, Release 0.8.2 Jul 21, 2021
@bgoli bgoli modified the milestones: Release 0.8.3, Release 0.8.5 Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants