From 470b46839434af017d0f860e77562709b2407568 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Mon, 16 Sep 2024 14:47:08 +0200 Subject: [PATCH 1/4] PEtab import: Priors aren't support -> raise So far, parPE doesn't support priors. Most of the PEtab import was written before priors were introduced. That's why unfortunately there wasn't any warning/error in place so far. --- python/parpe/hdf5_pe_input.py | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/python/parpe/hdf5_pe_input.py b/python/parpe/hdf5_pe_input.py index 9957dd2d..7e5f35a9 100644 --- a/python/parpe/hdf5_pe_input.py +++ b/python/parpe/hdf5_pe_input.py @@ -93,9 +93,6 @@ def __init__(self, self.petab_problem: petab.Problem = petab_problem self.amici_model: amici.Model = amici_model - # ensure we have valid inputs - petab.lint_problem(self.petab_problem) - # index for no reference/preequilibration condition self.NO_PREEQ_CONDITION_IDX: int = NO_PREEQ_CONDITION_IDX @@ -105,6 +102,28 @@ def __init__(self, # hdf5 dataset compression self.compression = "gzip" + self._check_support() + + def _check_support(self): + """ + Check if the model is supported by parPE + """ + # ensure we have valid inputs + petab.lint_problem(self.petab_problem) + + # We can't handle priors yet + # Initialization priors would work in principle when we sample + # starting points using petab. However, the current parpe C++ + # resampling would ignore the initialization prior. + # And they wouldn't be supported for hierarchical optimization. + parameter_df = self.petab_problem.parameter_df + for col_id in [ + ptc.INITIALIZATION_PRIOR_TYPE, ptc.INITIALIZATION_PRIOR_PARAMETERS, + ptc.OBJECTIVE_PRIOR_TYPE, ptc.OBJECTIVE_PRIOR_PARAMETERS + ]: + if (col := parameter_df.get(col_id)) is not None and col.notna().any(): + raise NotImplementedError("Priors are not supported yet.") + def generate_file(self, hdf5_file_name: str) -> None: """ Create the output file From 083e9e4804f796ebae7b69f27c503de5a21075d5 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Mon, 16 Sep 2024 18:50:31 +0200 Subject: [PATCH 2/4] Skip unsupported benchmark models --- .../tests/benchmark-models/test_petab_benchmark.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/deps/AMICI/tests/benchmark-models/test_petab_benchmark.py b/deps/AMICI/tests/benchmark-models/test_petab_benchmark.py index 0b3c6d80..2a4e295f 100755 --- a/deps/AMICI/tests/benchmark-models/test_petab_benchmark.py +++ b/deps/AMICI/tests/benchmark-models/test_petab_benchmark.py @@ -31,15 +31,19 @@ if petab_path.is_dir() if str(petab_path.stem) not in ( + # excluded due to unsupported priors + "Schwen_PONE2014", + "Zhao_QuantBiol2020", # excluded due to excessive runtime - "Bachmann_MSB2011", + "Bachmann_MSB2011", # prior "Chen_MSB2009", "Froehlich_CellSystems2018", - "Raimundez_PCB2020", + "Raimundez_PCB2020", # prior "Lucarelli_CellSystems2018", - "Isensee_JCB2018", + "Isensee_JCB2018", # prior "Beer_MolBioSystems2014", "Alkan_SciSignal2018", + "Lang_PLOSComputBiol2024", # excluded due to excessive numerical failures "Crauste_CellSystems2017", "Fujita_SciSignal2010", From d92b8c5e810ee11f9a59e53bcdfa3a75c2b53a01 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Mon, 16 Sep 2024 19:03:45 +0200 Subject: [PATCH 3/4] Revert "Skip unsupported benchmark models" This reverts commit 083e9e4804f796ebae7b69f27c503de5a21075d5. --- .../tests/benchmark-models/test_petab_benchmark.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/deps/AMICI/tests/benchmark-models/test_petab_benchmark.py b/deps/AMICI/tests/benchmark-models/test_petab_benchmark.py index 2a4e295f..0b3c6d80 100755 --- a/deps/AMICI/tests/benchmark-models/test_petab_benchmark.py +++ b/deps/AMICI/tests/benchmark-models/test_petab_benchmark.py @@ -31,19 +31,15 @@ if petab_path.is_dir() if str(petab_path.stem) not in ( - # excluded due to unsupported priors - "Schwen_PONE2014", - "Zhao_QuantBiol2020", # excluded due to excessive runtime - "Bachmann_MSB2011", # prior + "Bachmann_MSB2011", "Chen_MSB2009", "Froehlich_CellSystems2018", - "Raimundez_PCB2020", # prior + "Raimundez_PCB2020", "Lucarelli_CellSystems2018", - "Isensee_JCB2018", # prior + "Isensee_JCB2018", "Beer_MolBioSystems2014", "Alkan_SciSignal2018", - "Lang_PLOSComputBiol2024", # excluded due to excessive numerical failures "Crauste_CellSystems2017", "Fujita_SciSignal2010", From 1e0b74151d1cfe112eb71d086cc4d59130ac7590 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Mon, 16 Sep 2024 19:04:54 +0200 Subject: [PATCH 4/4] Skip unsupported benchmark models --- benchmark_collection/all.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/benchmark_collection/all.sh b/benchmark_collection/all.sh index d0737d04..6cab7283 100755 --- a/benchmark_collection/all.sh +++ b/benchmark_collection/all.sh @@ -13,7 +13,6 @@ Borghans_BiophysChem1997 Crauste_CellSystems2017 Elowitz_Nature2000 Fujita_SciSignal2010 -Schwen_PONE2014 Sneyd_PNAS2002 Weber_BMC2015 Zheng_PNAS2012 @@ -47,7 +46,9 @@ Zheng_PNAS2012 # Brannmark_JBC2010 FAILED: Expected llh 283.778227541074, got nllh 141.889034 # Lucarelli_CellSystems2018 # Fiedler_BMC2016 FAILED: Expected llh -117.16780323362, got nllh 109391.496205 - +# +# Unsupported priors: +# Schwen_PONE2014 for model_name in $expected_to_work; do printf '=%.0s' {1..20} printf %s "${model_name}"