SBRG / MASSpy

https://masspy.readthedocs.io
MIT License
22 stars 6 forks source link

COBRA 0.24.0 breaks MASSPy #166

Open jonrkarr opened 2 years ago

jonrkarr commented 2 years ago

Steps to reproduce

mass.io.sbml.read_sbml_model('path/to/WholeCellRBC_MA_Rates.xml')

Error

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~/.local/lib/python3.9/site-packages/mass/io/sbml.py in read_sbml_model(filename, f_replace, **kwargs)
    537         doc = _get_doc_from_filename(filename)
--> 538         return _sbml_to_model(doc, f_replace=f_replace, **kwargs)
    539 

~/.local/lib/python3.9/site-packages/mass/io/sbml.py in _sbml_to_model(doc, f_replace, **kwargs)
    675     # and GPR information.
--> 676     reactions, local_params, custom_rates = _read_model_reactions_from_sbml(
    677         model, mass_model.metabolites, f_replace, **kwargs

~/.local/lib/python3.9/site-packages/mass/io/sbml.py in _read_model_reactions_from_sbml(model, metabolites, f_replace, **kwargs)
   1292         mass_notes = _parse_notes_dict(reaction)
-> 1293         mass_reaction.gpr = _read_reaction_gpr_from_sbml(
   1294             reaction, mass_notes, f_replace

~/.local/lib/python3.9/site-packages/cobra/core/reaction.py in gpr(self, value)
    520         self._gpr = value
--> 521         self._update_genes_from_gpr()
    522 

~/.local/lib/python3.9/site-packages/cobra/core/reaction.py in _update_genes_from_gpr(self, new_gene_names)
    429             if self._gpr is not None:
--> 430                 new_gene_names = self._gpr.genes
    431             else:

AttributeError: 'str' object has no attribute 'genes'

The above exception was the direct cause of the following exception:

MassSBMLError                             Traceback (most recent call last)
<ipython-input-2-1b0305e75d56> in <module>
----> 1 mass.io.sbml.read_sbml_model('../Biosimulators_test_suite/examples/mass/Bordbar-Cell-Syst-2015-RBC-metabolism/WholeCellRBC_MA_Rates.xml')

~/.local/lib/python3.9/site-packages/mass/io/sbml.py in read_sbml_model(filename, f_replace, **kwargs)
    553             "at https://github.com/SBRG/masspy/issues ."
    554         )
--> 555         raise_from(mass_error, original_error)
    556 
    557 

/usr/local/lib/python3.9/dist-packages/six.py in raise_from(value, from_value)

MassSBMLError: Something went wrong reading the SBML model. Most likely the SBML model is not valid. Please check that your model is valid using the `mass.io.sbml.validate_sbml_model` function or via the online validator at http://sbml.org/validator .
    `(model, errors) = validate_sbml_model(filename)`
If the model is valid and cannot be read please open an issue at https://github.com/SBRG/masspy/issues .

Environment