Skip to content

Loss of relation elements in annotation when writing a SBML model again. #937

@Hemant27031999

Description

@Hemant27031999

Problem Description

If we read a SBML model, from the corresponding XML file and write it back, then, if the annotation field of some component had more than one relation elements like "is" and "hasTaxon", they are lost and only one relation element exists in the newly written model, with all resources listed under it.

Code Sample

I took the e_coli_core.xml model present inside the data directory, read it using

model = cobra.io.read_sbml_model("e_coli_core.xml")

and when I wrote it back using,

cobra.io.write_sbml_model(model, "e_coli_model.xml")

the annotation format changed as follows :

Annotation in the actual model :

...
<annotation>
      <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:bqmodel="http://biomodels.net/model-qualifiers/" xmlns:bqbiol="http://biomodels.net/biology-qualifiers/">
        <rdf:Description rdf:about="#e_coli_core">
          <bqbiol:hasTaxon>
            <rdf:Bag>
              <rdf:li rdf:resource="http://identifiers.org/taxonomy/511145" />
            </rdf:Bag>
          </bqbiol:hasTaxon>
          <bqmodel:is>
            <rdf:Bag>
              <rdf:li rdf:resource="http://identifiers.org/bigg.model/e_coli_core" />
            </rdf:Bag>
          </bqmodel:is>
          <bqmodel:isDescribedBy>
            <rdf:Bag>
              <rdf:li rdf:resource="http://identifiers.org/doi/10.1128/ecosalplus.10.2.1" />
            </rdf:Bag>
          </bqmodel:isDescribedBy>
        </rdf:Description>
      </rdf:RDF>
    </annotation>
...

Annotation after writing the model :

...
<annotation>
      <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:vCard="http://www.w3.org/2001/vcard-rdf/3.0#" xmlns:vCard4="http://www.w3.org/2006/vcard/ns#" xmlns:bqbiol="http://biomodels.net/biology-qualifiers/" xmlns:bqmodel="http://biomodels.net/model-qualifiers/">
        <rdf:Description rdf:about="#meta_e_coli_core">
          <bqbiol:is>
            <rdf:Bag>
              <rdf:li rdf:resource="https://identifiers.org/taxonomy/511145"/>
              <rdf:li rdf:resource="https://identifiers.org/bigg.model/e_coli_core"/>
              <rdf:li rdf:resource="https://identifiers.org/doi/10.1128/ecosalplus.10.2.1"/>
            </rdf:Bag>
          </bqbiol:is>
        </rdf:Description>
      </rdf:RDF>
    </annotation>
...

Expected output :

The resources listed under different relational elements should not have changed. They should be like in the actual format.

Output of python -c "from cobra import show_versions; show_versions()":

System Information

OS Linux
OS-release 4.15.0-88-generic
Python 3.7.3

Package Versions

cobra 0.17.1
depinfo 1.5.3
future 0.18.2
numpy 1.18.1
optlang 1.4.4
pandas 1.0.0
pip 20.0.2
python-libsbml-experimental 5.18.0
ruamel.yaml 0.16.7
setuptools 45.1.0
six 1.14.0
swiglpk 4.65.1
wheel 0.34.2

Metadata

Metadata

Labels

JSONSBMLRelated to reading and writing SBML models.bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions