From 043d13a21ef241fa83688097e153233027789e0e Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Sun, 16 Jun 2024 20:22:42 +0200 Subject: [PATCH 01/12] Update valgrind suppressions --- python/tests/valgrind-python.supp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/python/tests/valgrind-python.supp b/python/tests/valgrind-python.supp index ada85d34fa..16c92e3d1f 100644 --- a/python/tests/valgrind-python.supp +++ b/python/tests/valgrind-python.supp @@ -975,3 +975,13 @@ fun:_PyObject_GC_NewVar ... } + +{ + Python + Memcheck:Leak + match-leak-kinds: definite + fun:realloc + fun:_PyObject_GC_Resize + fun:_PyTuple_Resize + ... +} From 9e310132153d5ee5a8771b72828a480263b6e786 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Wed, 26 Jun 2024 11:47:33 +0200 Subject: [PATCH 02/12] Require sympy>=1.12.1 for numpy>=2.0 compatibility (#2462) So far, sympy was restricted to 1.11 via pysb, but sympy 1.11 is incompatible with numpy>=2.0 --- python/sdist/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/sdist/pyproject.toml b/python/sdist/pyproject.toml index f93d0c7e1b..e24bf6811a 100644 --- a/python/sdist/pyproject.toml +++ b/python/sdist/pyproject.toml @@ -16,7 +16,7 @@ description = "Advanced multi-language Interface to CVODES and IDAS" requires-python = ">=3.10" dependencies = [ "cmake-build-extension==0.6.0", - "sympy>=1.9", + "sympy>=1.12.1", "numpy>=1.19.3; python_version=='3.9'", "numpy>=1.21.4; python_version>='3.10'", "numpy>=1.23.2; python_version=='3.11'", From 474b473b33eab4c92b03aca59577e8333aedc2fb Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Wed, 26 Jun 2024 11:48:19 +0200 Subject: [PATCH 03/12] Update AMICI papers (#2466) --- documentation/background.rst | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/documentation/background.rst b/documentation/background.rst index 2a2e748672..f47c077d46 100644 --- a/documentation/background.rst +++ b/documentation/background.rst @@ -32,14 +32,22 @@ publications: * Lakrisenko, Polina, Paul Stapor, Stephan Grein, Łukasz Paszkowski, Dilan Pathirana, Fabian Fröhlich, Glenn Terje Lines, Daniel Weindl, - and Jan Hasenauer. 2022. + and Jan Hasenauer. 2023. **Efficient Computation of Adjoint Sensitivities at Steady-State in ODE Models - of Biochemical Reaction Networks.** *bioRxiv* 2022.08.08.503176. - DOI: `10.1101/2022.08.08.503176 `_. + of Biochemical Reaction Networks.** *PLoS Comput Biol* 19(1): e1010783. + DOI: `10.1371/journal.pcbi.1010783 `_. + +* L. Contento, P. Stapor, D. Weindl, and J. Hasenauer. 2023. + **A more expressive spline representation for SBML models improves code generation performance in AMICI**, + In: Pang, J., Niehren, J. (eds) Computational Methods in Systems Biology. + CMSB 2023. *Lecture Notes in Computer Science*, vol 14137. Springer, Cham. + DOI: `10.1007/978-3-031-42697-1_3 `_. + Preprint available at `bioRxiv `_. + +* Lakrisenko, Polina, Dilan Pathirana, Daniel Weindl, and Jan Hasenauer. 2024. + **Exploration of methods for computing sensitivities in ODE models at dynamic and steady states.** *arXiv:2405.16524 [q-bio.QM]*. + DOI: `10.48550/arXiv.2405.16524 `_. -* L. Contento, P. Stapor, D. Weindl, and J. Hasenauer, "A more expressive spline - representation for SBML models improves code generation performance in AMICI," - bioRxiv, 2023, DOI: `10.1101/2023.06.29.547120 `_. .. note:: From f54abe6534b6552acab647c63b09a5226c86cda1 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Wed, 26 Jun 2024 14:45:57 +0200 Subject: [PATCH 04/12] Add deprecation policy (#2465) Add deprecation policy As suggested in https://github.com/AMICI-dev/AMICI/issues/2458. --- CHANGELOG.md | 2 ++ documentation/index.rst | 1 + documentation/versioning_policy.rst | 28 ++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 documentation/versioning_policy.rst diff --git a/CHANGELOG.md b/CHANGELOG.md index b466d2d491..fcdc7a222a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +See also our [versioning policy](https://amici.readthedocs.io/en/latest/versioning_policy.html). + ## v0.X Series ### v0.25.2 (2024-06-16) diff --git a/documentation/index.rst b/documentation/index.rst index 73343e76c1..63fc3261ab 100644 --- a/documentation/index.rst +++ b/documentation/index.rst @@ -27,6 +27,7 @@ Welcome to AMICI's documentation! references background changelog + versioning_policy glossary contributing diff --git a/documentation/versioning_policy.rst b/documentation/versioning_policy.rst new file mode 100644 index 0000000000..bed419f02a --- /dev/null +++ b/documentation/versioning_policy.rst @@ -0,0 +1,28 @@ +.. _versioning_policy: + +Versioning policy +================= + +Versioning +---------- + +We use `Semantic Versioning `_ with the modifications +described under :ref:`deprecation_policy`. + +.. _deprecation_policy: + +Deprecation policy +------------------ + +AMICI aims to provide a stable API for users. However, not all features can be +maintained indefinitely. We will deprecate features in minor releases and +where possible, issue a warning when they are used. We will keep deprecated +features for at least six months after the release that includes the +respective deprecation warning and then remove them earliest in the next minor +or major release. If a deprecated feature is the source of a major bug, we may +remove it earlier. + +Python compatibility +-------------------- + +We follow `numpy's Python support policy `_. From 538fd59d2b230951720ab8f23994dc3259f17dfc Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Wed, 26 Jun 2024 15:07:19 +0200 Subject: [PATCH 05/12] Deprecate passing individual tables to `amici_import_petab` (#2464) Deprecated passing individual tables to `amici_import_petab` and replace deprecated `petab.Problem.from_files` in `amici.petab.cli.import_petab._main`. Fixes #2460 --- python/sdist/amici/petab/cli/import_petab.py | 69 +++++++++++++++---- .../test_benchmark_collection.sh | 19 ++++- 2 files changed, 72 insertions(+), 16 deletions(-) diff --git a/python/sdist/amici/petab/cli/import_petab.py b/python/sdist/amici/petab/cli/import_petab.py index 9f29d26e71..39fa9b9bfe 100644 --- a/python/sdist/amici/petab/cli/import_petab.py +++ b/python/sdist/amici/petab/cli/import_petab.py @@ -3,6 +3,7 @@ import petab from ..petab_import import import_model_sbml +from petab.models.sbml_model import SbmlModel def _parse_cli_args(): @@ -59,28 +60,33 @@ def _parse_cli_args(): ) # Call with set of files - parser.add_argument( + group = parser.add_argument_group( + "Providing individual PEtab tables *DEPRECATED*. " + "Pass a PEtab yaml file instead." + ) + + group.add_argument( "-s", "--sbml", dest="sbml_file_name", help="SBML model filename" ) - parser.add_argument( + group.add_argument( "-m", "--measurements", dest="measurement_file_name", help="Measurement table", ) - parser.add_argument( + group.add_argument( "-c", "--conditions", dest="condition_file_name", help="Conditions table", ) - parser.add_argument( + group.add_argument( "-p", "--parameters", dest="parameter_file_name", help="Parameter table", ) - parser.add_argument( + group.add_argument( "-b", "--observables", dest="observable_file_name", @@ -90,8 +96,15 @@ def _parse_cli_args(): parser.add_argument( "-y", "--yaml", + dest="yaml_file_name_deprecated", + help="PEtab YAML problem filename. *DEPRECATED* Pass the YAML file " + "as positional argument instead.", + ) + + parser.add_argument( dest="yaml_file_name", - help="PEtab YAML problem filename", + help="PEtab YAML problem filename.", + nargs="?", ) parser.add_argument( @@ -102,18 +115,42 @@ def _parse_cli_args(): ) args = parser.parse_args() - - if not args.yaml_file_name and not all( + if any( + [ + args.sbml_file_name, + args.condition_file_name, + args.observable_file_name, + args.measurement_file_name, + args.parameter_file_name, + ] + ): + print( + "WARNING: Passing individual tables to amico_import_petab is " + "deprecated, please pass a PEtab YAML file instead." + ) + if ( + not args.yaml_file_name and not args.yaml_file_name_deprecated + ) and not all( ( args.sbml_file_name, args.condition_file_name, args.observable_file_name, + args.measurement_file_name, + args.parameter_file_name, ) ): parser.error( "When not specifying a model name or YAML file, then " - "SBML, condition and observable file must be specified" + "SBML, condition, observable, measurement and parameter file must " + "be specified." + ) + + if args.yaml_file_name_deprecated: + print( + "WARNING: -y/--yaml is deprecated. Pass the YAML file as " + "positional argument instead." ) + args.yaml_file_name = args.yaml_file_name_deprecated return args @@ -128,12 +165,14 @@ def _main(): if args.yaml_file_name: pp = petab.Problem.from_yaml(args.yaml_file_name) else: - pp = petab.Problem.from_files( - sbml_file=args.sbml_file_name, - condition_file=args.condition_file_name, - measurement_file=args.measurement_file_name, - parameter_file=args.parameter_file_name, - observable_files=args.observable_file_name, + pp = petab.Problem( + model=SbmlModel.from_file(args.sbml_file_name), + condition_df=petab.get_condition_df(args.condition_file_name), + measurement_df=petab.get_measurement_df( + args.measurement_file_name + ), + parameter_df=petab.get_parameter_df(args.parameter_file_name), + observable_df=petab.get_observable_df(args.observable_file_name), ) # Check for valid PEtab before potentially modifying it diff --git a/tests/benchmark-models/test_benchmark_collection.sh b/tests/benchmark-models/test_benchmark_collection.sh index 6b9284f4e6..f8ccd0c1cd 100755 --- a/tests/benchmark-models/test_benchmark_collection.sh +++ b/tests/benchmark-models/test_benchmark_collection.sh @@ -89,7 +89,7 @@ for model in $models; do yaml="${model_dir}"/"${model}"/"${model}".yaml amici_model_dir=test_bmc/"${model}" mkdir -p "$amici_model_dir" - cmd_import="amici_import_petab -y ${yaml} -o ${amici_model_dir} -n ${model} --flatten" + cmd_import="amici_import_petab ${yaml} -o ${amici_model_dir} -n ${model} --flatten" cmd_run="$script_path/test_petab_model.py -y ${yaml} -d ${amici_model_dir} -m ${model} -c" printf '=%.0s' {1..40} @@ -111,3 +111,20 @@ for model in $models; do done cd "$script_path" && python evaluate_benchmark.py + +# Test deprecated import from individual PEtab files +model="Zheng_PNAS2012" +problem_dir="${model_dir}/${model}" +amici_model_dir=test_bmc/"${model}-deprecated" +cmd_import="amici_import_petab -s "${problem_dir}/model_${model}.xml" \ + -m "${problem_dir}/measurementData_${model}.tsv" \ + -c "${problem_dir}/experimentalCondition_${model}.tsv" \ + -p "${problem_dir}/parameters_${model}.tsv" \ + -b "${problem_dir}/observables_${model}.tsv" \ + -o ${amici_model_dir} -n ${model} --no-compile" + +if [[ -z "$dry_run" ]]; then + $cmd_import +else + echo "$cmd_import" +fi From 3cfb8e724f15be955e7028ac4db856173c4631bd Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Wed, 26 Jun 2024 15:18:48 +0200 Subject: [PATCH 06/12] GHA: sympy>=1.12.1 --- .github/workflows/test_python_ver_matrix.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test_python_ver_matrix.yml b/.github/workflows/test_python_ver_matrix.yml index 01d455b18a..da2669b866 100644 --- a/.github/workflows/test_python_ver_matrix.yml +++ b/.github/workflows/test_python_ver_matrix.yml @@ -57,6 +57,9 @@ jobs: - run: source venv/bin/activate && pip3 install git+https://github.com/sympy/sympy.git@master if: matrix.python-version == '3.12' + - run: source venv/bin/activate && pip3 install "sympy>=1.12.1" + if: matrix.python-version != '3.12' + - name: Python tests run: | source venv/bin/activate \ From e1ab9fb1f54a02bad56326fafbe556eddae8797d Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Wed, 26 Jun 2024 17:20:53 +0200 Subject: [PATCH 07/12] Doc: fix formatting (#2470) --- documentation/python_installation.rst | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/documentation/python_installation.rst b/documentation/python_installation.rst index eb7d499227..3c893bcd61 100644 --- a/documentation/python_installation.rst +++ b/documentation/python_installation.rst @@ -31,8 +31,8 @@ If this does not work for you, please follow the full instructions below. Installation on Linux +++++++++++++++++++++ -Ubuntu 22.04 ------------- +Ubuntu 22.04 / 24.04 +-------------------- Install the AMICI dependencies via ``apt`` (this requires superuser privileges): @@ -44,8 +44,8 @@ Install the AMICI dependencies via ``apt`` # optionally for HDF5 support: sudo apt install libhdf5-serial-dev - # optionally for boost support (thread-specific CPU times, extended math functions, serialization) - libboost-chrono-dev libboost-math-dev libboost-serialization-dev + # optionally for boost support (thread-specific CPU times, extended math functions, serialization) + libboost-chrono-dev libboost-math-dev libboost-serialization-dev Install AMICI: @@ -203,9 +203,8 @@ Newer installations could be located under so that it matches your directory structure. This will download OpenBLAS and compile it, creating - - C:\\BLAS\\OpenBLAS\\lib\\openblas.lib - C:\\BLAS\\OpenBLAS\\bin\\openblas.dll +``C:\\BLAS\\OpenBLAS\\lib\\openblas.lib`` and +``C:\\BLAS\\OpenBLAS\\bin\\openblas.dll``. You will also need to define two environment variables: @@ -231,8 +230,8 @@ Now you need to make sure that all required DLLs are within the scope of the ``PATH`` variable. In particular, the following directories need to be included in ``PATH``: - C:\\BLAS\\OpenBLAS\\bin - C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\ucrt\\DLLs\\x64 +* ``C:\BLAS\OpenBLAS\bin`` +* ``C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64`` The first one is needed for ``openblas.dll`` and the second is needed for the Windows Universal C Runtime. @@ -240,7 +239,7 @@ Windows Universal C Runtime. If any DLLs are missing in the ``PATH`` variable, Python will return the following error upon ``import amici``: - ImportError: DLL load failed: The specified module could not be found. +``ImportError: DLL load failed: The specified module could not be found.`` Almost all of the DLLs are standard Windows DLLs and should be included in either Windows or Visual Studio. But, in case it is necessary to test this, From f8ce650154815899faa7e332b8a61f9fab2e7de0 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Thu, 27 Jun 2024 13:11:14 +0200 Subject: [PATCH 08/12] CMake: Set SUNDIALS_ROOT (#2468) Set SUNDIALS_ROOT to ensure we are finding the sundials CMake config from the vendored library and not any other installation. Fixes #2467. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b0c95321b..9b0374b3a9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -142,9 +142,9 @@ else() set(VENDORED_SUNDIALS_BUILD_DIR ${VENDORED_SUNDIALS_DIR}/build) set(VENDORED_SUNDIALS_INSTALL_DIR ${VENDORED_SUNDIALS_BUILD_DIR}) endif() +set(SUNDIALS_ROOT "${VENDORED_SUNDIALS_INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}") find_package( - SUNDIALS REQUIRED PATHS - "${VENDORED_SUNDIALS_INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/sundials/") + SUNDIALS REQUIRED CONFIG PATHS "${SUNDIALS_ROOT}/cmake/sundials/") message(STATUS "Found SUNDIALS: ${SUNDIALS_DIR}") set(GSL_LITE_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/gsl") From 65a113848cc17a0115d1f42f39abb0c9761d0e6b Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Mon, 1 Jul 2024 11:17:49 +0200 Subject: [PATCH 09/12] Update reference list (#2472) * Update reference list * BaltussenJon2024 * issue link * .. --- documentation/amici_refs.bib | 50 ++++++++++++++++++------ documentation/recreate_reference_list.py | 5 ++- documentation/references.md | 18 ++++++++- 3 files changed, 58 insertions(+), 15 deletions(-) diff --git a/documentation/amici_refs.bib b/documentation/amici_refs.bib index b14d0e18b0..7321d97194 100644 --- a/documentation/amici_refs.bib +++ b/documentation/amici_refs.bib @@ -1069,18 +1069,19 @@ @Article{LakrisenkoSta2023 } @Article{ContentoCas2023, - author = {Lorenzo Contento and Noemi Castelletti and Elba Raimúndez and Ronan {Le Gleut} and Yannik Schälte and Paul Stapor and Ludwig Christian Hinske and Michael Hoelscher and Andreas Wieser and Katja Radon and Christiane Fuchs and Jan Hasenauer}, - journal = {Epidemics}, - title = {Integrative modelling of reported case numbers and seroprevalence reveals time-dependent test efficiency and infectious contacts}, - year = {2023}, - issn = {1755-4365}, - pages = {100681}, - volume = {43}, - abstract = {Mathematical models have been widely used during the ongoing SARS-CoV-2 pandemic for data interpretation, forecasting, and policy making. However, most models are based on officially reported case numbers, which depend on test availability and test strategies. The time dependence of these factors renders interpretation difficult and might even result in estimation biases. Here, we present a computational modelling framework that allows for the integration of reported case numbers with seroprevalence estimates obtained from representative population cohorts. To account for the time dependence of infection and testing rates, we embed flexible splines in an epidemiological model. The parameters of these splines are estimated, along with the other parameters, from the available data using a Bayesian approach. The application of this approach to the official case numbers reported for Munich (Germany) and the seroprevalence reported by the prospective COVID-19 Cohort Munich (KoCo19) provides first estimates for the time dependence of the under-reporting factor. Furthermore, we estimate how the effectiveness of non-pharmaceutical interventions and of the testing strategy evolves over time. Overall, our results show that the integration of temporally highly resolved and representative data is beneficial for accurate epidemiological analyses.}, - creationdate = {2023-04-15T07:59:57}, - doi = {10.1016/j.epidem.2023.100681}, - keywords = {Compartmental model, Parameter estimation, Uncertainty quantification, COVID-19}, - url = {https://www.sciencedirect.com/science/article/pii/S1755436523000178}, + author = {Lorenzo Contento and Noemi Castelletti and Elba Raimúndez and Ronan {Le Gleut} and Yannik Schälte and Paul Stapor and Ludwig Christian Hinske and Michael Hoelscher and Andreas Wieser and Katja Radon and Christiane Fuchs and Jan Hasenauer}, + journal = {Epidemics}, + title = {Integrative modelling of reported case numbers and seroprevalence reveals time-dependent test efficiency and infectious contacts}, + year = {2023}, + issn = {1755-4365}, + pages = {100681}, + volume = {43}, + abstract = {Mathematical models have been widely used during the ongoing SARS-CoV-2 pandemic for data interpretation, forecasting, and policy making. However, most models are based on officially reported case numbers, which depend on test availability and test strategies. The time dependence of these factors renders interpretation difficult and might even result in estimation biases. Here, we present a computational modelling framework that allows for the integration of reported case numbers with seroprevalence estimates obtained from representative population cohorts. To account for the time dependence of infection and testing rates, we embed flexible splines in an epidemiological model. The parameters of these splines are estimated, along with the other parameters, from the available data using a Bayesian approach. The application of this approach to the official case numbers reported for Munich (Germany) and the seroprevalence reported by the prospective COVID-19 Cohort Munich (KoCo19) provides first estimates for the time dependence of the under-reporting factor. Furthermore, we estimate how the effectiveness of non-pharmaceutical interventions and of the testing strategy evolves over time. Overall, our results show that the integration of temporally highly resolved and representative data is beneficial for accurate epidemiological analyses.}, + creationdate = {2023-04-15T07:59:57}, + doi = {10.1016/j.epidem.2023.100681}, + keywords = {Compartmental model, Parameter estimation, Uncertainty quantification, COVID-19}, + modificationdate = {2024-06-28T08:27:57}, + url = {https://www.sciencedirect.com/science/article/pii/S1755436523000178}, } @Article{FroehlichGer2023, @@ -1332,6 +1333,31 @@ @PhdThesis{Mutsuddy2024 url = {https://tigerprints.clemson.edu/all_dissertations/3572}, } +@Misc{PhilippsKoe2024, + author = {Maren Philipps and Antonia Körner and Jakob Vanhoefer and Dilan Pathirana and Jan Hasenauer}, + title = {Non-Negative Universal Differential Equations With Applications in Systems Biology}, + year = {2024}, + archiveprefix = {arXiv}, + creationdate = {2024-06-28T08:27:59}, + eprint = {2406.14246}, + modificationdate = {2024-06-28T08:27:59}, + primaryclass = {q-bio.QM}, + url = {https://arxiv.org/abs/2406.14246}, +} + +@Article{BaltussenJon2024, + author = {Baltussen, Mathieu G. and de Jong, Thijs J. and Duez, Quentin and Robinson, William E. and Huck, Wilhelm T. S.}, + journal = {Nature}, + title = {Chemical reservoir computation in a self-organizing reaction network}, + year = {2024}, + issn = {1476-4687}, + month = jun, + creationdate = {2024-06-29T14:03:08}, + doi = {10.1038/s41586-024-07567-x}, + modificationdate = {2024-06-29T14:03:08}, + publisher = {Springer Science and Business Media LLC}, +} + @Comment{jabref-meta: databaseType:bibtex;} @Comment{jabref-meta: grouping: diff --git a/documentation/recreate_reference_list.py b/documentation/recreate_reference_list.py index 7750173ce1..a188f1daa0 100755 --- a/documentation/recreate_reference_list.py +++ b/documentation/recreate_reference_list.py @@ -75,7 +75,10 @@ def main(): ) f.write( "If you applied AMICI in your work and your publication is " - "missing, please let us know via a new GitHub issue.\n\n" + "missing, please let us know via a new\n" + "[GitHub issue](https://github.com/AMICI-dev/AMICI/issues/new" + "?labels=documentation&title=Add+publication" + "&body=AMICI+was+used+in+this+manuscript:+DOI).\n\n" ) f.write( """ diff --git a/documentation/references.md b/documentation/references.md index f17da06c55..cd103843fa 100644 --- a/documentation/references.md +++ b/documentation/references.md @@ -1,8 +1,9 @@ # References -List of publications using AMICI. Total number is 87. +List of publications using AMICI. Total number is 89. -If you applied AMICI in your work and your publication is missing, please let us know via a new GitHub issue. +If you applied AMICI in your work and your publication is missing, please let us know via a new +[GitHub issue](https://github.com/AMICI-dev/AMICI/issues/new?labels=documentation&title=Add+publication&body=AMICI+was+used+in+this+manuscript:+DOI).