GeomScale / dingo

A python library for metabolic networks sampling and analysis
GNU Lesser General Public License v3.0
44 stars 28 forks source link

support of medium modification and cobra model loading #76

Closed hariszaf closed 8 months ago

hariszaf commented 1 year ago

Aim of this PR is to address issues #74 and #75 .

The MetabolicNetwork class has been modified now it keeps the exchange reactions of a model as model.exchanges and its medium as model.medium.

The user may modify the medium as in cobra.

On top of that, dingo can also now build a dingo-model based on a cobra-model. For example:

import cobra 
import dingo 

cobra_model = cobra.io.read_sbml_model("my_model.xml")
dingo_model = dingo.MetabolicNetwork.from_cobra_model(cobra_model)

This allows for further modifications of the model, e.g. adding reactions, through the convenient interface of cobra and an easier integration with dingo.

TolisChal commented 1 year ago

Hey, @hariszaf, thanks a lot for this PR!

Could you plz add one unit-test per new function to check for correctness? e.g., load a model that you know the medium and inter-medium reactions and check if the new functions find them correctly.

hariszaf commented 1 year ago

@TolisChal here's a test for editing a reaction that is already part of the medium. The user will be able to edit the medium with reactions that are included in the model.exchanges list. If they need to add a new reaction, then it would be better to do so using cobra and once they have the model as they want, the can use the dingo.MetabolicNetwork.from_cobra_model(). That's probably something that we should add on the tutorial too.