diff --git a/doc/examples/example_large_models/example_performance_optimization.ipynb b/doc/examples/example_large_models/example_performance_optimization.ipynb index 89c7552d83..5d578e9d77 100644 --- a/doc/examples/example_large_models/example_performance_optimization.ipynb +++ b/doc/examples/example_large_models/example_performance_optimization.ipynb @@ -85,9 +85,9 @@ "Example:\n", "```bash\n", "petab_yaml=\"https://raw.githubusercontent.com/Benchmarking-Initiative/Benchmark-Models-PEtab/master/Benchmark-Models/Froehlich_CellSystems2018/Froehlich_CellSystems2018.yaml\"\n", - "/usr/bin/time -v amici_import_petab -y \"$petab_yaml\" --no-compile\n", + "/usr/bin/time -v amici_import_petab \"$petab_yaml\" --no-compile\n", "# vs.\n", - "/usr/bin/time -v amici_import_petab -y \"$petab_yaml\" --no-compile --no-sensitivities\n", + "/usr/bin/time -v amici_import_petab \"$petab_yaml\" --no-compile --no-sensitivities\n", "```" ] }, diff --git a/python/sdist/amici/petab/cli/import_petab.py b/python/sdist/amici/petab/cli/import_petab.py index d61cda5362..102a63e6ca 100644 --- a/python/sdist/amici/petab/cli/import_petab.py +++ b/python/sdist/amici/petab/cli/import_petab.py @@ -3,7 +3,6 @@ import petab.v1 as petab from ..petab_import import import_model_sbml -from petab.v1.models.sbml_model import SbmlModel def _parse_cli_args(): @@ -59,48 +58,6 @@ def _parse_cli_args(): help="Skip generation of sensitivity code", ) - # Call with set of files - 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" - ) - group.add_argument( - "-m", - "--measurements", - dest="measurement_file_name", - help="Measurement table", - ) - group.add_argument( - "-c", - "--conditions", - dest="condition_file_name", - help="Conditions table", - ) - group.add_argument( - "-p", - "--parameters", - dest="parameter_file_name", - help="Parameter table", - ) - group.add_argument( - "-b", - "--observables", - dest="observable_file_name", - help="Observable table", - ) - - 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.", @@ -115,42 +72,8 @@ def _parse_cli_args(): ) args = parser.parse_args() - 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, 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 + if not args.yaml_file_name: + parser.error("Missing PEtab yaml file.") return args @@ -162,18 +85,7 @@ def _main(): """ args = _parse_cli_args() - if args.yaml_file_name: - pp = petab.Problem.from_yaml(args.yaml_file_name) - else: - 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), - ) + pp = petab.Problem.from_yaml(args.yaml_file_name) # Check for valid PEtab before potentially modifying it if args.validate: diff --git a/python/sdist/amici/petab/sbml_import.py b/python/sdist/amici/petab/sbml_import.py index 9f5345d082..5b8354666a 100644 --- a/python/sdist/amici/petab/sbml_import.py +++ b/python/sdist/amici/petab/sbml_import.py @@ -6,7 +6,6 @@ import tempfile from itertools import chain from pathlib import Path -from typing import Union import amici import libsbml @@ -215,7 +214,6 @@ def _workaround_observable_parameters( @log_execution_time("Importing PEtab model", logger) def import_model_sbml( - sbml_model: Union[str, Path, "libsbml.Model"] = None, petab_problem: petab.Problem = None, model_name: str | None = None, model_output_dir: str | Path | None = None, @@ -231,10 +229,6 @@ def import_model_sbml( """ Create AMICI model from PEtab problem - :param sbml_model: - PEtab SBML model or SBML file name. - Deprecated, pass ``petab_problem`` instead. - :param petab_problem: PEtab problem. @@ -302,12 +296,10 @@ def import_model_sbml( # Model name from SBML ID or filename if model_name is None: if not (model_name := petab_problem.model.sbml_model.getId()): - if not isinstance(sbml_model, str | Path): - raise ValueError( - "No `model_name` was provided and no model " - "ID was specified in the SBML model." - ) - model_name = os.path.splitext(os.path.split(sbml_model)[-1])[0] + raise ValueError( + "No `model_name` was provided and no model " + "ID was specified in the SBML model." + ) if model_output_dir is None: model_output_dir = os.path.join(