From d4a2c5c8a020ba8739996a7b831b4a5f0a58bb29 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Thu, 22 Oct 2026 14:38:54 +0200 Subject: [PATCH] Fix incorrect problem IDs Rename problems whose ID does not match the publication: * `Giordano_Nature2020` -> `Giordano_NatMed2020` (published in Nature Medicine) * `Schwen_PONE2014` -> `Schwen_PLoSOne2015` (published in 2015) * `Weber_BMC2015` -> `Weber_BMCSystBiol2015` (BMC is the publisher, not the journal) The new IDs use the ISO 4 journal abbreviation (as listed in PubMed). Other existing IDs use different abbreviations (e.g. `PNAS`, `MSB`, `JBC`); they are not wrong and are not changed here. The SBML model IDs and names are updated accordingly. The former IDs are still accepted by the accessor functions with a `FutureWarning` (`RENAMED_MODELS`), but are not part of `MODELS`. Co-Authored-By: Claude Opus 5.5 --- README.md | 6 ++-- .../metadata.yaml | 0 .../v1/conditions.tsv | 0 .../v1/measurements.tsv | 0 .../v1/model.xml | 2 +- .../v1/observables.tsv | 0 .../v1/parameters.tsv | 0 .../v1/problem.yaml | 0 .../v1/simulations.tsv | 0 .../v1/visualizations.tsv | 0 .../metadata.yaml | 0 .../v1/conditions.tsv | 0 .../v1/measurements.tsv | 0 .../v1/model.xml | 2 +- .../v1/observables.tsv | 0 .../v1/parameters.tsv | 0 .../v1/problem.yaml | 0 .../v1/simulations.tsv | 0 .../v1/visualizations.tsv | 0 .../v2/conditions.tsv | 0 .../v2/experiments.tsv | 0 .../v2/measurements.tsv | 0 .../v2/model.xml | 2 +- .../v2/observables.tsv | 0 .../v2/parameters.tsv | 0 .../v2/problem.yaml | 0 .../metadata.yaml | 0 .../v1/conditions.tsv | 0 .../v1/measurements.tsv | 0 .../v1/model.xml | 2 +- .../v1/observables.tsv | 0 .../v1/parameters.tsv | 0 .../v1/problem.yaml | 0 .../v1/simulations.tsv | 0 .../v1/visualizations.tsv | 0 src/python/benchmark_models_petab/C.py | 8 +++++ src/python/benchmark_models_petab/__init__.py | 2 +- src/python/benchmark_models_petab/_ids.py | 22 ++++++++++++ src/python/benchmark_models_petab/metadata.py | 3 +- src/python/benchmark_models_petab/v1.py | 3 ++ src/python/benchmark_models_petab/v2.py | 3 ++ src/python/test/test_renamed.py | 36 +++++++++++++++++++ 42 files changed, 82 insertions(+), 9 deletions(-) rename problems/{Giordano_Nature2020 => Giordano_NatMed2020}/metadata.yaml (100%) rename problems/{Giordano_Nature2020 => Giordano_NatMed2020}/v1/conditions.tsv (100%) rename problems/{Giordano_Nature2020 => Giordano_NatMed2020}/v1/measurements.tsv (100%) rename problems/{Giordano_Nature2020 => Giordano_NatMed2020}/v1/model.xml (99%) rename problems/{Giordano_Nature2020 => Giordano_NatMed2020}/v1/observables.tsv (100%) rename problems/{Giordano_Nature2020 => Giordano_NatMed2020}/v1/parameters.tsv (100%) rename problems/{Giordano_Nature2020 => Giordano_NatMed2020}/v1/problem.yaml (100%) rename problems/{Giordano_Nature2020 => Giordano_NatMed2020}/v1/simulations.tsv (100%) rename problems/{Giordano_Nature2020 => Giordano_NatMed2020}/v1/visualizations.tsv (100%) rename problems/{Schwen_PONE2014 => Schwen_PLoSOne2015}/metadata.yaml (100%) rename problems/{Schwen_PONE2014 => Schwen_PLoSOne2015}/v1/conditions.tsv (100%) rename problems/{Schwen_PONE2014 => Schwen_PLoSOne2015}/v1/measurements.tsv (100%) rename problems/{Schwen_PONE2014 => Schwen_PLoSOne2015}/v1/model.xml (99%) rename problems/{Schwen_PONE2014 => Schwen_PLoSOne2015}/v1/observables.tsv (100%) rename problems/{Schwen_PONE2014 => Schwen_PLoSOne2015}/v1/parameters.tsv (100%) rename problems/{Schwen_PONE2014 => Schwen_PLoSOne2015}/v1/problem.yaml (100%) rename problems/{Schwen_PONE2014 => Schwen_PLoSOne2015}/v1/simulations.tsv (100%) rename problems/{Schwen_PONE2014 => Schwen_PLoSOne2015}/v1/visualizations.tsv (100%) rename problems/{Schwen_PONE2014 => Schwen_PLoSOne2015}/v2/conditions.tsv (100%) rename problems/{Schwen_PONE2014 => Schwen_PLoSOne2015}/v2/experiments.tsv (100%) rename problems/{Schwen_PONE2014 => Schwen_PLoSOne2015}/v2/measurements.tsv (100%) rename problems/{Schwen_PONE2014 => Schwen_PLoSOne2015}/v2/model.xml (99%) rename problems/{Schwen_PONE2014 => Schwen_PLoSOne2015}/v2/observables.tsv (100%) rename problems/{Schwen_PONE2014 => Schwen_PLoSOne2015}/v2/parameters.tsv (100%) rename problems/{Schwen_PONE2014 => Schwen_PLoSOne2015}/v2/problem.yaml (100%) rename problems/{Weber_BMC2015 => Weber_BMCSystBiol2015}/metadata.yaml (100%) rename problems/{Weber_BMC2015 => Weber_BMCSystBiol2015}/v1/conditions.tsv (100%) rename problems/{Weber_BMC2015 => Weber_BMCSystBiol2015}/v1/measurements.tsv (100%) rename problems/{Weber_BMC2015 => Weber_BMCSystBiol2015}/v1/model.xml (99%) rename problems/{Weber_BMC2015 => Weber_BMCSystBiol2015}/v1/observables.tsv (100%) rename problems/{Weber_BMC2015 => Weber_BMCSystBiol2015}/v1/parameters.tsv (100%) rename problems/{Weber_BMC2015 => Weber_BMCSystBiol2015}/v1/problem.yaml (100%) rename problems/{Weber_BMC2015 => Weber_BMCSystBiol2015}/v1/simulations.tsv (100%) rename problems/{Weber_BMC2015 => Weber_BMCSystBiol2015}/v1/visualizations.tsv (100%) create mode 100644 src/python/benchmark_models_petab/_ids.py create mode 100644 src/python/test/test_renamed.py diff --git a/README.md b/README.md index 85729fd5..736d0c9f 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ The PEtab files are available in the respective subdirectories. | [Fiedler_BMCSystBiol2016](problems/Fiedler_BMCSystBiol2016/) | [v1](problems/Fiedler_BMCSystBiol2016/v1/) | | Reaction network model of RAF/MEK/ERK signaling with ERK feedback in HeLa cells, fitted to phospho-MEK/ERK data without and with RAF or MEK inhibitors. | | [Froehlich_CellSystems2018](problems/Froehlich_CellSystems2018/) | [v1](problems/Froehlich_CellSystems2018/v1/) | | Large-scale reaction network model of cancer signaling pathways, parameterized by cell-line-specific gene expression and fitted to drug response viability data. | | [Fujita_SciSignal2010](problems/Fujita_SciSignal2010/) | [v1](problems/Fujita_SciSignal2010/v1/) | | Reaction network model of EGF-induced EGFR, Akt and S6 phosphorylation in PC12 cells under different EGF stimulation profiles. | -| [Giordano_Nature2020](problems/Giordano_Nature2020/) | [v1](problems/Giordano_Nature2020/v1/) | | Compartmental epidemiological model (SIDARTHE, distinguishing detected/undetected and symptom severity) of the COVID-19 epidemic in Italy. | +| [Giordano_NatMed2020](problems/Giordano_NatMed2020/) | [v1](problems/Giordano_NatMed2020/v1/) | | Compartmental epidemiological model (SIDARTHE, distinguishing detected/undetected and symptom severity) of the COVID-19 epidemic in Italy. | | [Isensee_JCB2018](problems/Isensee_JCB2018/) | [v1](problems/Isensee_JCB2018/v1/) | | Reaction network model of cAMP-induced PKA activation and phosphorylation of its regulatory subunit in rat sensory neurons under pharmacological perturbations. | | [Lang_PLOSComputBiol2024](problems/Lang_PLOSComputBiol2024/) | [v1](problems/Lang_PLOSComputBiol2024/v1/) | | Reaction network model of the human cell cycle, generated from a rule-based model and fitted to compartment-resolved single-cell imaging data of RPE-1 cells. | | [Laske_PLOSComputBiol2019](problems/Laske_PLOSComputBiol2019/) | [v1](problems/Laske_PLOSComputBiol2019/v1/) | | Reaction network model of intracellular influenza A virus replication, fitted to viral RNA, genome import and virus release data in human A549 cells. | @@ -49,10 +49,10 @@ The PEtab files are available in the respective subdirectories. | [Raia_CancerResearch2011](problems/Raia_CancerResearch2011/) | [v1](problems/Raia_CancerResearch2011/v1/) | | Reaction network model of IL-13-induced JAK2/STAT5 signaling in the primary mediastinal B-cell lymphoma cell line MedB-1. | | [Raimundez_PCB2020](problems/Raimundez_PCB2020/) | [v1](problems/Raimundez_PCB2020/v1/) | | Reaction network model of EGFR and MET signaling to ERK and AKT in two gastric cancer cell lines in response to EGF and the anti-EGFR antibody cetuximab. | | [SalazarCavazos_MBoC2020](problems/SalazarCavazos_MBoC2020/) | [v1](problems/SalazarCavazos_MBoC2020/v1/) | | Reaction network model of EGFR dimerization, multisite phosphorylation and binding of the adaptor proteins GRB2 and SHC1, generated from a rule-based model. | -| [Schwen_PONE2014](problems/Schwen_PONE2014/) | [v1](problems/Schwen_PONE2014/v1/) | [v2](problems/Schwen_PONE2014/v2/) | Reaction network model of insulin binding, internalization and degradation in two subpopulations of isolated hepatocytes with low and high insulin binding. | +| [Schwen_PLoSOne2015](problems/Schwen_PLoSOne2015/) | [v1](problems/Schwen_PLoSOne2015/v1/) | [v2](problems/Schwen_PLoSOne2015/v2/) | Reaction network model of insulin binding, internalization and degradation in two subpopulations of isolated hepatocytes with low and high insulin binding. | | [Smith_BMCSystBiol2013](problems/Smith_BMCSystBiol2013/) | [v1](problems/Smith_BMCSystBiol2013/v1/) | | Large reaction network model of insulin signaling in rodent adipocytes and its regulation by oxidative stress. | | [Sneyd_PNAS2002](problems/Sneyd_PNAS2002/) | [v1](problems/Sneyd_PNAS2002/v1/) | | Kinetic model of the type-2 IP3 receptor, fitted to time courses of calcium release from liver microsomes at varying IP3 and calcium concentrations. | -| [Weber_BMC2015](problems/Weber_BMC2015/) | [v1](problems/Weber_BMC2015/v1/) | | Reaction network model of interactions of protein kinase D, a lipid kinase (PI4KIIIbeta) and a ceramide transfer protein (CERT) at the trans-Golgi network. | +| [Weber_BMCSystBiol2015](problems/Weber_BMCSystBiol2015/) | [v1](problems/Weber_BMCSystBiol2015/v1/) | | Reaction network model of interactions of protein kinase D, a lipid kinase (PI4KIIIbeta) and a ceramide transfer protein (CERT) at the trans-Golgi network. | | [Zhao_QuantBiol2020](problems/Zhao_QuantBiol2020/) | [v1](problems/Zhao_QuantBiol2020/v1/) | | Compartmental epidemiological model of COVID-19 in Wuhan, Hubei and the rest of China, with quarantined and unquarantined infected individuals. | | [Zheng_PNAS2012](problems/Zheng_PNAS2012/) | [v1](problems/Zheng_PNAS2012/v1/) | | Reaction network model of the combinatorial methylation of lysines 27 and 36 on histone H3. | diff --git a/problems/Giordano_Nature2020/metadata.yaml b/problems/Giordano_NatMed2020/metadata.yaml similarity index 100% rename from problems/Giordano_Nature2020/metadata.yaml rename to problems/Giordano_NatMed2020/metadata.yaml diff --git a/problems/Giordano_Nature2020/v1/conditions.tsv b/problems/Giordano_NatMed2020/v1/conditions.tsv similarity index 100% rename from problems/Giordano_Nature2020/v1/conditions.tsv rename to problems/Giordano_NatMed2020/v1/conditions.tsv diff --git a/problems/Giordano_Nature2020/v1/measurements.tsv b/problems/Giordano_NatMed2020/v1/measurements.tsv similarity index 100% rename from problems/Giordano_Nature2020/v1/measurements.tsv rename to problems/Giordano_NatMed2020/v1/measurements.tsv diff --git a/problems/Giordano_Nature2020/v1/model.xml b/problems/Giordano_NatMed2020/v1/model.xml similarity index 99% rename from problems/Giordano_Nature2020/v1/model.xml rename to problems/Giordano_NatMed2020/v1/model.xml index 0324dbdb..2b3c1511 100644 --- a/problems/Giordano_Nature2020/v1/model.xml +++ b/problems/Giordano_NatMed2020/v1/model.xml @@ -1,7 +1,7 @@ - +
This is a model created on COPASI 4.27 (Build 217) which reproduces the Figures 2b, 2d, 3b, 3d, 4b, 4d in the article - https://www.nature.com/articles/s41591-020-0883-7
diff --git a/problems/Giordano_Nature2020/v1/observables.tsv b/problems/Giordano_NatMed2020/v1/observables.tsv
similarity index 100%
rename from problems/Giordano_Nature2020/v1/observables.tsv
rename to problems/Giordano_NatMed2020/v1/observables.tsv
diff --git a/problems/Giordano_Nature2020/v1/parameters.tsv b/problems/Giordano_NatMed2020/v1/parameters.tsv
similarity index 100%
rename from problems/Giordano_Nature2020/v1/parameters.tsv
rename to problems/Giordano_NatMed2020/v1/parameters.tsv
diff --git a/problems/Giordano_Nature2020/v1/problem.yaml b/problems/Giordano_NatMed2020/v1/problem.yaml
similarity index 100%
rename from problems/Giordano_Nature2020/v1/problem.yaml
rename to problems/Giordano_NatMed2020/v1/problem.yaml
diff --git a/problems/Giordano_Nature2020/v1/simulations.tsv b/problems/Giordano_NatMed2020/v1/simulations.tsv
similarity index 100%
rename from problems/Giordano_Nature2020/v1/simulations.tsv
rename to problems/Giordano_NatMed2020/v1/simulations.tsv
diff --git a/problems/Giordano_Nature2020/v1/visualizations.tsv b/problems/Giordano_NatMed2020/v1/visualizations.tsv
similarity index 100%
rename from problems/Giordano_Nature2020/v1/visualizations.tsv
rename to problems/Giordano_NatMed2020/v1/visualizations.tsv
diff --git a/problems/Schwen_PONE2014/metadata.yaml b/problems/Schwen_PLoSOne2015/metadata.yaml
similarity index 100%
rename from problems/Schwen_PONE2014/metadata.yaml
rename to problems/Schwen_PLoSOne2015/metadata.yaml
diff --git a/problems/Schwen_PONE2014/v1/conditions.tsv b/problems/Schwen_PLoSOne2015/v1/conditions.tsv
similarity index 100%
rename from problems/Schwen_PONE2014/v1/conditions.tsv
rename to problems/Schwen_PLoSOne2015/v1/conditions.tsv
diff --git a/problems/Schwen_PONE2014/v1/measurements.tsv b/problems/Schwen_PLoSOne2015/v1/measurements.tsv
similarity index 100%
rename from problems/Schwen_PONE2014/v1/measurements.tsv
rename to problems/Schwen_PLoSOne2015/v1/measurements.tsv
diff --git a/problems/Schwen_PONE2014/v1/model.xml b/problems/Schwen_PLoSOne2015/v1/model.xml
similarity index 99%
rename from problems/Schwen_PONE2014/v1/model.xml
rename to problems/Schwen_PLoSOne2015/v1/model.xml
index 1760145a..0d5dde0d 100644
--- a/problems/Schwen_PONE2014/v1/model.xml
+++ b/problems/Schwen_PLoSOne2015/v1/model.xml
@@ -1,6 +1,6 @@
 
 
-  
+  
     
       
         
