Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModelSEED SBML model can't be read due to duplicated IDs #1235

Closed
dengxiao01 opened this issue Jun 17, 2022 · 13 comments
Closed

ModelSEED SBML model can't be read due to duplicated IDs #1235

dengxiao01 opened this issue Jun 17, 2022 · 13 comments

Comments

@dengxiao01
Copy link

Problem description

image
image

Code Sample

Create a minimal, complete, verifiable example.

Context

@matthiaskoenig
Copy link
Contributor

What is the result of the SBML validation? I am pretty sure your SBML is invalid and you should fix the issues in your model file.

@dengxiao01
Copy link
Author

What is the result of the SBML validation? I am pretty sure your SBML is invalid and you should fix the issues in your model file.

SBML validation of web site, http://sbml.org/validator, is invalid, 404, is there where you can verify?

@matthiaskoenig
Copy link
Contributor

Sorry, link changed with the site migration.
https://sbml.org/validator_servlet/
Best Matthias

@matthiaskoenig
Copy link
Contributor

Fixed in #1239

@Midnighter
Copy link
Member

Any chance that you can add a redirect on the proxy that runs sbml.org?

@dengxiao01
Copy link
Author

dengxiao01 commented Jun 21, 2022

Sorry, link changed with the site migration. https://sbml.org/validator_servlet/ Best Matthias
thanks,this is the result of the SBML validation:
This document is not valid SBML!
Error Line 1181 Column 54: (SBML Validation Rule #10301) The value of the 'id' field on every instance of the following type of object in a model must be unique: , , , , , , , , , , and model-wide s. Note that and parameters defined inside a reaction are treated separately. Reference: L2V1 Section 3.5 The id 'M_cpd02701_b' conflicts with the previously defined id 'M_cpd02701_b' at line 674.

image

@dengxiao01
Copy link
Author

Any chance that you can add a redirect on the proxy that runs sbml.org?

Thank you. How do I do that? I'm not adding weighted direction

@Midnighter
Copy link
Member

Any chance that you can add a redirect on the proxy that runs sbml.org?

Thank you. How do I do that? I'm not adding weighted direction

Sorry, that was a comment for @matthiaskoenig

@cdiener
Copy link
Member

cdiener commented Jun 21, 2022

Here is a MRE:

  1. Go to https://modelseed.org/genomes/Plants and download the A. Thaliana (2nd in the list) SBML model.
  2. Read the model with cobra.io.read_sbml_model

This will result in:

[...]
ValueError: id 'cpd02701_b' at index 1154 is non-unique. Is it present twice?

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

CobraSBMLError                            Traceback (most recent call last)
Input In [8], in <cell line: 1>()
----> 1 mod = read_sbml_model("Athaliana-TAIR10.sbml")

File ~/code/cobrapy/src/cobra/io/sbml.py:472, in read_sbml_model(filename, number, f_replace, **kwargs)
    462 except Exception as original_error:
    463     cobra_error = CobraSBMLError(
    464         "Something went wrong reading the SBML model. Most likely the SBML"
    465         " model is not valid. Please check that your model is valid using "
   (...)
    470         "at https://github.com/opencobra/cobrapy/issues ."
    471     )
--> 472     raise cobra_error from original_error

CobraSBMLError: Something went wrong reading the SBML model. Most likely the SBML model is not valid. Please check that your model is valid using the `cobra.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/opencobra/cobrapy/issues .

Which points towards the same issue as the SBML validator. The issue is that ModelSEED provided invalid SBML models (duplicated IDs). @Midnighter Do you know where we should report this issue and what ModelSEED uses to generate the SBML model?

@cdiener cdiener changed the title CobraSBMLError ModelSEED SBML model can't be read due to duplicated IDs Jun 21, 2022
@matthiaskoenig
Copy link
Contributor

@Midnighter I just opened the issue for the redirect. This should be fixed soon. See sbmlteam/sbml-org-website#39

@dengxiao01
Copy link
Author

I tried to read it without error using libsbml:
reader = libsbml.SBMLReader()
document = reader.readSBML(sbml_test_file)
print(document.getNumErrors())
print(document.printErrors())
but the ModelSEED provided invalid SBML models (duplicated IDs),How does cobrapy solve this problem?

@matthiaskoenig
Copy link
Contributor

Reading the document with libsbml does not perform validation. You have to run the validation before you will see the actual errors. LibSBML will provide exactly the same errors (i.e. you model is invalid because you have duplicate species in it), because cobrapy and the sbml.org validator are using libsbml.
In summary, your model is invalid and you have to fix the model. This is not related to cobrapy but to ModelSEED creating/distributing invalid/broken models. You have to fix your duplicate species. This can be complicated, because both will most likely appear in reactions and you have to resolve which of the species belongs actual to which reaction.
In summary: this is not an issue of cobrapy, but of your model.

@cdiener
Copy link
Member

cdiener commented Jun 22, 2023

Closing in favor of the attached ModelSEED issue where that issue originates.

@cdiener cdiener closed this as completed Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants