Skip to content

Commit 107f90f

Browse files
authored
PEtab v2 import (#2974)
Experimental import of SBML- and PySB-based PEtab v2 problems. Not particularly performant or feature-complete yet - to be extended. Closes #2662.
1 parent 7f15329 commit 107f90f

File tree

19 files changed

+3708
-67
lines changed

19 files changed

+3708
-67
lines changed

.github/workflows/test_benchmark_collection_models.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
run: |
5555
python3 -m pip uninstall -y petab && python3 -m pip install git+https://github.com/petab-dev/libpetab-python.git@main \
5656
&& python3 -m pip install -U sympy \
57-
&& python3 -m pip install git+https://github.com/ICB-DCM/fiddy.git@amici100
57+
&& python3 -m pip install git+https://github.com/ICB-DCM/fiddy.git@main
5858
5959
- name: Download benchmark collection
6060
run: |

.github/workflows/test_petab_test_suite.yml

Lines changed: 96 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
workflow_dispatch:
1212

1313
jobs:
14-
build:
14+
petab_v1:
1515
name: PEtab Testsuite
1616

1717
runs-on: ubuntu-latest
@@ -87,7 +87,7 @@ jobs:
8787
run: |
8888
source ./venv/bin/activate \
8989
&& python3 -m pip uninstall -y petab \
90-
&& python3 -m pip install git+https://github.com/petab-dev/libpetab-python.git@main \
90+
&& python3 -m pip install git+https://github.com/petab-dev/libpetab-python.git@8dc6c1c4b801fba5acc35fcd25308a659d01050e \
9191
&& python3 -m pip install git+https://github.com/pysb/pysb@master \
9292
&& python3 -m pip install sympy>=1.12.1
9393
@@ -102,11 +102,103 @@ jobs:
102102
- name: Run PEtab test suite
103103
run: |
104104
source ./venv/bin/activate \
105-
&& AMICI_PARALLEL_COMPILE="" pytest -v \
105+
&& AMICI_PARALLEL_COMPILE="" pytest -rxXs -v \
106106
--cov-report=xml:coverage.xml \
107107
--cov-append \
108108
--cov=amici \
109-
tests/petab_test_suite/
109+
tests/petab_test_suite/test_petab_suite.py
110+
111+
- name: Codecov
112+
if: github.event_name == 'pull_request' || github.repository_owner == 'AMICI-dev'
113+
uses: codecov/codecov-action@v5
114+
with:
115+
token: ${{ secrets.CODECOV_TOKEN }}
116+
files: coverage.xml
117+
flags: petab
118+
fail_ci_if_error: true
119+
120+
121+
petab_v2:
122+
name: PEtab v2 Testsuite
123+
124+
runs-on: ubuntu-latest
125+
126+
env:
127+
ENABLE_GCOV_COVERAGE: TRUE
128+
129+
strategy:
130+
matrix:
131+
python-version: ["3.12"]
132+
133+
steps:
134+
- name: Set up Python ${{ matrix.python-version }}
135+
uses: actions/setup-python@v5
136+
with:
137+
python-version: ${{ matrix.python-version }}
138+
139+
- uses: actions/checkout@v4
140+
with:
141+
fetch-depth: 20
142+
143+
- name: Install apt dependencies
144+
uses: ./.github/actions/install-apt-dependencies
145+
146+
# install dependencies
147+
- name: apt
148+
run: |
149+
sudo apt-get update \
150+
&& sudo apt-get install -y python3-venv
151+
152+
- name: Build BNGL
153+
run: scripts/buildBNGL.sh
154+
155+
- run: |
156+
echo "${HOME}/.local/bin/" >> $GITHUB_PATH
157+
echo "${GITHUB_WORKSPACE}/tests/performance/" >> $GITHUB_PATH
158+
echo "BNGPATH=${GITHUB_WORKSPACE}/ThirdParty/BioNetGen-2.7.0" >> $GITHUB_ENV
159+
160+
# install AMICI
161+
- name: Install python package
162+
run: scripts/installAmiciSource.sh
163+
164+
- name: Install petab
165+
run: |
166+
source ./venv/bin/activate \
167+
&& pip3 install wheel pytest shyaml pytest-cov pysb>=1.16
168+
169+
# retrieve test models
170+
- name: Download and install PEtab test suite
171+
run: |
172+
git clone https://github.com/PEtab-dev/petab_test_suite \
173+
&& source ./venv/bin/activate \
174+
&& cd petab_test_suite \
175+
&& git checkout c12b9dc4e4c5585b1b83a1d6e89fd22447c46d03 \
176+
&& pip3 install -e .
177+
178+
# TODO: once there is a PEtab v2 benchmark collection
179+
# - name: Install PEtab benchmark collection
180+
# run: |
181+
# git clone --depth 1 https://github.com/benchmarking-initiative/Benchmark-Models-PEtab.git \
182+
# && export BENCHMARK_COLLECTION="$(pwd)/Benchmark-Models-PEtab/Benchmark-Models/" \
183+
# && source venv/bin/activate && python -m pip install -e $BENCHMARK_COLLECTION/../src/python
184+
185+
- name: Install petab
186+
run: |
187+
source ./venv/bin/activate \
188+
&& python3 -m pip uninstall -y petab \
189+
&& python3 -m pip install git+https://github.com/petab-dev/libpetab-python.git@8dc6c1c4b801fba5acc35fcd25308a659d01050e \
190+
&& python3 -m pip install git+https://github.com/pysb/pysb@master \
191+
&& python3 -m pip install sympy>=1.12.1
192+
193+
# run test models
194+
- name: Run PEtab test suite
195+
run: |
196+
source ./venv/bin/activate \
197+
&& AMICI_PARALLEL_COMPILE="" pytest -rxXs -v \
198+
--cov-report=xml:coverage.xml \
199+
--cov-append \
200+
--cov=amici \
201+
tests/petab_test_suite/test_petab_v2_suite.py
110202
111203
- name: Codecov
112204
if: (github.event_name == 'pull_request' || github.repository_owner == 'AMICI-dev') && github.actor != 'dependabot[bot]'

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,6 @@ tests/sbml/sbml-test-suite/
141141
*/sbml-semantic-test-cases/*
142142
tests/sbml/SBMLTestModels/
143143
tests/benchmark_models/test_bmc
144-
tests/petab_test_suite
145-
petab_test_suite
146144
*/tests/BIOMD0000000529/*
147145

148146
python/examples/example_steadystate/model_steadystate_scaled/*
@@ -200,3 +198,4 @@ tests/benchmark_models/cache_fiddy/*
200198
venv/*
201199
.coverage
202200
tests/sciml/models/*
201+
amici_models

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ See also our [versioning policy](https://amici.readthedocs.io/en/latest/versioni
5151

5252
**Features**
5353

54+
* Experimental support for the PEtab data format v2.0.0 (draft, see
55+
https://petab.readthedocs.io/en/latest/v2/documentation_data_format.html)
56+
for SBML- and PySB-based problems (see `amici.petab.petab_importer`). The API is subject to change.
57+
58+
* Current limitations for PySB-based PEtab problems:
59+
* Only species and `pysb.Expression` are supported as condition table
60+
targets.
61+
5462
* Many relevant `ReturnData` fields are now available as `xarray.DataArray`
5563
via `ReturnData.xr.{x,y,w,x0,sx,...}`.
5664
`DataArray`s include the identifiers and are often more convenient than the
@@ -83,6 +91,7 @@ See also our [versioning policy](https://amici.readthedocs.io/en/latest/versioni
8391
can now be specified via the `AMICI_MODELS_ROOT` environment variable.
8492
See `amici.get_model_dir` for details.
8593

94+
8695
## v0.X Series
8796

8897
### v0.34.2 (2025-11-03)

0 commit comments

Comments
 (0)