Skip to content

Import/export of SBML <notes> #695

@bdelepine

Description

@bdelepine

Problem description

Hi all,

Do you intend to support import/export of <notes> from/to SBML files?

When a SBML model is parsed with some <notes> under, for instance, a <geneProduct>, those notes are not imported. I would have expected to retrieve the notes with mymodel.genes.mygene.notes, but the attribute is always empty.

I didn't saw in cobra.io.sbml3.parse_xml_into_model and cobra.io.sbml3.annotate_cobra_from_sbml where the <notes> are imported. I believe they are not; which would explain why they are not available in the python object.

Code Sample

Gist to mini_fbc2_notes.xml

import cobra

m = cobra.io.sbml3.read_sbml_model("mini_fbc2_notes.xml")

print([x.notes for x in m.genes])
# [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}]

print([x.notes for x in m.reactions])
# [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}]

print([x.notes for x in m.metabolites])
# [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}]

Expected Output

print([x.notes for x in m.genes])
# [{"This is an important note for humans."}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}]

print([x.notes for x in m.reactions])
# [{"This is an important note for humans."}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}]

print([x.notes for x in m.metabolites])
# [{"This is an important note for humans."}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}]

Output of cobra.show_versions()

System Information

OS Linux
OS-release 3.10.0-693.21.1.el7.x86_64
Python 3.6.4

Package Versions

pip 9.0.3
setuptools 39.0.1
cobra 0.11.3
future 0.16.0
swiglpk 1.4.4
optlang 1.4.0
ruamel.yaml 0.14.12
pandas 0.22.0
numpy 1.14.2
tabulate 0.8.2
scipy 1.0.0
matplotlib 2.2.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions