Hi J P,
[1] another alternative is to use the validate_sbml_model function to read the model.
This is performing additional model validations (and catches all the warnings) in the error logs (this could take a bit longer to read due to the SBML validation, but for most model this does not matter too much, especially because you read the model only once.)
from cobra.io import validate_sbml_model
model, errors = validate_sbml_model(path)
[2] another is to convert the model to SBML3FBC, i.e. get rid of the warnings by encoding the model according to latest guidelines.
The cobrapy SBML exporter is doing this automatically. So you can do:
from cobra.io import read_sbml_model, write_sbml_model
model = read_sbml_model(path)
write_sbml_model(model, path_sbml3fbc) # stores as SBML3 + fbc
read_sbml_model(path_sbml_3fbc) # magic, no warnings
This has the big advantage that you got rid of all the legacy encoding which should in my opinion not be used any more.
Best Matthias
Best Matthias