Skip to content

Add sampling-driven dFBA and make optional deps robust.#126

Open
Mohit-Lakra wants to merge 1 commit intoGeomScale:developfrom
Mohit-Lakra:DFBA_sampler
Open

Add sampling-driven dFBA and make optional deps robust.#126
Mohit-Lakra wants to merge 1 commit intoGeomScale:developfrom
Mohit-Lakra:DFBA_sampler

Conversation

@Mohit-Lakra
Copy link

    ## Summary
    - add DynamicFBA helper and result container with sampling-based tie-breaking
    - document usage and cite Mahadevan/DFBAlab/COMETS references
    - guard cobra/sparseqr/volestipy/matplotlib imports so the CLI stays usable without optional deps
    - add regression test that exercises biomass/media updates

    ## Testing
    - python -m pytest tests/test_dfba.py

@vissarion vissarion requested a review from hariszaf March 16, 2026 07:13
@vissarion
Copy link
Member

@hariszaf could you have time to help us reviewing here?

@hariszaf
Copy link
Collaborator

Hi!

@Mohit-Lakra thanks for your interest on dingo and for your effort on this issue.

In your attempt, you miss updating the medium after each step;
you need to calculate how much of each compound is being consumed in each step and how much is being produced, and then update the medium based on those calculations.

By not doing so, you end up with what your test on README suggests now:

>>> result.biomass
array([0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
       0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
       0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
       0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
       0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
       0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
       0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
       0.1, 0.1, 0.1, 0.1, 0.1, 0.1])
>>> result.concentrations["EX_glc__D_e"]
array([5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5.,
       5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5.,
       5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5.,
       5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5.,
       5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5.,
       5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5.])

That means that you don't have a dynamic scenario but rather a fixed one where the concentration of glucose is always 5 and your biomass is 0.1.

You may have a look here for a simple example of what I'm trying to say, or here for a more concrete approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants