Skip to content

Commit 25d49ba

Browse files
FFroehlichdilpathsebaperssondweindl
authored
v2: Support multiple models (#622)
* Each measurement is now optionally associated with one model from a set of models defined in the PEtab problem YAML * Drop vis table from yaml (missed in #631); fix dtype --------- Co-authored-by: Dilan Pathirana <59329744+dilpath@users.noreply.github.com> Co-authored-by: Sebastian Persson <46872750+sebapersson@users.noreply.github.com> Co-authored-by: Daniel Weindl <dweindl@users.noreply.github.com> Co-authored-by: Daniel Weindl <daniel.weindl@uni-bonn.de>
1 parent 4d06d57 commit 25d49ba

2 files changed

Lines changed: 136 additions & 96 deletions

File tree

doc/v2/_static/petab_schema_v2.yaml

Lines changed: 53 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -22,96 +22,67 @@ properties:
2222
File name (absolute or relative) or URL to PEtab parameter table
2323
containing parameters of all models listed in `problems`. A single
2424
table may be split into multiple files and described as an array here.
25-
problems:
26-
type: array
27-
description: |
28-
One or multiple PEtab problems (sets of model, condition, observable
29-
and measurement files). If different model and data files are
30-
independent, they can be specified as separate PEtab problems, which
31-
may allow more efficient handling. Files in one problem cannot refer
32-
to models entities or data specified inside another problem.
33-
items:
3425
35-
type: object
36-
description: |
37-
A set of PEtab model, observable and measurement
38-
files and optional condition, experiment, and visualization files.
39-
40-
properties:
41-
42-
model_files:
43-
type: object
44-
description: One or multiple models
45-
46-
# the model ID
47-
patternProperties:
48-
"^[a-zA-Z_]\\w*$":
49-
type: object
50-
properties:
51-
location:
52-
type: string
53-
description: Model file name or URL
54-
language:
55-
type: string
56-
description: |
57-
Model language, e.g., 'sbml', 'cellml', 'bngl', 'pysb'
58-
required:
59-
- location
60-
- language
61-
additionalProperties: false
62-
63-
measurement_files:
64-
type: array
65-
description: List of PEtab measurement files.
66-
67-
items:
68-
type: string
69-
description: PEtab measurement file name or URL.
70-
71-
condition_files:
72-
type: array
73-
description: List of PEtab condition files.
26+
model_files:
27+
type: object
28+
description: One or multiple models
7429

75-
items:
30+
# the model ID
31+
patternProperties:
32+
"^[a-zA-Z_]\\w*$":
33+
type: object
34+
properties:
35+
location:
7636
type: string
77-
description: PEtab condition file name or URL.
37+
description: Model file name or URL
38+
language:
39+
type: string
40+
description: |
41+
Model language, e.g., 'sbml', 'cellml', 'bngl', 'pysb'
42+
required:
43+
- location
44+
- language
45+
additionalProperties: false
46+
47+
measurement_files:
48+
type: array
49+
description: List of PEtab measurement files.
7850

79-
experiment_files:
80-
type: array
81-
description: List of PEtab experiment files
51+
items:
52+
type: string
53+
description: PEtab measurement file name or URL.
8254

83-
items:
84-
type: string
85-
description: PEtab experiment file name or URL.
55+
condition_files:
56+
type: array
57+
description: List of PEtab condition files.
8658

87-
observable_files:
88-
type: array
89-
description: List of PEtab observable files.
59+
items:
60+
type: string
61+
description: PEtab condition file name or URL.
9062

91-
items:
92-
type: string
93-
description: PEtab observable file name or URL.
63+
experiment_files:
64+
type: array
65+
description: List of PEtab experiment files
9466

95-
visualization_files:
96-
type: array
97-
description: List of PEtab visualization files.
67+
items:
68+
type: string
69+
description: PEtab experiment file name or URL.
9870

99-
items:
100-
type: string
101-
description: PEtab visualization file name or URL.
71+
observable_files:
72+
type: array
73+
description: List of PEtab observable files.
10274

103-
mapping_files:
104-
type: array
105-
description: List of PEtab mapping files.
75+
items:
76+
type: string
77+
description: PEtab observable file name or URL.
10678

107-
items:
108-
type: string
109-
description: PEtab mapping file name or URL.
79+
mapping_files:
80+
type: array
81+
description: List of PEtab mapping files.
11082

111-
required:
112-
- model_files
113-
- observable_files
114-
- measurement_files
83+
items:
84+
type: string
85+
description: PEtab mapping file name or URL.
11586

11687
extensions:
11788
type: object
@@ -128,7 +99,7 @@ properties:
12899
type: string
129100
pattern: ^([1-9][0-9]*!)?(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))*((a|b|rc)(0|[1-9][0-9]*))?(\.post(0|[1-9][0-9]*))?(\.dev(0|[1-9][0-9]*))?$
130101
required:
131-
type: bool
102+
type: boolean
132103
description: |
133104
Indicates whether the extension is required for the
134105
mathematical interpretation of the problem.
@@ -142,4 +113,6 @@ properties:
142113
required:
143114
- format_version
144115
- parameter_file
145-
- problems
116+
- model_files
117+
- observable_files
118+
- measurement_files

doc/v2/documentation_data_format.rst

Lines changed: 83 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ text-based files in `Tab-Separated Values (TSV)
5353
<https://www.iana.org/assignments/media-types/text/tab-separated-values>`_
5454
format (Figure 2), including:
5555

56-
- A :ref:`model <v2_model>` file specifying the base model
56+
- One or multiple (optional) :ref:`model <v2_model>` file(s) specifying the base model(s)
5757
[SBML, CELLML, BNGL, PYSB, ...].
5858

5959
- A :ref:`measurement file <v2_measurements_table>` containing experimental
@@ -111,12 +111,20 @@ should not alter the definition of the estimation problem itself.
111111
parameters, but excluding parameters listed in the
112112
:ref:`v2_parameters_table` (independent of their ``estimate`` value).
113113

114+
.. _v2_changes:
114115

115116
Changes from PEtab 1.0.0
116117
------------------------
117118
PEtab 2.0.0 is a major update of the PEtab format. The main changes are:
118119

120+
* The :ref:`PEtab YAML problem description <v2_problem_yaml>` is now
121+
mandatory and its structure changed. In particular, the `problems` list
122+
has been flattened.
119123
* Support for models in other formats than SBML (:ref:`v2_model`).
124+
* The use of different models for different measurements is now
125+
supported via the optional ``modelId`` column in the
126+
:ref:`v2_measurements_table`, see also :ref:`v2_multiple_models`.
127+
This was poorly defined in PEtab 1.0.0 and probably not used in practice.
120128
* The (now optional) conditions table format changed from wide to long
121129
(:ref:`v2_conditions_table`).
122130
* ``simulationConditionId`` and ``preequilibrationConditionId`` in the
@@ -205,10 +213,10 @@ PEtab distinguishes between three types of entities:
205213
Conditions table
206214
----------------
207215

208-
The optional conditions table defines discrete changes to the model. These (sets of)
209-
changes typically represent interventions, perturbations, or changes in the
210-
environment of the system of interest. These modifications are referred to as
211-
(experimental) *conditions*.
216+
The optional conditions table defines discrete changes to the simulated model(s).
217+
These (sets of) changes typically represent interventions, perturbations, or
218+
changes in the environment of the system of interest. These modifications are
219+
referred to as (experimental) *conditions*.
212220

213221
Conditions are applied at specific time points, which are defined in the
214222
:ref:`v2_experiments_table`. This allows for the specification of time
@@ -533,6 +541,15 @@ Detailed field description
533541
Numeric values or parameter names are allowed. Same rules apply as for
534542
``observableParameters`` in the previous point.
535543

544+
- ``modelId`` [PETAB_ID, OPTIONAL, REFERENCES(yaml.models.model_id)]
545+
546+
Which model to simulate for each data point. Model IDs are defined by the
547+
keys of the `models` object in the PEtab problem YAML file.
548+
This column is required when multiple models are defined in the PEtab
549+
problem.
550+
For problems with a single model, this column is optional,
551+
and its values default to the ID of the only model present.
552+
536553
.. _v2_simulation_table:
537554

538555
Simulation table
@@ -608,8 +625,7 @@ Detailed field description
608625
* ``observableFormula`` [STRING]
609626

610627
Observation function as plain text formula expression.
611-
612-
The expression may contain any symbol defined in the model,
628+
The expression may contain any symbol defined in a model,
613629
the mapping table or the parameter table.
614630
Often, this is just the ID of a state variable.
615631
Furthermore, any parameters introduced through the ``observablePlaceholders``
@@ -750,7 +766,7 @@ and *must not* include:
750766
- "Parameters" that are not *constant* entities (e.g., in an SBML model,
751767
the targets of *AssignmentRules* or *EventAssignments*)
752768
- Any parameters that do not have valid PEtab IDs
753-
(e.g., SBML *local* parameters)
769+
(e.g., SBML *local* parameters that are not mapped in the mapping table)
754770

755771
it *may* include:
756772

@@ -789,7 +805,7 @@ Detailed field description
789805
- ``parameterId`` [PETAB_ID, REQUIRED]
790806

791807
The ``parameterId`` of the parameter described in this row. This has to match
792-
the ID of a parameter specified in the SBML model, a parameter introduced
808+
the ID of a parameter specified in at least one model, a parameter introduced
793809
as override in the condition table, or a parameter occurring in the
794810
``observableParameters`` or ``noiseParameters`` column of the measurement table
795811
(see above).
@@ -976,8 +992,8 @@ Detailed field description
976992

977993
- ``modelEntityId`` [STRING or empty, REQUIRED]
978994

979-
A globally unique identifier defined in the model, or empty if the entity is
980-
not present in the model. This does not have to be a valid PEtab identifier.
995+
A globally unique identifier defined in any model, or empty if the entity is
996+
not present in any model. This does not have to be a valid PEtab identifier.
981997
Rows with empty ``modelEntityId`` serve as annotations only.
982998

983999
For example, in SBML, local parameters may be referenced as
@@ -1015,15 +1031,66 @@ easy validation:
10151031
.. literalinclude:: _static/petab_schema_v2.yaml
10161032
:language: yaml
10171033

1034+
.. _v2_multiple_models:
10181035

10191036
Parameter estimation problems combining multiple models
10201037
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10211038

1022-
Parameter estimation problems can comprise multiple models. For now, PEtab
1023-
allows one to specify multiple models with corresponding condition and
1024-
measurement tables, and one joint parameter table. This means that the parameter
1025-
namespace is global. Therefore, parameters with the same ID in different models
1026-
will be considered identical.
1039+
Purpose
1040+
+++++++
1041+
1042+
PEtab supports defining multiple models within a single problem specification. This
1043+
feature is designed to enable users to define experiment-specific model variants or
1044+
submodels. Rather than implementing a single global, parameterized model, users can
1045+
define multiple smaller, self-contained models that differ structurally as needed.
1046+
1047+
This approach offers several benefits:
1048+
1049+
- Simplified model definition for users, as each variant can be independently
1050+
specified.
1051+
- Improved simulation performance for tool developers, as smaller models can be
1052+
simulated more efficiently.
1053+
1054+
Scope and Application
1055+
+++++++++++++++++++++
1056+
1057+
While multiple models are intended to be applied to different experiments, model
1058+
selection is specified at the level of individual data points in the
1059+
:ref:`v2_measurements_table`. This design enables:
1060+
1061+
- Reuse of experiments across models.
1062+
- Fine-grained model-to-data assignment.
1063+
1064+
With the exception of the :ref:`v2_measurements_table`, all other PEtab tables apply
1065+
to all models. Parameters listed in the parameter table are defined globally and
1066+
shared across all models. In contrast, entries in all other tables implicitly define
1067+
model-specific instances of observables, conditions, experiments, etc., with their
1068+
respective PEtab IDs existing in local, model-specific namespaces. Each PEtab
1069+
subproblem defined in this way must constitute a valid PEtab problem on its own.
1070+
1071+
This design has several implications:
1072+
1073+
- A single experiment may need to be simulated with different models for
1074+
different measurements. However, a single simulation of a given experiment
1075+
is always performed using one single model.
1076+
- Each model may be associated with a distinct subset of experiments.
1077+
- The number of conditions to be simulated for a model-specific instance
1078+
of an experiment may vary across models.
1079+
- Each parameter defined in the :ref:`v2_parameters_table` has a shared value
1080+
across all models. Parameters not listed in the parameter table do not share
1081+
values, which can result in model-specific instantiations of model observables
1082+
referencing these parameters.
1083+
1084+
Validation Rules
1085+
++++++++++++++++
1086+
1087+
For any given model, only those experiments and observables that appear in the
1088+
same rows of the :ref:`v2_measurements_table` need to be valid. This means that all
1089+
symbols used in the corresponding ``observableFormula`` and all symbols assigned
1090+
in the associated condition definitions must be defined in the model.
1091+
1092+
Conditions and observables that are not applied to a model do not need to be
1093+
valid for that model.
10271094

10281095

10291096
.. _v2_objective_function:

0 commit comments

Comments
 (0)