Skip to content

Commit a2f6b06

Browse files
committed
v2: Adapt to updated yaml schema
Basically, the `problems` list is disolved and its contents moved one level up. See https://github.com/PEtab-dev/PEtab/pull/622/files Related to #392.
1 parent b0f4c4f commit a2f6b06

File tree

6 files changed

+240
-256
lines changed

6 files changed

+240
-256
lines changed

petab/petablint.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,14 @@ def main():
179179
logger.error(e)
180180
sys.exit(1)
181181

182-
if petab.is_composite_problem(args.yaml_file_name):
183-
# TODO: further checking:
184-
# https://github.com/ICB-DCM/PEtab/issues/191
185-
# problem = petab.CompositeProblem.from_yaml(args.yaml_file_name)
186-
return
187-
188182
match get_major_version(args.yaml_file_name):
189183
case 1:
184+
if petab.is_composite_problem(args.yaml_file_name):
185+
# TODO: further checking:
186+
# https://github.com/ICB-DCM/PEtab/issues/191
187+
# petab.CompositeProblem.from_yaml(args.yaml_file_name)
188+
return
189+
190190
problem = petab.Problem.from_yaml(args.yaml_file_name)
191191
ret = petab.lint.lint_problem(problem)
192192
sys.exit(ret)

petab/schemas/petab_schema.v2.0.0.yaml

Lines changed: 41 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -31,71 +31,47 @@ properties:
3131
File name (absolute or relative) or URL to PEtab parameter table
3232
containing parameters of all models listed in `problems`. A single
3333
table may be split into multiple files and described as an array here.
34-
problems:
35-
type: array
36-
description: |
37-
One or multiple PEtab problems (sets of model, condition, observable
38-
and measurement files). If different model and data files are
39-
independent, they can be specified as separate PEtab problems, which
40-
may allow more efficient handling. Files in one problem cannot refer
41-
to models entities or data specified inside another problem.
42-
items:
4334
44-
type: object
45-
description: |
46-
A set of PEtab model, condition, observable and measurement
47-
files and optional visualization files.
48-
properties:
49-
50-
model_files:
51-
type: object
52-
description: One or multiple models
53-
54-
# the model ID
55-
patternProperties:
56-
"^[a-zA-Z_]\\w*$":
57-
type: object
58-
properties:
59-
location:
60-
type: string
61-
description: Model file name or URL
62-
language:
63-
type: string
64-
description: |
65-
Model language, e.g., 'sbml', 'cellml', 'bngl', 'pysb'
66-
required:
67-
- location
68-
- language
69-
additionalProperties: false
70-
71-
measurement_files:
72-
description: List of PEtab measurement files.
73-
$ref: "#/definitions/list_of_files"
74-
75-
condition_files:
76-
description: List of PEtab condition files.
77-
$ref: "#/definitions/list_of_files"
78-
79-
experiment_files:
80-
description: List of PEtab experiment files.
81-
$ref: "#/definitions/list_of_files"
82-
83-
observable_files:
84-
description: List of PEtab observable files.
85-
$ref: "#/definitions/list_of_files"
86-
87-
visualization_files:
88-
description: List of PEtab visualization files.
89-
$ref: "#/definitions/list_of_files"
90-
91-
mapping_file:
35+
model_files:
36+
type: object
37+
description: One or multiple models
38+
39+
# the model ID
40+
patternProperties:
41+
"^[a-zA-Z_]\\w*$":
42+
type: object
43+
properties:
44+
location:
9245
type: string
93-
description: Optional PEtab mapping file name or URL.
46+
description: Model file name or URL
47+
language:
48+
type: string
49+
description: |
50+
Model language, e.g., 'sbml', 'cellml', 'bngl', 'pysb'
51+
required:
52+
- location
53+
- language
54+
additionalProperties: false
55+
56+
measurement_files:
57+
description: List of PEtab measurement files.
58+
$ref: "#/definitions/list_of_files"
59+
60+
condition_files:
61+
description: List of PEtab condition files.
62+
$ref: "#/definitions/list_of_files"
63+
64+
experiment_files:
65+
description: List of PEtab experiment files.
66+
$ref: "#/definitions/list_of_files"
67+
68+
observable_files:
69+
description: List of PEtab observable files.
70+
$ref: "#/definitions/list_of_files"
9471

95-
required:
96-
- model_files
97-
- observable_files
98-
- measurement_files
72+
mapping_files:
73+
description: List of PEtab mapping files.
74+
$ref: "#/definitions/list_of_files"
9975

10076
extensions:
10177
type: object
@@ -120,4 +96,6 @@ properties:
12096
required:
12197
- format_version
12298
- parameter_file
123-
- problems
99+
- model_files
100+
- observable_files
101+
- measurement_files

petab/v2/lint.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,10 @@ def run(self, problem: Problem) -> ValidationIssue | None:
219219
if not config.parameter_file:
220220
missing_files.append("parameters")
221221

222-
if not [p.measurement_files for p in config.problems]:
222+
if not config.measurement_files:
223223
missing_files.append("measurements")
224224

225-
if not [p.observable_files for p in config.problems]:
225+
if not config.observable_files:
226226
missing_files.append("observables")
227227

228228
if missing_files:

0 commit comments

Comments
 (0)