Validation of SBML-comp models
dweindl opened this issue · comments
Daniel Weindl commented
Validation of an SBML-comp model (SBML semantic test suite case 01161) does not give any validation errors/warnings initially, but after applying CompFlatteningConverter
it does. The warnings seem unrelated to flattening the model. Why aren't they shown before? Are those checks skipped if comp
is used?
To reproduce via python-libsbml:
import libsbml
import requests
url = "https://raw.githubusercontent.com/sbmlteam/sbml-test-suite/release/cases/semantic/01161/01161-sbml-l3v2.xml"
r = requests.get(url, allow_redirects=True)
sbml_reader = libsbml.SBMLReader()
sbml_doc = sbml_reader.readSBMLFromString(r.content.decode("utf-8"))
assert sbml_doc.validateSBML() == 0
for i_error in range(sbml_doc.getNumErrors()):
error = sbml_doc.getError(i_error)
print(f'{error.getCategoryAsString()} ({error.getSeverityAsString()}): {error.getMessage()}')
conversion_properties = libsbml.ConversionProperties()
conversion_properties.addOption("flatten comp", True)
conversion_properties.addOption("leave_ports", False)
conversion_properties.addOption("abortIfUnflattenable", "none")
assert sbml_doc.convert(conversion_properties) == libsbml.LIBSBML_OPERATION_SUCCESS
str_model = libsbml.SBMLWriter().writeSBMLToString(sbml_doc)
print(str_model)
n_errors = sbml_doc.validateSBML()
for i_error in range(sbml_doc.getNumErrors()):
error = sbml_doc.getError(i_error)
print(f'{error.getCategoryAsString()} ({error.getSeverityAsString()}): {error.getMessage()}')
# FAILS
assert n_errors == 0, n_errors
Sarah Keating commented
This is a bug thanks for the report.