joshamilton / reverseEcology

Reverse ecology analysis of metabolic network reconstructions
MIT License
0 stars 0 forks source link

Update sf.processSBMLforRE to allow community models #2

Open rprops opened 7 years ago

rprops commented 7 years ago

Hi Joshua,

I was wondering if you could update the sf.processSBMLforRE/sf.pruneCurrencyMetabs/modelStatArray functions to handle community models as well. Right now it only seems to work for .xml files with 2 compartments (extracellular + cytosol). I'm interested in using your package's functionality to format community models to graph-format instead of single genome models. The error that is generated with 2+ compartments:

>>> sf.processSBMLforRE(rawModelDir, processedDataDir, summaryStatsDir)
Processing model community_model, 1 of 1
The remaining extracellular metabolites are:
All reactions are balanced
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/rprops/.local/lib/python2.7/site-packages/reverseEcology-0.5-py2.7.egg/reverseEcology/sbmlFunctions.py", line 361, in processSBMLforRE
    for curComp in model.compartments:
RuntimeError: dictionary changed size during iteration

Thanks,

Ruben

joshamilton commented 7 years ago

I don't have any current plans to update my pipeline to handle community models. I would welcome contributions to the codebase if you want to implement this functionality.

Also, the pipeline was written to operate on models generated from KBase. If you are using models from a different source, you will probably need to format the models to graph format yourself before using the rest of the pipeline. If you are using KBase community models, selecting the "Construct mixed-bag model" in the "Merge Metabolic Models into Community Model" App, should give you a model with only extracellular and cytosol compartments which is compatible with my pipeline.