Convert a cobrapy's cobra.Model to a TOML file that can be read by Maud:
from cobra_to_toml import model_to_toml
toml_file = model_to_toml(cobra_model)
redeserialized = toml.loads(toml_file)
or, most likely, a list of cobra.Reaction:
from cobra_to_toml import reactions_to_toml
reactions = [cobra_model.reactions.PFK, cobra_model.reactions.PFF]
toml_file = reactions_to_toml(reactions)
redeserialized = toml.loads(toml_file)
Additionally, the stoichiometric consistency (adapted from memote and, thus, Gevorgyan et at., 2008):
import cobra_to_toml.stoichiometry as st
assert st.check_stoichiometric_consistency_from_toml("path/kinetic_model.toml")
Please install it with
pip install git+https://github.com/carrascomj/cobra_to_toml.git#egg=cobra_to_toml