Skip to content

De-duplicate exportModel and remove dead code#634

Merged
edkerk merged 1 commit into
develop3from
refactor/exportmodel-dedup
Jun 11, 2026
Merged

De-duplicate exportModel and remove dead code#634
edkerk merged 1 commit into
develop3from
refactor/exportmodel-dedup

Conversation

@edkerk

@edkerk edkerk commented Jun 11, 2026

Copy link
Copy Markdown
Member

Summary

exportModel already writes only SBML L3V1 FBCv2 (no legacy/alternate output paths), so this is a behaviour-preserving cleanup with no change to the emitted SBML.

Changes

  • Extract the SBO-term extraction-from-MIRIAM pattern — repeated nearly verbatim for compartments, metabolites, genes and reactions — into a local extractSBO(miriam) helper (returns the parsed SBO term, or [] when absent, and the miriam with the sbo entry stripped). Call sites assign sboTerm only when present, exactly as before.
  • Extract the repeated RDF/XML annotation header boilerplate (compartments/species/genes/reactions) into rdfAnnotationHeader(metaid), reproduced byte-for-byte. The model-level <dc:creator> annotation is left as-is.
  • Remove the unused columnVector sub-function.
  • Remove the dead if sbmlLevel<3 branch (sbmlLevel is hard-coded to 3).

Verification

SBML output is byte-identical (ignoring the export timestamp) for empty.xml and iAL1006 v1.00.xml (a rich model: 3945 SBO terms, miriams, genes, subsystems), confirming the extracted helpers reproduce the original output exactly. importExportTests passes 7/7.

io/exportModel.m: 810 → 780 lines.

exportModel already writes only SBML L3V1 FBCv2, so this is a behaviour-
preserving cleanup with no change to the output:
- extract the SBO-term extraction-from-MIRIAM pattern (repeated for
  compartments, metabolites, genes and reactions) into a local extractSBO
  helper
- extract the repeated RDF/XML annotation header into rdfAnnotationHeader
- remove the unused columnVector sub-function
- remove the dead "if sbmlLevel<3" branch (sbmlLevel is always 3)

Verified by byte-identical SBML output (ignoring the export timestamp) for
empty.xml and iAL1006, and a green importExportTests. exportModel.m drops
from 810 to 780 lines.
@edkerk edkerk merged commit a4e9957 into develop3 Jun 11, 2026
1 check failed
@edkerk edkerk deleted the refactor/exportmodel-dedup branch June 11, 2026 17:14
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