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
¶
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; |
is_hierarchical
¶
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 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 |
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, |
required |
copyright
|
str
|
copyright of the MIT license, e.g. |
required |
readme
|
Path | None
|
the README of the model repository, left out of the archive if
|
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 ( |
()
|
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 |
dict[str, dict[str, Any]]
|
|
dict[str, dict[str, Any]]
|
|
dict[str, dict[str, Any]]
|
|
dict[str, dict[str, Any]]
|
antimony, the stem of every extra model and |
dict[str, dict[str, Any]]
|
extra file ( |
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 |