EnzymeML / PyEnzyme

🧬 - Data management and modeling framework based on EnzymeML.
BSD 2-Clause "Simplified" License
21 stars 9 forks source link

Parameter values of zero are not saved to EnzymeML document (XML) #45

Closed jmrohwer closed 2 years ago

jmrohwer commented 2 years ago

When setting parameter values to zero (either directly via PyEnzyme methods or via a YAML file for kinetic model fitting), the resulting values are not written out to the XML document and are thus also not converted to the PSC file, resulting in model errors when loading.

The reason is that this statement evaluates to false: https://github.com/EnzymeML/PyEnzyme/blob/292d0ba4c0a44097a1eb47b874b15d580a13358b/pyenzyme/enzymeml/tools/enzymemlwriter.py#L533-L534 as does this one: https://github.com/EnzymeML/PyEnzyme/blob/292d0ba4c0a44097a1eb47b874b15d580a13358b/pyenzyme/enzymeml/tools/enzymemlwriter.py#L731-L732

It can be fixed by

if parameter.value is not None:

but I am not sure if these are all of the cases. I already fixed a number of these in TL_Pysces.py, refer to branch fit_replicates.

In all cases when evaluating conditionals for the presence of numerical values (float or int), this should be checked with

if value is not None:

to avoid a false evaluation of this expression when value=0.

jmrohwer commented 2 years ago

Fixed in 6fb0709f2f2daf89f6a870e67e6c9cdefbda6e99