Skip to content

fix: eight differences between export_for_git and exportForGit - #203

Open
edkerk wants to merge 5 commits into
developfrom
fix/export-for-git-raven-parity
Open

edkerk wants to merge 5 commits into
developfrom
fix/export-for-git-raven-parity

Conversation

@edkerk

@edkerk edkerk commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Files of export_for_git were compared with those of RAVEN's exportForGit on five models and eight differences were found. RAVEN's importModel now reads the SBML of yeast-GEM like the file that RAVEN wrote, except for the model creator.

  • _for_sbml: cobra passes the model id to libSBML unchanged, and libSBML writes no id attribute for an id that is not a valid SId, such as ecoliGEM_v1.0.7, so importModel read an empty model id.
  • _write_sbml: the gene name was written as both fbc:name and fbc:label and the protein as a note, so importModel read the short name of each gene as its protein, and an unnamed gene got G_<id> as name and label.
  • _for_sbml: gene products had no SBO term, where exportModel gives each SBO:0000243.
  • export_to_excel, write_matlab_model, _write_sbml: the compartments came in the order in which the metabolites first mention them (c, p, e), where sortIdentifiers gives c, e, p.
  • dependencies.txt: it listed model_version and model_date, which exportForGit does not write, so every release changed the file.
  • SBML notes: the model version and date were written as notes, which exportModel does not write, so every release changed the file.
  • Model note: it was written inside an html element, and importModel reads a model note only from a body element, so the note was lost on import.
  • Model notes: cobra writes them without escaping, so a note with &, < or > was dropped from the file and only logged as an error.

Each change has a regression test. The keywords model_version_in_dependencies and model_version_in_sbml restore the old output, and the CHANGELOG lists the four changes of behaviour under Breaking changes.

exportModel writes each character of the model id outside [0-9_a-zA-Z] as __<code>__ and importModel decodes it. cobra passes the id to libSBML unchanged, and libSBML writes no id attribute for an id that is not a valid SId, such as ecoliGEM_v1.0.7.

exportModel also writes the protein as fbc:name, the gene short name or else the gene id as fbc:label, and SBO:0000243 on each gene product without a term of its own. importModel reads proteins from fbc:name, so RAVEN read the short name of each gene as its protein.
cobra lists the compartments in the order in which the metabolites first mention them, so export_for_git wrote c, p, e where RAVEN's sortIdentifiers gives c, e, p. export_to_excel sorted them only with sort_ids=True and write_matlab_model never did. The SBML file is sorted after cobra writes it. The yml file was already sorted by cobra.
exportForGit writes MATLAB, libSBML and RAVEN, and the fields of model.modelVersion, which nothing else in RAVEN sets. export_for_git added model_version and model_date, so every release changed the file. model_version_in_dependencies=True writes the two lines.
exportModel writes no model version and no date, and the two notes changed the SBML file of every release. model_version_in_sbml=True writes them.
exportModel writes the model note as a bare paragraph in a body element, and importModel reads a model note only from that shape. cobra wraps its notes in an html element, so importModel found no note in the SBML file of export_for_git. The note is now the first paragraph of a body element, and the other notes follow as key: value paragraphs, which cobra reads.

cobra also writes notes without escaping them, so a model note that held &, < or > was dropped from the file and only logged as an error. The notes are written with escaping.

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

1 participant