Skip to content

release.archive

The COMBINE archive of the models of a release: the SBML, its ODEs and antimony.

write_archive writes, for every given SBML model, its flat model (a model with submodels of the SBML package comp is flattened, <stem>_flat.xml), the ordinary differential equations of the flat model as markdown (sbmlode.OdeSystem, <flat stem>.md) and its antimony (<flat stem>.ant), the license texts of the models (CC BY-SA 4.0) and of the code (MIT, with the copyright) and the COMBINE archive (pymetadata.omex) with the README, the licenses, the models, the markdown, the antimony and further models and files. The flat model of the first model is the master entry of the archive.

A framework which builds its models itself (e.g. the PBPK models of pkpdsim) writes them and calls write_archive with them; the factory of any other model package calls it with the SBML files it created.

ArchiveModel dataclass

ArchiveModel(path, flat=None)

A model of an archive.

Attributes:

Name Type Description
path Path

the SBML file of the model, in L3V2, e.g. a model with submodels.

flat Path | None

the flat model of a model with submodels, if it exists already, e.g. written by the builder of the model; write_archive flattens a model with submodels without it into <stem>_flat.xml, a model without submodels is its own flat model.

is_hierarchical

is_hierarchical(path)

Tell whether an SBML model has submodels of the SBML package comp.

Parameters:

Name Type Description Default
path Path

the SBML file.

required

Returns:

Type Description
bool

Whether its model has a submodel.

write_archive

write_archive(
    models,
    out,
    *,
    name,
    copyright,
    readme=None,
    extra_models=(),
    extra_files=(),
)

Write the flat models, their ODEs and antimony, the licenses and the archive.

For every model the flat model (see ArchiveModel), the ODEs of the flat model as markdown and its antimony are written next to the flat model, the texts of CC BY-SA 4.0 and MIT (with the copyright) into out (sbmlsim.licenses) and the archive <name>.omex there, with the README, the licenses, every model, its flat model (the one of the first model the master entry), the markdown, the antimony, the extra models and the extra files.

Every file of the archive has one location rule: it is below out, and its location in the archive is its path relative to it, e.g. ./models/<name> for the directory models of a model package, the licenses ./mit.txt, an extra model or file where it lies (./models/<sid>_fluid.xml, ./figures/<x>.png). The README alone is placed, as ./README.md of the archive, wherever the file lies.

Parameters:

Name Type Description Default
models Sequence[Path | ArchiveModel]

the SBML files of the models, or ArchiveModels with their flat models; the first is the master of the archive.

required
out Path

the directory of the archive and the licenses, every other file of the archive lies below it.

required
name str

the name of the archive, <name>.omex.

required
copyright str

copyright of the MIT license, e.g. 2024-2026 Matthias König.

required
readme Path | None

the README of the model repository, left out of the archive if None.

None
extra_models Sequence[Path]

further SBML files (in L3V2) which are entries of the archive, e.g. a submodel which is simulated on its own.

()
extra_files Sequence[Path]

further files of other formats which are entries of the archive, e.g. the ODEs of an extra model (.md) or a figure (.png), with the format of their suffix (EXTRA_FORMATS, the antimony of .ant as the antimony of the flat model).

()

Returns:

Type Description
dict[str, dict[str, Any]]

The files with their entries in the COMBINE archive, by the keys of a

dict[str, dict[str, Any]]

factory, each {"path": Path, "entry": ManifestEntry}: README,

dict[str, dict[str, Any]]

cc-by, mit, for a model with submodels its stem (the model) and

dict[str, dict[str, Any]]

<stem>_flat (its flat model), for a model without its stem,

dict[str, dict[str, Any]]

<flat stem>_md and <flat stem>_ant of the markdown and the

dict[str, dict[str, Any]]

antimony, the stem of every extra model and <stem>_<suffix> of every

dict[str, dict[str, Any]]

extra file (fluid_md).

Raises:

Type Description
ValueError

before anything is written, for no model, if the key of a model, an extra model or an extra file is the key of another entry, if a model, an extra model or file is not below out or the suffix of an extra file has no format.