matthiaskoenig / sbmlutils

Python utilities for SBML
https://sbmlutils.readthedocs.io/en/stable/
GNU Lesser General Public License v3.0
37 stars 12 forks source link

Error importing SBML file BIOMD0000000507_url.xml #381

Closed ajfedorec closed 3 years ago

ajfedorec commented 3 years ago

I have just tried to import the Gardener toggle switch SBML model from BioModels (BIOMD0000000507_url.xml) into SBML4Humans and receive the following error with a request to report it here. It is a curated model so I believe the model file is correct.

{
 "errors": [
  "invalid null reference in method 'Model_getUnitDefinition', argument 2 of type 'std::string const &'",
  "Traceback (most recent call last):\n  File \"/code/src/sbmlutils/report/api.py\", line 122, in report_from_file\n    return json_for_omex(path)\n  File \"/code/src/sbmlutils/report/api.py\", line 192, in json_for_omex\n    content[\"reports\"][entry.location] = json_for_sbml(  # type: ignore\n  File \"/code/src/sbmlutils/report/api.py\", line 209, in json_for_sbml\n    info = SBMLDocumentInfo.from_sbml(source=source)\n  File \"/code/src/sbmlutils/report/sbmlinfo.py\", line 61, in from_sbml\n    return SBMLDocumentInfo(doc=doc)\n  File \"/code/src/sbmlutils/report/sbmlinfo.py\", line 55, in __init__\n    self.info = self.create_info()\n  File \"/code/src/sbmlutils/report/sbmlinfo.py\", line 83, in create_info\n    model = self.model_dict(self.doc.getModel())\n  File \"/code/src/sbmlutils/report/sbmlinfo.py\", line 122, in model_dict\n    \"reactions\": self.reactions(model=model),\n  File \"/code/src/sbmlutils/report/sbmlinfo.py\", line 871, in reactions\n    model.getUnitDefinition(lpar_info[\"units_sid\"])\n  File \"/usr/local/lib/python3.9/site-packages/libsbml/__init__.py\", line 10855, in getUnitDefinition\n    return _libsbml.Model_getUnitDefinition(self, *args)\nValueError: invalid null reference in method 'Model_getUnitDefinition', argument 2 of type 'std::string const &'\n"
 ],
 "warnings": [],
 "info": {}
}
matthiaskoenig commented 3 years ago

Thanks @ajfedorec for the report. I could confirm the issue. We are working on a fix and let you know as soon as this is resolved. Best Matthias

matthiaskoenig commented 3 years ago

Hi @ajfedorec,

Thanks again for reporting the issue. This is now resolved and deployed. Please check: https://sbml4humans.de/model_url?url=https://www.ebi.ac.uk/biomodels/model/download/BIOMD0000000507.2?filename=BIOMD0000000507_url.xml for the model report.

If you have any other feedback please let us know. Best Matthias