Skip to content

Commit 21fd705

Browse files
committed
Convert to PEtab v2
1 parent 4f37eea commit 21fd705

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

v1_v2.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env python3
2+
"""Convert benchmark problems from PEtab v1 to v2 format."""
3+
4+
import logging
5+
import benchmark_models_petab
6+
from petab.v2.petab1to2 import petab1to2
7+
from pathlib import Path
8+
9+
def main():
10+
logging.basicConfig(level=logging.INFO)
11+
v2_root = Path(__file__).resolve().parent / "v2"
12+
13+
for problem_id in benchmark_models_petab.MODELS:
14+
convert(problem_id, output_dir=v2_root / problem_id)
15+
16+
def convert(problem_id: str, output_dir: Path):
17+
"""Convert a PEtab v1 problem to v2 format."""
18+
logging.info(f"Converting {problem_id}...")
19+
yaml_path = benchmark_models_petab.get_problem_yaml_path(problem_id)
20+
try:
21+
petab1to2(yaml_path, output_dir)
22+
except NotImplementedError as e:
23+
logging.warning(f"Skipping {problem_id}: {e}")
24+
return
25+
26+
logging.info(f"Converted {problem_id}.")
27+
28+
29+
if __name__ == "__main__":
30+
main()

0 commit comments

Comments
 (0)