micom-dev / micom

Python package to study microbial communities using metabolic modeling.
https://micom-dev.github.io/micom
Apache License 2.0
82 stars 17 forks source link

ValueError is raised with custom reaction identifiers #8

Closed mostueve closed 4 years ago

mostueve commented 4 years ago

When trying to build a community, I always get a ValueError similar to the one below.

ValueError: ('The model already contains a reaction with the id:', 'ABC_RXN__smaAA1')

Files causing this can be found at https://gitlab.com/mostueve/micom-error-files

cdiener commented 4 years ago

Hi, thanks for providing a reproducible example. That helped a lot. Micom makes some adjustments to the IDs and that did not work for the models you provided. I fixed that in version 0.9.13, and updating to that version will make your setup work. You will see some SBML errors and the micom logs since your models are invalid SBML (missing a model ID), but it will read anyways. Those message will disappear if you set a model id in your SBML.

Anyways it will build the community and can obtain solutions.

Test run

```python In [1]: import micom In [2]: import pandas as pd In [3]: tax = pd.read_csv("pandas_metacyc.csv", sep="\t") In [4]: com = micom.Community(tax) 0%| | 0/4 [00:00 In [7]: sol.members Out[7]: abundance growth_rate reactions metabolites compartments eclAA4 0.6 7.359998 3246 1531 hfrAA6 0.2 2.453333 3411 1538 medium NaN NaN 22 22 ppuAA7 0.1 1.226668 3051 1493 smaAA1 0.1 1.226667 2626 1262 ```
mostueve commented 4 years ago

Cool, thanks a lot! Now it is working.