linsalrob / PyFBA

A python implementation of flux balance analysis to model microbial metabolism
http://linsalrob.github.io/PyFBA/
MIT License
25 stars 14 forks source link

create_stoichiometric_matrix.py problem #12

Open rmueller35 opened 2 years ago

rmueller35 commented 2 years ago

I recently installed pyfba v 2.62 (using python3) and I was running through the "How to create and run a gap-filled FBA from PATRIC" iPython notebook. I kept receiving an warning messages on the runfba step (In [14] in the notebook) about "set" and "modeldata" objects, and the command didn't seem to complete properly.

After digging into the source code, it looks like the create_stoichiometric_matrix.py code may have an error on line 52 where it calls "if not set.get_compound_by_name(c.name):". I changed this to "if not modeldata.get_compound_by_name(c.name):" and then changed code for running the fba to include lines for creating a modeldata object from compounds and reactions and then using that object in the run_fba command (see below).

status, value, growth = PyFBA.fba.run_fba(compounds, reactions, reactions_to_run, media, biomass_equation)

modeldata = PyFBA.model_seed.ModelData(compounds=compounds, reactions=reactions) modeldata.rebuild_indices() status, value, growth = PyFBA.fba.run_fba(modeldata, reactions_to_run, media, biomass_equation)