EPFL-LCSB / pytfa

A Python 3 implementation of Thermodynamics-based Flux Analysis
https://lcsb.epfl.ch/
Apache License 2.0
38 stars 26 forks source link

deltaGerr automatically sets to 2.0 after loading thermo model #30

Closed remidhum closed 5 years ago

remidhum commented 5 years ago

Uppon loading the model, the deltaGerr values are set to 2.0:

tmodel = load_json_model('../tmodels/outputs/tmodel.json')

In the .json file, the deltaGerr values are correctly set to 0.0.

The model is loaded after setting the deltaGerr of reactions to 0.0 and exporting the model:

for rxn in model.reactions:
    rxn.thermo['deltaGRerr'] = 0.0

#...

save_json_model(tmodel, './outputs/tmodel.json')
psalvy commented 5 years ago

Adding another piece of info from your email:

I have checked the .json and all the values of deltaGRerr are correctly set to 0.0 before export. To me, this shows the issue probably kicks in when loading or preparing the model.

I added an option for model.prepare() in the latest dev commit (bda04e763b3f5e9b9dd6580bf10bb256d25ae620): null_error_override.

This parameter gives its value to all DeltaG_err that are equal to 0, and is defaulted to 2 kcal/mol to preserve the behavior of previous versions. If you set it to 0, no change will be done to the already existing DeltaGerr. If you edit your preparation line to model.prepare(null_error_override = 0), you should get the desired result.

Let me know if this works for you

Cheers, Pierre

remidhum commented 5 years ago

This works perfectly for me. Thank you!