From 83354fd9f1a4e0a95d1220227ea23053d2c381ee Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Mon, 9 Dec 2024 21:55:56 +0100 Subject: [PATCH] Update petab v2 tests Update to recent format changes. --- .ci_pip_reqs.txt | 2 +- petabtests/cases/v2.0.0/sbml/0001/_0001.yaml | 7 +- .../cases/v2.0.0/sbml/0001/_conditions.tsv | 3 +- .../cases/v2.0.0/sbml/0001/_measurements.tsv | 4 +- petabtests/cases/v2.0.0/sbml/0002/_0002.yaml | 7 +- .../cases/v2.0.0/sbml/0002/_conditions.tsv | 8 +- petabtests/cases/v2.0.0/sbml/0003/_0003.yaml | 7 +- .../cases/v2.0.0/sbml/0003/_conditions.tsv | 3 +- .../cases/v2.0.0/sbml/0003/_measurements.tsv | 4 +- petabtests/cases/v2.0.0/sbml/0004/_0004.yaml | 7 +- .../cases/v2.0.0/sbml/0004/_conditions.tsv | 3 +- .../cases/v2.0.0/sbml/0004/_measurements.tsv | 4 +- petabtests/cases/v2.0.0/sbml/0005/_0005.yaml | 7 +- .../cases/v2.0.0/sbml/0005/_conditions.tsv | 6 +- petabtests/cases/v2.0.0/sbml/0006/_0006.yaml | 7 +- .../cases/v2.0.0/sbml/0006/_conditions.tsv | 3 +- .../cases/v2.0.0/sbml/0006/_measurements.tsv | 4 +- petabtests/cases/v2.0.0/sbml/0007/_0007.yaml | 7 +- .../cases/v2.0.0/sbml/0007/_conditions.tsv | 3 +- .../cases/v2.0.0/sbml/0007/_measurements.tsv | 4 +- petabtests/cases/v2.0.0/sbml/0008/_0008.yaml | 7 +- .../cases/v2.0.0/sbml/0008/_conditions.tsv | 3 +- .../cases/v2.0.0/sbml/0008/_measurements.tsv | 6 +- petabtests/cases/v2.0.0/sbml/0009/_0009.yaml | 7 +- .../cases/v2.0.0/sbml/0009/_conditions.tsv | 6 +- petabtests/cases/v2.0.0/sbml/0010/_0010.yaml | 7 +- .../cases/v2.0.0/sbml/0010/_conditions.tsv | 8 +- petabtests/cases/v2.0.0/sbml/0011/_0011.yaml | 7 +- .../cases/v2.0.0/sbml/0011/_conditions.tsv | 4 +- petabtests/cases/v2.0.0/sbml/0012/_0012.yaml | 7 +- .../cases/v2.0.0/sbml/0012/_conditions.tsv | 4 +- petabtests/cases/v2.0.0/sbml/0013/_0013.yaml | 7 +- .../cases/v2.0.0/sbml/0013/_conditions.tsv | 4 +- petabtests/cases/v2.0.0/sbml/0014/_0014.yaml | 7 +- .../cases/v2.0.0/sbml/0014/_conditions.tsv | 3 +- .../cases/v2.0.0/sbml/0014/_measurements.tsv | 4 +- petabtests/cases/v2.0.0/sbml/0015/_0015.yaml | 7 +- .../cases/v2.0.0/sbml/0015/_conditions.tsv | 3 +- .../cases/v2.0.0/sbml/0015/_measurements.tsv | 4 +- petabtests/cases/v2.0.0/sbml/0016/_0016.yaml | 7 +- .../cases/v2.0.0/sbml/0016/_conditions.tsv | 3 +- .../cases/v2.0.0/sbml/0016/_measurements.tsv | 4 +- petabtests/cases/v2.0.0/sbml/0017/_0017.yaml | 7 +- .../cases/v2.0.0/sbml/0017/_conditions.tsv | 10 ++- petabtests/cases/v2.0.0/sbml/0018/_0018.yaml | 7 +- .../cases/v2.0.0/sbml/0018/_conditions.tsv | 10 ++- petabtests/cases/v2.0.0/sbml/0019/0019.py | 80 ++++++------------- petabtests/cases/v2.0.0/sbml/0019/_0019.yaml | 3 +- .../v2.0.0/sbml/0019/_0019_solution.yaml | 2 +- .../cases/v2.0.0/sbml/0019/_parameters.tsv | 10 +-- petabtests/cases/v2.0.0/sbml/0020/_0020.yaml | 7 +- .../cases/v2.0.0/sbml/0020/_conditions.tsv | 5 +- petabtests/cases/v2.0.0/sbml/0021/0021.py | 57 ++++--------- petabtests/cases/v2.0.0/sbml/0021/_0021.yaml | 10 +-- .../v2.0.0/sbml/0021/_0021_solution.yaml | 2 +- .../cases/v2.0.0/sbml/0021/_conditions.tsv | 3 +- .../cases/v2.0.0/sbml/0021/_measurements.tsv | 4 +- .../cases/v2.0.0/sbml/0021/_parameters.tsv | 12 +-- .../cases/v2.0.0/sbml/0021/_simulations.tsv | 4 +- petabtests/file.py | 39 +++++++-- 60 files changed, 239 insertions(+), 252 deletions(-) diff --git a/.ci_pip_reqs.txt b/.ci_pip_reqs.txt index 75eba8c..d066353 100644 --- a/.ci_pip_reqs.txt +++ b/.ci_pip_reqs.txt @@ -1,4 +1,4 @@ pytest ruff -git+https://github.com/PEtab-dev/libpetab-python@develop +git+https://github.com/PEtab-dev/libpetab-python@long_conditions sympy>=1.12.1 diff --git a/petabtests/cases/v2.0.0/sbml/0001/_0001.yaml b/petabtests/cases/v2.0.0/sbml/0001/_0001.yaml index b1337e7..c3170c2 100644 --- a/petabtests/cases/v2.0.0/sbml/0001/_0001.yaml +++ b/petabtests/cases/v2.0.0/sbml/0001/_0001.yaml @@ -5,9 +5,10 @@ problems: - _conditions.tsv measurement_files: - _measurements.tsv + observable_files: + - _observables.tsv model_files: - model_0: + _model: language: sbml location: _model.xml - observable_files: - - _observables.tsv +extensions: [] diff --git a/petabtests/cases/v2.0.0/sbml/0001/_conditions.tsv b/petabtests/cases/v2.0.0/sbml/0001/_conditions.tsv index f15e327..3664278 100644 --- a/petabtests/cases/v2.0.0/sbml/0001/_conditions.tsv +++ b/petabtests/cases/v2.0.0/sbml/0001/_conditions.tsv @@ -1,2 +1 @@ -conditionId -c0 +conditionId targetId valueType targetValue diff --git a/petabtests/cases/v2.0.0/sbml/0001/_measurements.tsv b/petabtests/cases/v2.0.0/sbml/0001/_measurements.tsv index a497632..47fdf7c 100644 --- a/petabtests/cases/v2.0.0/sbml/0001/_measurements.tsv +++ b/petabtests/cases/v2.0.0/sbml/0001/_measurements.tsv @@ -1,3 +1,3 @@ observableId simulationConditionId time measurement -obs_a c0 0 0.7 -obs_a c0 10 0.1 +obs_a 0 0.7 +obs_a 10 0.1 diff --git a/petabtests/cases/v2.0.0/sbml/0002/_0002.yaml b/petabtests/cases/v2.0.0/sbml/0002/_0002.yaml index b1337e7..c3170c2 100644 --- a/petabtests/cases/v2.0.0/sbml/0002/_0002.yaml +++ b/petabtests/cases/v2.0.0/sbml/0002/_0002.yaml @@ -5,9 +5,10 @@ problems: - _conditions.tsv measurement_files: - _measurements.tsv + observable_files: + - _observables.tsv model_files: - model_0: + _model: language: sbml location: _model.xml - observable_files: - - _observables.tsv +extensions: [] diff --git a/petabtests/cases/v2.0.0/sbml/0002/_conditions.tsv b/petabtests/cases/v2.0.0/sbml/0002/_conditions.tsv index 6524332..aba08a4 100644 --- a/petabtests/cases/v2.0.0/sbml/0002/_conditions.tsv +++ b/petabtests/cases/v2.0.0/sbml/0002/_conditions.tsv @@ -1,3 +1,5 @@ -conditionId a0 b0 -c0 0.8 -c1 0.9 +conditionId targetId targetValue valueType +c0 a0 0.8 constant +c1 a0 0.9 constant +c0 b0 constant +c1 b0 constant diff --git a/petabtests/cases/v2.0.0/sbml/0003/_0003.yaml b/petabtests/cases/v2.0.0/sbml/0003/_0003.yaml index b1337e7..c3170c2 100644 --- a/petabtests/cases/v2.0.0/sbml/0003/_0003.yaml +++ b/petabtests/cases/v2.0.0/sbml/0003/_0003.yaml @@ -5,9 +5,10 @@ problems: - _conditions.tsv measurement_files: - _measurements.tsv + observable_files: + - _observables.tsv model_files: - model_0: + _model: language: sbml location: _model.xml - observable_files: - - _observables.tsv +extensions: [] diff --git a/petabtests/cases/v2.0.0/sbml/0003/_conditions.tsv b/petabtests/cases/v2.0.0/sbml/0003/_conditions.tsv index f15e327..3664278 100644 --- a/petabtests/cases/v2.0.0/sbml/0003/_conditions.tsv +++ b/petabtests/cases/v2.0.0/sbml/0003/_conditions.tsv @@ -1,2 +1 @@ -conditionId -c0 +conditionId targetId valueType targetValue diff --git a/petabtests/cases/v2.0.0/sbml/0003/_measurements.tsv b/petabtests/cases/v2.0.0/sbml/0003/_measurements.tsv index 2078ec7..1552a5b 100644 --- a/petabtests/cases/v2.0.0/sbml/0003/_measurements.tsv +++ b/petabtests/cases/v2.0.0/sbml/0003/_measurements.tsv @@ -1,3 +1,3 @@ observableId simulationConditionId time measurement observableParameters -obs_a c0 0 0.7 0.5;2 -obs_a c0 10 0.1 0.5;2 +obs_a 0 0.7 0.5;2 +obs_a 10 0.1 0.5;2 diff --git a/petabtests/cases/v2.0.0/sbml/0004/_0004.yaml b/petabtests/cases/v2.0.0/sbml/0004/_0004.yaml index b1337e7..c3170c2 100644 --- a/petabtests/cases/v2.0.0/sbml/0004/_0004.yaml +++ b/petabtests/cases/v2.0.0/sbml/0004/_0004.yaml @@ -5,9 +5,10 @@ problems: - _conditions.tsv measurement_files: - _measurements.tsv + observable_files: + - _observables.tsv model_files: - model_0: + _model: language: sbml location: _model.xml - observable_files: - - _observables.tsv +extensions: [] diff --git a/petabtests/cases/v2.0.0/sbml/0004/_conditions.tsv b/petabtests/cases/v2.0.0/sbml/0004/_conditions.tsv index f15e327..3664278 100644 --- a/petabtests/cases/v2.0.0/sbml/0004/_conditions.tsv +++ b/petabtests/cases/v2.0.0/sbml/0004/_conditions.tsv @@ -1,2 +1 @@ -conditionId -c0 +conditionId targetId valueType targetValue diff --git a/petabtests/cases/v2.0.0/sbml/0004/_measurements.tsv b/petabtests/cases/v2.0.0/sbml/0004/_measurements.tsv index a497632..47fdf7c 100644 --- a/petabtests/cases/v2.0.0/sbml/0004/_measurements.tsv +++ b/petabtests/cases/v2.0.0/sbml/0004/_measurements.tsv @@ -1,3 +1,3 @@ observableId simulationConditionId time measurement -obs_a c0 0 0.7 -obs_a c0 10 0.1 +obs_a 0 0.7 +obs_a 10 0.1 diff --git a/petabtests/cases/v2.0.0/sbml/0005/_0005.yaml b/petabtests/cases/v2.0.0/sbml/0005/_0005.yaml index b1337e7..c3170c2 100644 --- a/petabtests/cases/v2.0.0/sbml/0005/_0005.yaml +++ b/petabtests/cases/v2.0.0/sbml/0005/_0005.yaml @@ -5,9 +5,10 @@ problems: - _conditions.tsv measurement_files: - _measurements.tsv + observable_files: + - _observables.tsv model_files: - model_0: + _model: language: sbml location: _model.xml - observable_files: - - _observables.tsv +extensions: [] diff --git a/petabtests/cases/v2.0.0/sbml/0005/_conditions.tsv b/petabtests/cases/v2.0.0/sbml/0005/_conditions.tsv index db79bf4..623c4d1 100644 --- a/petabtests/cases/v2.0.0/sbml/0005/_conditions.tsv +++ b/petabtests/cases/v2.0.0/sbml/0005/_conditions.tsv @@ -1,3 +1,3 @@ -conditionId offset_A -c0 offset_A_c0 -c1 offset_A_c1 +conditionId targetId targetValue valueType +c0 offset_A offset_A_c0 constant +c1 offset_A offset_A_c1 constant diff --git a/petabtests/cases/v2.0.0/sbml/0006/_0006.yaml b/petabtests/cases/v2.0.0/sbml/0006/_0006.yaml index b1337e7..c3170c2 100644 --- a/petabtests/cases/v2.0.0/sbml/0006/_0006.yaml +++ b/petabtests/cases/v2.0.0/sbml/0006/_0006.yaml @@ -5,9 +5,10 @@ problems: - _conditions.tsv measurement_files: - _measurements.tsv + observable_files: + - _observables.tsv model_files: - model_0: + _model: language: sbml location: _model.xml - observable_files: - - _observables.tsv +extensions: [] diff --git a/petabtests/cases/v2.0.0/sbml/0006/_conditions.tsv b/petabtests/cases/v2.0.0/sbml/0006/_conditions.tsv index f15e327..3664278 100644 --- a/petabtests/cases/v2.0.0/sbml/0006/_conditions.tsv +++ b/petabtests/cases/v2.0.0/sbml/0006/_conditions.tsv @@ -1,2 +1 @@ -conditionId -c0 +conditionId targetId valueType targetValue diff --git a/petabtests/cases/v2.0.0/sbml/0006/_measurements.tsv b/petabtests/cases/v2.0.0/sbml/0006/_measurements.tsv index 8ed279b..443864a 100644 --- a/petabtests/cases/v2.0.0/sbml/0006/_measurements.tsv +++ b/petabtests/cases/v2.0.0/sbml/0006/_measurements.tsv @@ -1,3 +1,3 @@ observableId simulationConditionId time measurement observableParameters -obs_a c0 0 0.7 10 -obs_a c0 10 0.1 15 +obs_a 0 0.7 10 +obs_a 10 0.1 15 diff --git a/petabtests/cases/v2.0.0/sbml/0007/_0007.yaml b/petabtests/cases/v2.0.0/sbml/0007/_0007.yaml index b1337e7..c3170c2 100644 --- a/petabtests/cases/v2.0.0/sbml/0007/_0007.yaml +++ b/petabtests/cases/v2.0.0/sbml/0007/_0007.yaml @@ -5,9 +5,10 @@ problems: - _conditions.tsv measurement_files: - _measurements.tsv + observable_files: + - _observables.tsv model_files: - model_0: + _model: language: sbml location: _model.xml - observable_files: - - _observables.tsv +extensions: [] diff --git a/petabtests/cases/v2.0.0/sbml/0007/_conditions.tsv b/petabtests/cases/v2.0.0/sbml/0007/_conditions.tsv index f15e327..3664278 100644 --- a/petabtests/cases/v2.0.0/sbml/0007/_conditions.tsv +++ b/petabtests/cases/v2.0.0/sbml/0007/_conditions.tsv @@ -1,2 +1 @@ -conditionId -c0 +conditionId targetId valueType targetValue diff --git a/petabtests/cases/v2.0.0/sbml/0007/_measurements.tsv b/petabtests/cases/v2.0.0/sbml/0007/_measurements.tsv index 00c596e..d9e4439 100644 --- a/petabtests/cases/v2.0.0/sbml/0007/_measurements.tsv +++ b/petabtests/cases/v2.0.0/sbml/0007/_measurements.tsv @@ -1,3 +1,3 @@ observableId simulationConditionId time measurement -obs_a c0 10 0.2 -obs_b c0 10 0.8 +obs_a 10 0.2 +obs_b 10 0.8 diff --git a/petabtests/cases/v2.0.0/sbml/0008/_0008.yaml b/petabtests/cases/v2.0.0/sbml/0008/_0008.yaml index b1337e7..c3170c2 100644 --- a/petabtests/cases/v2.0.0/sbml/0008/_0008.yaml +++ b/petabtests/cases/v2.0.0/sbml/0008/_0008.yaml @@ -5,9 +5,10 @@ problems: - _conditions.tsv measurement_files: - _measurements.tsv + observable_files: + - _observables.tsv model_files: - model_0: + _model: language: sbml location: _model.xml - observable_files: - - _observables.tsv +extensions: [] diff --git a/petabtests/cases/v2.0.0/sbml/0008/_conditions.tsv b/petabtests/cases/v2.0.0/sbml/0008/_conditions.tsv index f15e327..3664278 100644 --- a/petabtests/cases/v2.0.0/sbml/0008/_conditions.tsv +++ b/petabtests/cases/v2.0.0/sbml/0008/_conditions.tsv @@ -1,2 +1 @@ -conditionId -c0 +conditionId targetId valueType targetValue diff --git a/petabtests/cases/v2.0.0/sbml/0008/_measurements.tsv b/petabtests/cases/v2.0.0/sbml/0008/_measurements.tsv index b17d732..d2ae13a 100644 --- a/petabtests/cases/v2.0.0/sbml/0008/_measurements.tsv +++ b/petabtests/cases/v2.0.0/sbml/0008/_measurements.tsv @@ -1,4 +1,4 @@ observableId simulationConditionId time measurement -obs_a c0 0 0.7 -obs_a c0 10 0.1 -obs_a c0 10 0.2 +obs_a 0 0.7 +obs_a 10 0.1 +obs_a 10 0.2 diff --git a/petabtests/cases/v2.0.0/sbml/0009/_0009.yaml b/petabtests/cases/v2.0.0/sbml/0009/_0009.yaml index b1337e7..c3170c2 100644 --- a/petabtests/cases/v2.0.0/sbml/0009/_0009.yaml +++ b/petabtests/cases/v2.0.0/sbml/0009/_0009.yaml @@ -5,9 +5,10 @@ problems: - _conditions.tsv measurement_files: - _measurements.tsv + observable_files: + - _observables.tsv model_files: - model_0: + _model: language: sbml location: _model.xml - observable_files: - - _observables.tsv +extensions: [] diff --git a/petabtests/cases/v2.0.0/sbml/0009/_conditions.tsv b/petabtests/cases/v2.0.0/sbml/0009/_conditions.tsv index 834fafc..42a1401 100644 --- a/petabtests/cases/v2.0.0/sbml/0009/_conditions.tsv +++ b/petabtests/cases/v2.0.0/sbml/0009/_conditions.tsv @@ -1,3 +1,3 @@ -conditionId k1 -preeq_c0 0.3 -c0 0.8 +conditionId targetId targetValue valueType +preeq_c0 k1 0.3 constant +c0 k1 0.8 constant diff --git a/petabtests/cases/v2.0.0/sbml/0010/_0010.yaml b/petabtests/cases/v2.0.0/sbml/0010/_0010.yaml index b1337e7..c3170c2 100644 --- a/petabtests/cases/v2.0.0/sbml/0010/_0010.yaml +++ b/petabtests/cases/v2.0.0/sbml/0010/_0010.yaml @@ -5,9 +5,10 @@ problems: - _conditions.tsv measurement_files: - _measurements.tsv + observable_files: + - _observables.tsv model_files: - model_0: + _model: language: sbml location: _model.xml - observable_files: - - _observables.tsv +extensions: [] diff --git a/petabtests/cases/v2.0.0/sbml/0010/_conditions.tsv b/petabtests/cases/v2.0.0/sbml/0010/_conditions.tsv index 96cbc94..b4012d5 100644 --- a/petabtests/cases/v2.0.0/sbml/0010/_conditions.tsv +++ b/petabtests/cases/v2.0.0/sbml/0010/_conditions.tsv @@ -1,3 +1,5 @@ -conditionId k1 B -preeq_c0 0.3 0 -c0 0.8 1 +conditionId targetId targetValue valueType +preeq_c0 k1 0.3 constant +c0 k1 0.8 constant +preeq_c0 B 0.0 initial +c0 B 1.0 initial diff --git a/petabtests/cases/v2.0.0/sbml/0011/_0011.yaml b/petabtests/cases/v2.0.0/sbml/0011/_0011.yaml index b1337e7..c3170c2 100644 --- a/petabtests/cases/v2.0.0/sbml/0011/_0011.yaml +++ b/petabtests/cases/v2.0.0/sbml/0011/_0011.yaml @@ -5,9 +5,10 @@ problems: - _conditions.tsv measurement_files: - _measurements.tsv + observable_files: + - _observables.tsv model_files: - model_0: + _model: language: sbml location: _model.xml - observable_files: - - _observables.tsv +extensions: [] diff --git a/petabtests/cases/v2.0.0/sbml/0011/_conditions.tsv b/petabtests/cases/v2.0.0/sbml/0011/_conditions.tsv index e765b36..2f2cece 100644 --- a/petabtests/cases/v2.0.0/sbml/0011/_conditions.tsv +++ b/petabtests/cases/v2.0.0/sbml/0011/_conditions.tsv @@ -1,2 +1,2 @@ -conditionId B -c0 2 +conditionId targetId targetValue valueType +c0 B 2 initial diff --git a/petabtests/cases/v2.0.0/sbml/0012/_0012.yaml b/petabtests/cases/v2.0.0/sbml/0012/_0012.yaml index b1337e7..c3170c2 100644 --- a/petabtests/cases/v2.0.0/sbml/0012/_0012.yaml +++ b/petabtests/cases/v2.0.0/sbml/0012/_0012.yaml @@ -5,9 +5,10 @@ problems: - _conditions.tsv measurement_files: - _measurements.tsv + observable_files: + - _observables.tsv model_files: - model_0: + _model: language: sbml location: _model.xml - observable_files: - - _observables.tsv +extensions: [] diff --git a/petabtests/cases/v2.0.0/sbml/0012/_conditions.tsv b/petabtests/cases/v2.0.0/sbml/0012/_conditions.tsv index 13666c2..e0aecfd 100644 --- a/petabtests/cases/v2.0.0/sbml/0012/_conditions.tsv +++ b/petabtests/cases/v2.0.0/sbml/0012/_conditions.tsv @@ -1,2 +1,2 @@ -conditionId compartment -c0 3 +conditionId targetId targetValue valueType +c0 compartment 3 initial diff --git a/petabtests/cases/v2.0.0/sbml/0013/_0013.yaml b/petabtests/cases/v2.0.0/sbml/0013/_0013.yaml index b1337e7..c3170c2 100644 --- a/petabtests/cases/v2.0.0/sbml/0013/_0013.yaml +++ b/petabtests/cases/v2.0.0/sbml/0013/_0013.yaml @@ -5,9 +5,10 @@ problems: - _conditions.tsv measurement_files: - _measurements.tsv + observable_files: + - _observables.tsv model_files: - model_0: + _model: language: sbml location: _model.xml - observable_files: - - _observables.tsv +extensions: [] diff --git a/petabtests/cases/v2.0.0/sbml/0013/_conditions.tsv b/petabtests/cases/v2.0.0/sbml/0013/_conditions.tsv index a26fa5d..e52b503 100644 --- a/petabtests/cases/v2.0.0/sbml/0013/_conditions.tsv +++ b/petabtests/cases/v2.0.0/sbml/0013/_conditions.tsv @@ -1,2 +1,2 @@ -conditionId B -c0 par +conditionId targetId targetValue valueType +c0 B par initial diff --git a/petabtests/cases/v2.0.0/sbml/0014/_0014.yaml b/petabtests/cases/v2.0.0/sbml/0014/_0014.yaml index b1337e7..c3170c2 100644 --- a/petabtests/cases/v2.0.0/sbml/0014/_0014.yaml +++ b/petabtests/cases/v2.0.0/sbml/0014/_0014.yaml @@ -5,9 +5,10 @@ problems: - _conditions.tsv measurement_files: - _measurements.tsv + observable_files: + - _observables.tsv model_files: - model_0: + _model: language: sbml location: _model.xml - observable_files: - - _observables.tsv +extensions: [] diff --git a/petabtests/cases/v2.0.0/sbml/0014/_conditions.tsv b/petabtests/cases/v2.0.0/sbml/0014/_conditions.tsv index f15e327..3664278 100644 --- a/petabtests/cases/v2.0.0/sbml/0014/_conditions.tsv +++ b/petabtests/cases/v2.0.0/sbml/0014/_conditions.tsv @@ -1,2 +1 @@ -conditionId -c0 +conditionId targetId valueType targetValue diff --git a/petabtests/cases/v2.0.0/sbml/0014/_measurements.tsv b/petabtests/cases/v2.0.0/sbml/0014/_measurements.tsv index 980766d..9083eb1 100644 --- a/petabtests/cases/v2.0.0/sbml/0014/_measurements.tsv +++ b/petabtests/cases/v2.0.0/sbml/0014/_measurements.tsv @@ -1,3 +1,3 @@ observableId simulationConditionId time measurement noiseParameters -obs_a c0 0 0.7 0.5;2 -obs_a c0 10 0.1 0.5;2 +obs_a 0 0.7 0.5;2 +obs_a 10 0.1 0.5;2 diff --git a/petabtests/cases/v2.0.0/sbml/0015/_0015.yaml b/petabtests/cases/v2.0.0/sbml/0015/_0015.yaml index b1337e7..c3170c2 100644 --- a/petabtests/cases/v2.0.0/sbml/0015/_0015.yaml +++ b/petabtests/cases/v2.0.0/sbml/0015/_0015.yaml @@ -5,9 +5,10 @@ problems: - _conditions.tsv measurement_files: - _measurements.tsv + observable_files: + - _observables.tsv model_files: - model_0: + _model: language: sbml location: _model.xml - observable_files: - - _observables.tsv +extensions: [] diff --git a/petabtests/cases/v2.0.0/sbml/0015/_conditions.tsv b/petabtests/cases/v2.0.0/sbml/0015/_conditions.tsv index f15e327..3664278 100644 --- a/petabtests/cases/v2.0.0/sbml/0015/_conditions.tsv +++ b/petabtests/cases/v2.0.0/sbml/0015/_conditions.tsv @@ -1,2 +1 @@ -conditionId -c0 +conditionId targetId valueType targetValue diff --git a/petabtests/cases/v2.0.0/sbml/0015/_measurements.tsv b/petabtests/cases/v2.0.0/sbml/0015/_measurements.tsv index 687cf08..c1ae0cc 100644 --- a/petabtests/cases/v2.0.0/sbml/0015/_measurements.tsv +++ b/petabtests/cases/v2.0.0/sbml/0015/_measurements.tsv @@ -1,3 +1,3 @@ observableId simulationConditionId time measurement noiseParameters -obs_a c0 0 0.7 noise -obs_a c0 10 0.1 noise +obs_a 0 0.7 noise +obs_a 10 0.1 noise diff --git a/petabtests/cases/v2.0.0/sbml/0016/_0016.yaml b/petabtests/cases/v2.0.0/sbml/0016/_0016.yaml index b1337e7..c3170c2 100644 --- a/petabtests/cases/v2.0.0/sbml/0016/_0016.yaml +++ b/petabtests/cases/v2.0.0/sbml/0016/_0016.yaml @@ -5,9 +5,10 @@ problems: - _conditions.tsv measurement_files: - _measurements.tsv + observable_files: + - _observables.tsv model_files: - model_0: + _model: language: sbml location: _model.xml - observable_files: - - _observables.tsv +extensions: [] diff --git a/petabtests/cases/v2.0.0/sbml/0016/_conditions.tsv b/petabtests/cases/v2.0.0/sbml/0016/_conditions.tsv index f15e327..3664278 100644 --- a/petabtests/cases/v2.0.0/sbml/0016/_conditions.tsv +++ b/petabtests/cases/v2.0.0/sbml/0016/_conditions.tsv @@ -1,2 +1 @@ -conditionId -c0 +conditionId targetId valueType targetValue diff --git a/petabtests/cases/v2.0.0/sbml/0016/_measurements.tsv b/petabtests/cases/v2.0.0/sbml/0016/_measurements.tsv index 00c596e..d9e4439 100644 --- a/petabtests/cases/v2.0.0/sbml/0016/_measurements.tsv +++ b/petabtests/cases/v2.0.0/sbml/0016/_measurements.tsv @@ -1,3 +1,3 @@ observableId simulationConditionId time measurement -obs_a c0 10 0.2 -obs_b c0 10 0.8 +obs_a 10 0.2 +obs_b 10 0.8 diff --git a/petabtests/cases/v2.0.0/sbml/0017/_0017.yaml b/petabtests/cases/v2.0.0/sbml/0017/_0017.yaml index b1337e7..c3170c2 100644 --- a/petabtests/cases/v2.0.0/sbml/0017/_0017.yaml +++ b/petabtests/cases/v2.0.0/sbml/0017/_0017.yaml @@ -5,9 +5,10 @@ problems: - _conditions.tsv measurement_files: - _measurements.tsv + observable_files: + - _observables.tsv model_files: - model_0: + _model: language: sbml location: _model.xml - observable_files: - - _observables.tsv +extensions: [] diff --git a/petabtests/cases/v2.0.0/sbml/0017/_conditions.tsv b/petabtests/cases/v2.0.0/sbml/0017/_conditions.tsv index 18cccad..287e74a 100644 --- a/petabtests/cases/v2.0.0/sbml/0017/_conditions.tsv +++ b/petabtests/cases/v2.0.0/sbml/0017/_conditions.tsv @@ -1,3 +1,7 @@ -conditionId k1 B A -preeq_c0 0.3 2.0 0 -c0 0.8 NaN 1 +conditionId targetId targetValue valueType +preeq_c0 k1 0.3 constant +c0 k1 0.8 constant +preeq_c0 B 2.0 initial +c0 B initial +preeq_c0 A 0.0 initial +c0 A 1.0 initial diff --git a/petabtests/cases/v2.0.0/sbml/0018/_0018.yaml b/petabtests/cases/v2.0.0/sbml/0018/_0018.yaml index b1337e7..c3170c2 100644 --- a/petabtests/cases/v2.0.0/sbml/0018/_0018.yaml +++ b/petabtests/cases/v2.0.0/sbml/0018/_0018.yaml @@ -5,9 +5,10 @@ problems: - _conditions.tsv measurement_files: - _measurements.tsv + observable_files: + - _observables.tsv model_files: - model_0: + _model: language: sbml location: _model.xml - observable_files: - - _observables.tsv +extensions: [] diff --git a/petabtests/cases/v2.0.0/sbml/0018/_conditions.tsv b/petabtests/cases/v2.0.0/sbml/0018/_conditions.tsv index 18cccad..287e74a 100644 --- a/petabtests/cases/v2.0.0/sbml/0018/_conditions.tsv +++ b/petabtests/cases/v2.0.0/sbml/0018/_conditions.tsv @@ -1,3 +1,7 @@ -conditionId k1 B A -preeq_c0 0.3 2.0 0 -c0 0.8 NaN 1 +conditionId targetId targetValue valueType +preeq_c0 k1 0.3 constant +c0 k1 0.8 constant +preeq_c0 B 2.0 initial +c0 B initial +preeq_c0 A 0.0 initial +c0 A 1.0 initial diff --git a/petabtests/cases/v2.0.0/sbml/0019/0019.py b/petabtests/cases/v2.0.0/sbml/0019/0019.py index 55a9921..d2441db 100644 --- a/petabtests/cases/v2.0.0/sbml/0019/0019.py +++ b/petabtests/cases/v2.0.0/sbml/0019/0019.py @@ -1,8 +1,7 @@ from inspect import cleandoc -import pandas as pd -from petab.v1.C import * - +from petab.v2.C import * +from petab.v2 import Problem from petabtests import DEFAULT_SBML_FILE, PetabTestCase, analytical_a DESCRIPTION = cleandoc(""" @@ -17,74 +16,41 @@ """) # problem -------------------------------------------------------------------- +problem = Problem() # TODO use mapping here -condition_df = pd.DataFrame( - data={ - CONDITION_ID: ["c0"], - } -).set_index([CONDITION_ID]) - -measurement_df = pd.DataFrame( - data={ - OBSERVABLE_ID: ["obs_a", "obs_a"], - SIMULATION_CONDITION_ID: ["c0", "c0"], - TIME: [0, 10], - MEASUREMENT: [0.7, 0.1], - } -) - -observable_df = pd.DataFrame( - data={ - OBSERVABLE_ID: ["obs_a"], - OBSERVABLE_FORMULA: ["maps_to_A"], - NOISE_FORMULA: [0.5], - } -).set_index([OBSERVABLE_ID]) - -parameter_df = pd.DataFrame( - data={ - PARAMETER_ID: ["a0", "maps_to_b0", "k1", "maps_to_k2"], - PARAMETER_SCALE: [LIN] * 4, - LOWER_BOUND: [0] * 4, - UPPER_BOUND: [10] * 4, - NOMINAL_VALUE: [1, 0, 0.8, 0.6], - ESTIMATE: [1] * 4, - } -).set_index(PARAMETER_ID) +problem.add_condition("c0") +problem.add_measurement("obs_a", "c0", 0, 0.7) +problem.add_measurement("obs_a", "c0", 10, 0.1) +problem.add_observable("obs_a", "maps_to_A", 0.5) +problem.add_parameter("a0", lb=0, ub=10, nominal_value=1, scale=LIN) +problem.add_parameter("maps_to_b0", lb=0, ub=10, nominal_value=0, scale=LIN) +problem.add_parameter("k1", lb=0, ub=10, nominal_value=0.8, scale=LIN) +problem.add_parameter("maps_to_k2", lb=0, ub=10, nominal_value=0.6, scale=LIN) +problem.add_mapping("maps_to_a0", "a0") +problem.add_mapping("maps_to_b0", "b0") +problem.add_mapping("maps_to_k1", "k1") +problem.add_mapping("maps_to_k2", "k2") +problem.add_mapping("maps_to_A", "A") +problem.add_mapping("maps_to_B", "B") # solutions ------------------------------------------------------------------ -simulation_df = measurement_df.copy(deep=True).rename( +simulation_df = problem.measurement_df.copy(deep=True).rename( columns={MEASUREMENT: SIMULATION} ) simulation_df[SIMULATION] = [ analytical_a(t, 1, 0, 0.8, 0.6) for t in simulation_df[TIME] ] - -mapping_df = pd.DataFrame( - data={ - PETAB_ENTITY_ID: [ - "maps_to_a0", - "maps_to_b0", - "maps_to_k1", - "maps_to_k2", - "maps_to_A", - "maps_to_B", - ], - MODEL_ENTITY_ID: ["a0", "b0", "k1", "k2", "A", "B"], - } -).set_index(PETAB_ENTITY_ID) - case = PetabTestCase( id=19, brief="Mapping table.", description=DESCRIPTION, # TODO add local parameter and use in mapping table model=DEFAULT_SBML_FILE, - condition_dfs=[condition_df], - observable_dfs=[observable_df], - measurement_dfs=[measurement_df], + condition_dfs=[], + observable_dfs=[problem.observable_df], + measurement_dfs=[problem.measurement_df], simulation_dfs=[simulation_df], - parameter_df=parameter_df, - mapping_df=mapping_df, + parameter_df=problem.parameter_df, + mapping_df=problem.mapping_df, ) diff --git a/petabtests/cases/v2.0.0/sbml/0019/_0019.yaml b/petabtests/cases/v2.0.0/sbml/0019/_0019.yaml index c87fb5a..5e75a23 100644 --- a/petabtests/cases/v2.0.0/sbml/0019/_0019.yaml +++ b/petabtests/cases/v2.0.0/sbml/0019/_0019.yaml @@ -1,8 +1,7 @@ format_version: 2.0.0 parameter_file: _parameters.tsv problems: -- condition_files: - - _conditions.tsv +- condition_files: [] mapping_files: - _mapping.tsv measurement_files: diff --git a/petabtests/cases/v2.0.0/sbml/0019/_0019_solution.yaml b/petabtests/cases/v2.0.0/sbml/0019/_0019_solution.yaml index 1ee1c67..4a41272 100644 --- a/petabtests/cases/v2.0.0/sbml/0019/_0019_solution.yaml +++ b/petabtests/cases/v2.0.0/sbml/0019/_0019_solution.yaml @@ -1,4 +1,4 @@ -chi2: 0.79183798368486 +chi2: 0.86367596736971 llh: -0.84750169713188 simulation_files: - _simulations.tsv diff --git a/petabtests/cases/v2.0.0/sbml/0019/_parameters.tsv b/petabtests/cases/v2.0.0/sbml/0019/_parameters.tsv index 797509b..fcaf228 100644 --- a/petabtests/cases/v2.0.0/sbml/0019/_parameters.tsv +++ b/petabtests/cases/v2.0.0/sbml/0019/_parameters.tsv @@ -1,5 +1,5 @@ -parameterId parameterScale lowerBound upperBound nominalValue estimate -a0 lin 0 10 1.0 1 -maps_to_b0 lin 0 10 0.0 1 -k1 lin 0 10 0.8 1 -maps_to_k2 lin 0 10 0.6 1 +parameterId estimate nominalValue parameterScale lowerBound upperBound +a0 1 1.0 lin 0 10 +maps_to_b0 1 0.0 lin 0 10 +k1 1 0.8 lin 0 10 +maps_to_k2 1 0.6 lin 0 10 diff --git a/petabtests/cases/v2.0.0/sbml/0020/_0020.yaml b/petabtests/cases/v2.0.0/sbml/0020/_0020.yaml index b1337e7..c3170c2 100644 --- a/petabtests/cases/v2.0.0/sbml/0020/_0020.yaml +++ b/petabtests/cases/v2.0.0/sbml/0020/_0020.yaml @@ -5,9 +5,10 @@ problems: - _conditions.tsv measurement_files: - _measurements.tsv + observable_files: + - _observables.tsv model_files: - model_0: + _model: language: sbml location: _model.xml - observable_files: - - _observables.tsv +extensions: [] diff --git a/petabtests/cases/v2.0.0/sbml/0020/_conditions.tsv b/petabtests/cases/v2.0.0/sbml/0020/_conditions.tsv index 1297d08..f146116 100644 --- a/petabtests/cases/v2.0.0/sbml/0020/_conditions.tsv +++ b/petabtests/cases/v2.0.0/sbml/0020/_conditions.tsv @@ -1,2 +1,3 @@ -conditionId A B -c0 initial_A initial_B +conditionId targetId targetValue valueType +c0 A initial_A initial +c0 B initial_B initial diff --git a/petabtests/cases/v2.0.0/sbml/0021/0021.py b/petabtests/cases/v2.0.0/sbml/0021/0021.py index 1586a4b..7e353f3 100644 --- a/petabtests/cases/v2.0.0/sbml/0021/0021.py +++ b/petabtests/cases/v2.0.0/sbml/0021/0021.py @@ -1,8 +1,7 @@ from inspect import cleandoc -import pandas as pd -from petab.v1.C import * - +from petab.v2.C import * +from petab.v2 import Problem from petabtests import DEFAULT_SBML_FILE, PetabTestCase, analytical_a DESCRIPTION = cleandoc(""" @@ -19,44 +18,22 @@ # problem -------------------------------------------------------------------- -condition_df = pd.DataFrame( - data={ - CONDITION_ID: ["c0"], - } -).set_index([CONDITION_ID]) - -measurement_df = pd.DataFrame( - data={ - OBSERVABLE_ID: ["obs_a", "obs_a"], - SIMULATION_CONDITION_ID: ["c0", "c0"], - TIME: [0, 10], - MEASUREMENT: [0.7, 0.1], - NOISE_PARAMETERS: ["noise", "noise"], - } +problem = Problem() +problem.add_measurement("obs_a", "", 0, 0.7, noise_parameters=["noise"]) +problem.add_measurement("obs_a", "", 10, 0.1, noise_parameters=["noise"]) +problem.add_observable( + "obs_a", "A", noise_formula="noiseParameter1_obs_a * obs_a" ) +problem.add_parameter("a0", lb=0, ub=10, nominal_value=1, scale=LIN) +problem.add_parameter("b0", lb=0, ub=10, nominal_value=0, scale=LIN) +problem.add_parameter("k1", lb=0, ub=10, nominal_value=0.8, scale=LIN) +problem.add_parameter("k2", lb=0, ub=10, nominal_value=0.6, scale=LIN) +problem.add_parameter("noise", lb=0, ub=10, nominal_value=5, scale=LIN) -observable_df = pd.DataFrame( - data={ - OBSERVABLE_ID: ["obs_a"], - OBSERVABLE_FORMULA: ["A"], - NOISE_FORMULA: ["noiseParameter1_obs_a * obs_a"], - } -).set_index([OBSERVABLE_ID]) - -parameter_df = pd.DataFrame( - data={ - PARAMETER_ID: ["a0", "b0", "k1", "k2", "noise"], - PARAMETER_SCALE: [LIN] * 5, - LOWER_BOUND: [0] * 5, - UPPER_BOUND: [10] * 5, - NOMINAL_VALUE: [1, 0, 0.8, 0.6, 5], - ESTIMATE: [1] * 5, - } -).set_index(PARAMETER_ID) # solutions ------------------------------------------------------------------ -simulation_df = measurement_df.copy(deep=True).rename( +simulation_df = problem.measurement_df.copy(deep=True).rename( columns={MEASUREMENT: SIMULATION} ) simulation_df[SIMULATION] = [ @@ -69,9 +46,9 @@ brief="Simulation. Nothing special.", description=DESCRIPTION, model=DEFAULT_SBML_FILE, - condition_dfs=[condition_df], - observable_dfs=[observable_df], - measurement_dfs=[measurement_df], + condition_dfs=[], + observable_dfs=[problem.observable_df], + measurement_dfs=[problem.measurement_df], simulation_dfs=[simulation_df], - parameter_df=parameter_df, + parameter_df=problem.parameter_df, ) diff --git a/petabtests/cases/v2.0.0/sbml/0021/_0021.yaml b/petabtests/cases/v2.0.0/sbml/0021/_0021.yaml index b1337e7..e988ca3 100644 --- a/petabtests/cases/v2.0.0/sbml/0021/_0021.yaml +++ b/petabtests/cases/v2.0.0/sbml/0021/_0021.yaml @@ -1,13 +1,13 @@ format_version: 2.0.0 parameter_file: _parameters.tsv problems: -- condition_files: - - _conditions.tsv +- condition_files: [] measurement_files: - _measurements.tsv + observable_files: + - _observables.tsv model_files: - model_0: + _model: language: sbml location: _model.xml - observable_files: - - _observables.tsv +extensions: [] diff --git a/petabtests/cases/v2.0.0/sbml/0021/_0021_solution.yaml b/petabtests/cases/v2.0.0/sbml/0021/_0021_solution.yaml index fb2acef..a0060e6 100644 --- a/petabtests/cases/v2.0.0/sbml/0021/_0021_solution.yaml +++ b/petabtests/cases/v2.0.0/sbml/0021/_0021_solution.yaml @@ -1,4 +1,4 @@ -chi2: 0.0271111269779 +chi2: 0.04702225395579 llh: -4.22301170308364 simulation_files: - _simulations.tsv diff --git a/petabtests/cases/v2.0.0/sbml/0021/_conditions.tsv b/petabtests/cases/v2.0.0/sbml/0021/_conditions.tsv index f15e327..3664278 100644 --- a/petabtests/cases/v2.0.0/sbml/0021/_conditions.tsv +++ b/petabtests/cases/v2.0.0/sbml/0021/_conditions.tsv @@ -1,2 +1 @@ -conditionId -c0 +conditionId targetId valueType targetValue diff --git a/petabtests/cases/v2.0.0/sbml/0021/_measurements.tsv b/petabtests/cases/v2.0.0/sbml/0021/_measurements.tsv index 687cf08..c1ae0cc 100644 --- a/petabtests/cases/v2.0.0/sbml/0021/_measurements.tsv +++ b/petabtests/cases/v2.0.0/sbml/0021/_measurements.tsv @@ -1,3 +1,3 @@ observableId simulationConditionId time measurement noiseParameters -obs_a c0 0 0.7 noise -obs_a c0 10 0.1 noise +obs_a 0 0.7 noise +obs_a 10 0.1 noise diff --git a/petabtests/cases/v2.0.0/sbml/0021/_parameters.tsv b/petabtests/cases/v2.0.0/sbml/0021/_parameters.tsv index 46c9b55..adce913 100644 --- a/petabtests/cases/v2.0.0/sbml/0021/_parameters.tsv +++ b/petabtests/cases/v2.0.0/sbml/0021/_parameters.tsv @@ -1,6 +1,6 @@ -parameterId parameterScale lowerBound upperBound nominalValue estimate -a0 lin 0 10 1.0 1 -b0 lin 0 10 0.0 1 -k1 lin 0 10 0.8 1 -k2 lin 0 10 0.6 1 -noise lin 0 10 5.0 1 +parameterId estimate nominalValue parameterScale lowerBound upperBound +a0 1 1.0 lin 0 10 +b0 1 0.0 lin 0 10 +k1 1 0.8 lin 0 10 +k2 1 0.6 lin 0 10 +noise 1 5.0 lin 0 10 diff --git a/petabtests/cases/v2.0.0/sbml/0021/_simulations.tsv b/petabtests/cases/v2.0.0/sbml/0021/_simulations.tsv index 1bb82af..bc75731 100644 --- a/petabtests/cases/v2.0.0/sbml/0021/_simulations.tsv +++ b/petabtests/cases/v2.0.0/sbml/0021/_simulations.tsv @@ -1,3 +1,3 @@ observableId simulationConditionId time simulation noiseParameters -obs_a c0 0 1.0 noise -obs_a c0 10 0.42857190373069665 noise +obs_a 0 1.0 noise +obs_a 10 0.42857190373069665 noise diff --git a/petabtests/file.py b/petabtests/file.py index 1ed9bd2..2779299 100644 --- a/petabtests/file.py +++ b/petabtests/file.py @@ -6,7 +6,8 @@ from collections.abc import Callable from pathlib import Path import pandas as pd -import petab.v1 as petab +from petab import v1 +from petab import v2 import yaml from petab.v1.C import * # noqa: F403 from .C import * # noqa: F403 @@ -109,8 +110,11 @@ def write_problem( # id to string dir_ = get_case_dir(id_=test_id, format_=format_, version=version) - - if version == "v1.0.0": + if ( + version == "v1.0.0" + or SIMULATION_CONDITION_ID in measurement_dfs[0] + and not (version == "v2.0.0" and test_id == 19) + ): format_version = 1 else: assert version[0] == "v" @@ -149,9 +153,15 @@ def write_problem( pass copied_model_files.append(copied_model_file) - if version == "v1.0.0": + if ( + version == "v1.0.0" + or SIMULATION_CONDITION_ID in measurement_dfs[0] + and not (version == "v2.0.0" and test_id == 19) + ): + petab = v1 config[PROBLEMS][0][SBML_FILES] = copied_model_files else: + petab = v2 config[PROBLEMS][0][MODEL_FILES] = {} for model_idx, model_file in enumerate(copied_model_files): config[PROBLEMS][0][MODEL_FILES][f"model_{model_idx}"] = { @@ -198,7 +208,7 @@ def write_problem( config[PROBLEMS][0][MAPPING_FILES] = [mappings_file] # validate petab yaml - petab.validate(config, path_prefix=dir_) + v1.validate(config, path_prefix=dir_) # write yaml yaml_file = problem_yaml_name(test_id) @@ -206,6 +216,18 @@ def write_problem( with open(yaml_path, "w") as outfile: yaml.dump(config, outfile, default_flow_style=False) + # FIXME: Until the tests are proper v2 problems, we just auto-upgrade + # to a temp directory and copy the files back + if ( + version == "v2.0.0" + and SIMULATION_CONDITION_ID in measurement_dfs[0] + and not (version == "v2.0.0" and test_id == 19) + ): + from petab.v2.petab1to2 import petab1to2 + + petab1to2(yaml_path, dir_) + format_version = 2 + # FIXME Until a first libpetab with petab.v1 subpackage is released try: # new petab version @@ -230,8 +252,8 @@ def write_problem( ) except ModuleNotFoundError: # old petab version (will fail validation for some v2 tests) - problem = petab.Problem.from_yaml(os.path.join(dir_, yaml_file)) - if petab.lint_problem(problem): + problem = v1.Problem.from_yaml(os.path.join(dir_, yaml_file)) + if v1.lint_problem(problem): raise RuntimeError("Invalid PEtab problem, see messages above.") @@ -280,7 +302,8 @@ def write_solution( _write_dfs_to_files( dir_, "simulations", - petab.write_measurement_df, + # TODO v2 + v1.write_measurement_df, simulation_dfs, config[SIMULATION_FILES], )