Git Product home page Git Product logo

Comments (2)

cdiener avatar cdiener commented on August 21, 2024

This has to do with tolerances in the solver. A numerical solver is bound by floating point accuracy, thus it will never return the exact "true" solution of the problem but rather a solution within a certain tolerance. This is usually managed by a relative and absolute tolerance. What you are seeing here is the effect of the relative tolerance eps_rel. The solver usually will only guarantee that your solutions will be within eps_rel * ||v||* where ||.||* is the infinity norm (maximum absolute value). The default value for eps_rel with cplex is 1e-6 and you have at least one flux with a value of around 20, so your solution will be within a 1e-4 to 1e-6 of the real solution. All of those impossible imports are thus not distinguishable from zero for the solver.

I am working on an updated version that lets you define the threshold for returning imports. For now minimal_media returns any import flux > 1e-6 but you will be able to change this cutoff soon. To alleviate this you can either drop imports below a certain threshold or decrease the solver tolerance with com.tolerance = 1e-8, for instance. However, this will affect performance and may affect convergence. To put it into perspective, single bacteria have fL volumes and the default flux unit of micom is mmol/h. So that corresponds to less than a single molecule imported per cell and hour. This is unlikely to have a large impact on downstream analyses.

P.S.: I would also set min_growth=0.95*sol.members.growth_rate.drop("medium") in minimal_media. Otherwise you are loosing all the advantages from the cooperative tradeoff.

from micom.

nigiord avatar nigiord commented on August 21, 2024

Hi @cdiener,

Thank you for your answer, that makes perfect sense. Indeed I have very large values for my fluxes (hence very large error tolerance), this is because I don't use mmol/gDW/h but rather mmol/human/day. The reasoning was that, since AGORA models do not have any internal constraints, this should be transparent for the community model (the outputs should just be in the same units than the inputs, with no unintended consequences on the flux distribution). Since the goal was to compare results with other community modeling approaches that use mmol/human/day, but also to compare different literature diets that are reported in mmol/human/day (the VMH diets for instance), I wanted to avoid unnecessary conversions.

From your answer, I now realize though that MICOM might have some default thresholds that do expect fluxes in the range of mmol/gDW/h. Maybe I should change my workflow and actually convert my diets before running MICOM, and convert back my outputs after if I want to compare with other methods.

P.S.: I would also set min_growth=0.95*sol.members.growth_rate.drop("medium") in minimal_media. Otherwise you are loosing all the advantages from the cooperative tradeoff.

Indeed, I checked back the documentation and it's there. I think months ago I initially adapted what you did in the original MICOM paper https://github.com/micom-dev/paper/blob/master/workflows/media_and_gcs.py#L19-L41, which does not use the min_growth parameter. I guess this functionality has been added later and I didn't notice. I'm really grateful for the tip, and will adapt my scripts.

Thank you again for your help.

Nils

from micom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.