Coder Social home page Coder Social logo

Integration with eQuilibrator about pytfa HOT 8 OPEN

epfl-lcsb avatar epfl-lcsb commented on August 17, 2024
Integration with eQuilibrator

from pytfa.

Comments (8)

psalvy avatar psalvy commented on August 17, 2024

Good day @carrascomj !

I am happy to see you are interested in pyTFA. This is definitely a functionality we have considered, and it would considerably expand the usability of pyTFA. However, we don't really have anyone that could work on it at the moment, so your effort is very welcome !

For the implementation, if you decide to write a standalone module we will gladly link to it, and if instead you would like to contribute directly to the code we can work with pull requests :)

Very cool notebook also, thank you for sharing it. And indeed, yes, pH and Ionic strength are extremely important for the models to be accurate. I am happy to see you could reproduce our results !

It's been a while since I have used eQuilibrator, so maybe things changed, but also it is important to make sure we recover the ΔGr'°, and not the ΔGr'm.

from pytfa.

carrascomj avatar carrascomj commented on August 17, 2024

Nice! I will fork the project and will try to implement it in the package.

Just a quick question: as the eQuilibrator-API provides calculation of Confidence intervals, would it be meaningful to use them as the error for ΔGr'?

from pytfa.

psalvy avatar psalvy commented on August 17, 2024

Yes, we use the errors as bounds for the ΔGr'°, so we can directly integrate them!

from pytfa.

carrascomj avatar carrascomj commented on August 17, 2024

Hello! After this PR is merged to equilibrator_api, I should be able to open mine for pytfa.

Meanwhile, I have stumbled upon some decisions to take:

  1. The logic is implemented as a new method .prepare_equilibrator(). I had to arrange the .__init__() to make it possible for the user to initialize the ThermoModel without specifying a thermo_data argument. Other possibility would be to implement it as an external function instead of a method. Here, the problem is that the API exposes the thermodynamics information of the reactions, not the formation energies, so the preparation of the model requires some tweaking of the ThermoModel in the process.
  2. Lazy loading of eQuilibrator. The eQuilibrator package always takes time to load, so I thought it would be interesting to just load it when the user tries to prepare the model with eQuilibrator.
  3. equilibrator_api as extra dependency? Right now, I have implemented it so it's only installed with
   pip install pytfa[equilibrator]
  1. Minimally refactored the assessment of reaction compartment to utils.py, since both "preparations" of reactions call it.
  2. Added some tests to the related methods.

from pytfa.

psalvy avatar psalvy commented on August 17, 2024

Good day Jorge,
Wow, that was fast! Ok, regarding your points:

  1. I initially thought to have it as an external function, but I actually like your method. I was also wondering, maybe we can simply generate a thermo_data object, and feed this as a standard thermo_data dict ?
  2. Yes I think this is a must
  3. If you mean as an optional dependency, yes, I think it makes the most sense. Then I can simply add in the readme and docs this info
  4. I'll need more details here but yes I understand why this can be necessary
  5. Thanks! This is also a must, and yet so many people forget about this haha!

Thank your for being so on top of this
Cheers,
Pierre

from pytfa.

carrascomj avatar carrascomj commented on August 17, 2024

Hi! After talking about it on the equilibrator_api side, I will try to implement it by reconstructing the thermo_data structure with formation energies from eQuilibrator, which might provide a cleaner integration, as an external function.

However, using raw formation energies from eQuilibrator may yield very high uncertainties. If they turned to be too high to be informative, I will need to go back to the proposed alternative .prepare_equilibrator() method, relying on reaction data.

from pytfa.

psalvy avatar psalvy commented on August 17, 2024

Good day Jorge,
I see your point. In the current TFA we usually have formation energies decomposed by groups from the group contribution method. This allows to reduce the error when calculating the Gibbs energy of reaction by only accounting for the elements that change during the transformation. If we can get the components from the CCM from eQuilibrator, given a metabolite, maybe we can do the same?

from pytfa.

carrascomj avatar carrascomj commented on August 17, 2024

Hello Pierre,

As explained in the PR, eQuilibrator uses the Component Contribution method instead of group contributions. Thus, major profound changes would be needed in the package to accommodate this information from eQuilibrator. The solution from the eQuilibrator prepared tmodel varies from but it is more similar to the cobra model than using the .thermodb file.

I have used the total summation of fluxes to quickly compare them:

cobrapy -> 143.13836864239119
thermo_data from equilibrator -> 188.8536839871894
thermo_data from .thermodb -> 1190.6526819344149

from pytfa.

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.