PEtab implementation of the model from Schwen et al. (2015), PLoS One, 10, e0133653
diff --git a/problems/Schwen_PONE2014/v1/observables.tsv b/problems/Schwen_PLoSOne2015/v1/observables.tsv similarity index 100% rename from problems/Schwen_PONE2014/v1/observables.tsv rename to problems/Schwen_PLoSOne2015/v1/observables.tsv diff --git a/problems/Schwen_PONE2014/v1/parameters.tsv b/problems/Schwen_PLoSOne2015/v1/parameters.tsv similarity index 100% rename from problems/Schwen_PONE2014/v1/parameters.tsv rename to problems/Schwen_PLoSOne2015/v1/parameters.tsv diff --git a/problems/Schwen_PONE2014/v1/problem.yaml b/problems/Schwen_PLoSOne2015/v1/problem.yaml similarity index 100% rename from problems/Schwen_PONE2014/v1/problem.yaml rename to problems/Schwen_PLoSOne2015/v1/problem.yaml diff --git a/problems/Schwen_PONE2014/v1/simulations.tsv b/problems/Schwen_PLoSOne2015/v1/simulations.tsv similarity index 100% rename from problems/Schwen_PONE2014/v1/simulations.tsv rename to problems/Schwen_PLoSOne2015/v1/simulations.tsv diff --git a/problems/Schwen_PONE2014/v1/visualizations.tsv b/problems/Schwen_PLoSOne2015/v1/visualizations.tsv similarity index 100% rename from problems/Schwen_PONE2014/v1/visualizations.tsv rename to problems/Schwen_PLoSOne2015/v1/visualizations.tsv diff --git a/problems/Schwen_PONE2014/v2/conditions.tsv b/problems/Schwen_PLoSOne2015/v2/conditions.tsv similarity index 100% rename from problems/Schwen_PONE2014/v2/conditions.tsv rename to problems/Schwen_PLoSOne2015/v2/conditions.tsv diff --git a/problems/Schwen_PONE2014/v2/experiments.tsv b/problems/Schwen_PLoSOne2015/v2/experiments.tsv similarity index 100% rename from problems/Schwen_PONE2014/v2/experiments.tsv rename to problems/Schwen_PLoSOne2015/v2/experiments.tsv diff --git a/problems/Schwen_PONE2014/v2/measurements.tsv b/problems/Schwen_PLoSOne2015/v2/measurements.tsv similarity index 100% rename from problems/Schwen_PONE2014/v2/measurements.tsv rename to problems/Schwen_PLoSOne2015/v2/measurements.tsv diff --git a/problems/Schwen_PONE2014/v2/model.xml b/problems/Schwen_PLoSOne2015/v2/model.xml similarity index 99% rename from problems/Schwen_PONE2014/v2/model.xml rename to problems/Schwen_PLoSOne2015/v2/model.xml index d604ca54..d6d8b9ad 100644 --- a/problems/Schwen_PONE2014/v2/model.xml +++ b/problems/Schwen_PLoSOne2015/v2/model.xml @@ -1,6 +1,6 @@ - +
PEtab implementation of the model from Schwen et al. (2015), PLoS One, 10, e0133653
diff --git a/problems/Schwen_PONE2014/v2/observables.tsv b/problems/Schwen_PLoSOne2015/v2/observables.tsv similarity index 100% rename from problems/Schwen_PONE2014/v2/observables.tsv rename to problems/Schwen_PLoSOne2015/v2/observables.tsv diff --git a/problems/Schwen_PONE2014/v2/parameters.tsv b/problems/Schwen_PLoSOne2015/v2/parameters.tsv similarity index 100% rename from problems/Schwen_PONE2014/v2/parameters.tsv rename to problems/Schwen_PLoSOne2015/v2/parameters.tsv diff --git a/problems/Schwen_PONE2014/v2/problem.yaml b/problems/Schwen_PLoSOne2015/v2/problem.yaml similarity index 100% rename from problems/Schwen_PONE2014/v2/problem.yaml rename to problems/Schwen_PLoSOne2015/v2/problem.yaml diff --git a/problems/Weber_BMC2015/metadata.yaml b/problems/Weber_BMCSystBiol2015/metadata.yaml similarity index 100% rename from problems/Weber_BMC2015/metadata.yaml rename to problems/Weber_BMCSystBiol2015/metadata.yaml diff --git a/problems/Weber_BMC2015/v1/conditions.tsv b/problems/Weber_BMCSystBiol2015/v1/conditions.tsv similarity index 100% rename from problems/Weber_BMC2015/v1/conditions.tsv rename to problems/Weber_BMCSystBiol2015/v1/conditions.tsv diff --git a/problems/Weber_BMC2015/v1/measurements.tsv b/problems/Weber_BMCSystBiol2015/v1/measurements.tsv similarity index 100% rename from problems/Weber_BMC2015/v1/measurements.tsv rename to problems/Weber_BMCSystBiol2015/v1/measurements.tsv diff --git a/problems/Weber_BMC2015/v1/model.xml b/problems/Weber_BMCSystBiol2015/v1/model.xml similarity index 99% rename from problems/Weber_BMC2015/v1/model.xml rename to problems/Weber_BMCSystBiol2015/v1/model.xml index 58badddc..2459ee98 100644 --- a/problems/Weber_BMC2015/v1/model.xml +++ b/problems/Weber_BMCSystBiol2015/v1/model.xml @@ -1,6 +1,6 @@ - +
PEtab implementation of the model from Weber et al. (2015), BMC Syst. Biol., 9, 9
diff --git a/problems/Weber_BMC2015/v1/observables.tsv b/problems/Weber_BMCSystBiol2015/v1/observables.tsv similarity index 100% rename from problems/Weber_BMC2015/v1/observables.tsv rename to problems/Weber_BMCSystBiol2015/v1/observables.tsv diff --git a/problems/Weber_BMC2015/v1/parameters.tsv b/problems/Weber_BMCSystBiol2015/v1/parameters.tsv similarity index 100% rename from problems/Weber_BMC2015/v1/parameters.tsv rename to problems/Weber_BMCSystBiol2015/v1/parameters.tsv diff --git a/problems/Weber_BMC2015/v1/problem.yaml b/problems/Weber_BMCSystBiol2015/v1/problem.yaml similarity index 100% rename from problems/Weber_BMC2015/v1/problem.yaml rename to problems/Weber_BMCSystBiol2015/v1/problem.yaml diff --git a/problems/Weber_BMC2015/v1/simulations.tsv b/problems/Weber_BMCSystBiol2015/v1/simulations.tsv similarity index 100% rename from problems/Weber_BMC2015/v1/simulations.tsv rename to problems/Weber_BMCSystBiol2015/v1/simulations.tsv diff --git a/problems/Weber_BMC2015/v1/visualizations.tsv b/problems/Weber_BMCSystBiol2015/v1/visualizations.tsv similarity index 100% rename from problems/Weber_BMC2015/v1/visualizations.tsv rename to problems/Weber_BMCSystBiol2015/v1/visualizations.tsv diff --git a/src/python/benchmark_models_petab/C.py b/src/python/benchmark_models_petab/C.py index e4e54aec..265a4a11 100644 --- a/src/python/benchmark_models_petab/C.py +++ b/src/python/benchmark_models_petab/C.py @@ -10,6 +10,14 @@ MODELS: List[str] = sorted(os.listdir(MODELS_DIR)) MODEL_DIRS: List[str] = [os.path.join(MODELS_DIR, d) for d in MODELS] +#: Former problem IDs, mapped to the current ones. +#: Accepted by the accessor functions, but not part of `MODELS`. +RENAMED_MODELS: dict[str, str] = { + "Giordano_Nature2020": "Giordano_NatMed2020", + "Schwen_PONE2014": "Schwen_PLoSOne2015", + "Weber_BMC2015": "Weber_BMCSystBiol2015", +} + # layout of a single problem directory (`//...`) V1_DIRNAME: str = "v1" V2_DIRNAME: str = "v2" diff --git a/src/python/benchmark_models_petab/__init__.py b/src/python/benchmark_models_petab/__init__.py index c901db29..720f6f2a 100644 --- a/src/python/benchmark_models_petab/__init__.py +++ b/src/python/benchmark_models_petab/__init__.py @@ -6,7 +6,7 @@ from . import v1, v2 from .v1 import get_problem, get_problem_yaml_path, get_simulation_df -from .C import MODEL_DIRS, MODELS, MODELS_DIR +from .C import MODEL_DIRS, MODELS, MODELS_DIR, RENAMED_MODELS from .metadata import ProblemMetadata, get_metadata from .overview import get_overview_df from importlib.metadata import PackageNotFoundError, version diff --git a/src/python/benchmark_models_petab/_ids.py b/src/python/benchmark_models_petab/_ids.py new file mode 100644 index 00000000..1717d9da --- /dev/null +++ b/src/python/benchmark_models_petab/_ids.py @@ -0,0 +1,22 @@ +"""Handling of former problem IDs.""" + +import warnings + +from .C import RENAMED_MODELS + + +def resolve_id(id_: str) -> str: + """Map a former problem ID to the current one, with a warning. + + Other IDs are returned unchanged. + """ + if (new_id := RENAMED_MODELS.get(id_)) is None: + return id_ + + warnings.warn( + f"Problem `{id_}` was renamed to `{new_id}`. " + "The old ID will stop working in a future version.", + FutureWarning, + stacklevel=3, + ) + return new_id diff --git a/src/python/benchmark_models_petab/metadata.py b/src/python/benchmark_models_petab/metadata.py index f85e5401..7b4fcacf 100644 --- a/src/python/benchmark_models_petab/metadata.py +++ b/src/python/benchmark_models_petab/metadata.py @@ -8,6 +8,7 @@ import yaml from pydantic import BaseModel, ConfigDict, Field +from ._ids import resolve_id from .C import METADATA_FILENAME, MODELS_DIR METADATA_SCHEMA_FILENAME = "metadata.schema.json" @@ -66,7 +67,7 @@ def get_metadata_path(id_: str) -> Path: ------- The path to the metadata file. The file is not guaranteed to exist. """ - return Path(MODELS_DIR, id_, METADATA_FILENAME) + return Path(MODELS_DIR, resolve_id(id_), METADATA_FILENAME) def get_metadata(id_: str) -> ProblemMetadata: diff --git a/src/python/benchmark_models_petab/v1.py b/src/python/benchmark_models_petab/v1.py index a1929ab5..15bfe725 100644 --- a/src/python/benchmark_models_petab/v1.py +++ b/src/python/benchmark_models_petab/v1.py @@ -6,6 +6,7 @@ import pandas as pd +from ._ids import resolve_id from .C import ( MODELS as ALL_MODELS, MODELS_DIR, @@ -33,6 +34,7 @@ def get_problem_yaml_path(id_: str) -> Path: ------- The path to the PEtab problem YAML file. """ + id_ = resolve_id(id_) yaml_path = Path(MODELS_DIR, id_, V1_DIRNAME, PROBLEM_FILENAME) if not yaml_path.exists(): raise ValueError( @@ -69,6 +71,7 @@ def get_simulation_df(id_: str) -> pd.DataFrame | None: ------- The simulation dataframe if it exists, else None. """ + id_ = resolve_id(id_) path = Path(MODELS_DIR, id_, V1_DIRNAME, SIMULATIONS_FILENAME) if path.is_file(): return petab.get_simulation_df(path) diff --git a/src/python/benchmark_models_petab/v2.py b/src/python/benchmark_models_petab/v2.py index d8fff250..e83cf211 100644 --- a/src/python/benchmark_models_petab/v2.py +++ b/src/python/benchmark_models_petab/v2.py @@ -5,6 +5,7 @@ import pandas as pd import petab.v2 as petab +from ._ids import resolve_id from .C import ( MODELS as ALL_MODELS, MODELS_DIR, @@ -32,6 +33,7 @@ def get_problem_yaml_path(id_: str) -> Path: ------- The path to the PEtab v2 problem YAML file. """ + id_ = resolve_id(id_) yaml_path = Path(MODELS_DIR, id_, V2_DIRNAME, PROBLEM_FILENAME) if not yaml_path.exists(): raise ValueError( @@ -67,6 +69,7 @@ def get_simulation_df(id_: str) -> pd.DataFrame | None: ------- The simulation dataframe if it exists, else None. """ + id_ = resolve_id(id_) path = Path(MODELS_DIR, id_, V2_DIRNAME, SIMULATIONS_FILENAME) if path.is_file(): return pd.read_csv( diff --git a/src/python/test/test_renamed.py b/src/python/test/test_renamed.py new file mode 100644 index 00000000..5fe716b5 --- /dev/null +++ b/src/python/test/test_renamed.py @@ -0,0 +1,36 @@ +"""Tests for former problem IDs.""" + +import pytest + +import benchmark_models_petab as models +from benchmark_models_petab.overview import get_readme_table + + +def test_renamed_models_are_not_problems(): + """Former IDs are no separate problems, their replacements exist.""" + assert not set(models.RENAMED_MODELS) & set(models.MODELS) + assert not set(models.RENAMED_MODELS) & set(models.v1.MODELS) + assert not set(models.RENAMED_MODELS) & set(models.v2.MODELS) + assert set(models.RENAMED_MODELS.values()) <= set(models.MODELS) + + table = get_readme_table() + for old_id in models.RENAMED_MODELS: + assert old_id not in table + + +@pytest.mark.parametrize( + "old_id,new_id", + [("Schwen_PONE2014", "Schwen_PLoSOne2015")], +) +def test_former_id_is_accepted_with_warning(old_id, new_id): + for version in (models.v1, models.v2): + with pytest.warns(FutureWarning, match=new_id): + path = version.get_problem_yaml_path(old_id) + assert path == version.get_problem_yaml_path(new_id) + with pytest.warns(FutureWarning, match=new_id): + problem = models.get_problem(old_id) + assert problem.model.model_id == new_id + with pytest.warns(FutureWarning, match=new_id): + assert models.get_simulation_df(old_id) is not None + with pytest.warns(FutureWarning, match=new_id): + assert models.get_metadata(old_id) == models.get_metadata(new_id)