PEtab-dev / libpetab-python

Python package for working with PEtab files
https://libpetab-python.readthedocs.io
MIT License
14 stars 5 forks source link

composite problem #265

Open MA-Kochen opened 1 month ago

MA-Kochen commented 1 month ago

Using the composite problem method returns the following error:

AttributeError: 'CompositeProblem' object has no attribute 'extensions_config'

Suggestions?

dilpath commented 1 month ago

Hi @MA-Kochen

I'm not too sure about your setup, could you describe your composite problem in a few sentences, and provide the PEtab problem if possible? I could then try to reproduce the error or suggest alternatives. Which tool(s) do you intend to work with for simulation/parameter estimation?

MA-Kochen commented 1 month ago

I have two SBML models (different experiments) with associated data and I'm trying to find a common set of parameters. Each model has multiple sub-experiments which I've defined in the relevant tsv files. I'm using the develop branch of PyPesto with the new roadrunner implementation.

Note that I've since redefined the problem as a single PeTab problem (combining the two and using a more extensive experimental conditions file). This seems to have side stepped the issue.

Setup looks like this:

petab_yaml1 = './egfr/egfr1.yaml'
petab_yaml2 = './egfr/egfr2.yaml'

petab_problem1 = petab.Problem.from_yaml(petab_yaml1)
petab_problem2 = petab.Problem.from_yaml(petab_yaml2)
petab_problem = petab.CompositeProblem(problems=[petab_problem1, petab_problem2])

importer = pypesto_rr.PetabImporterRR(petab_problem)

The full Traceback is

Traceback (most recent call last):
  File "/home/michael/PycharmProjects/pyPESTO/doc/example/EGFR.py", line 20, in <module>
    importer = pypesto_rr.PetabImporterRR(petab_problem)
  File "/home/michael/PycharmProjects/pyPESTO/pypesto/objective/roadrunner/petab_importer_roadrunner.py", line 62, in __init__
    if petab.lint_problem(petab_problem):
  File "/home/michael/anaconda3/envs/pypestorr/lib/python3.10/site-packages/petab/lint.py", line 870, in lint_problem
    if problem.extensions_config:
AttributeError: 'CompositeProblem' object has no attribute 'extensions_config'
MA-Kochen commented 1 month ago

One of the YAML files:

format_version: 1
parameter_file: parameters.tsv
problems:
  - condition_files:
    - experimental_conditions_a.tsv
    measurement_files:
    - measurement_data_a.tsv
    observable_files:
    - observables_a.tsv
    sbml_files:
    - EGFR_8a.xml
dilpath commented 1 month ago

Thanks for sharing. I think your current fix is the way to go. Your use case of combining multiple PEtab problems looks uncommon to me, and there is probably little tool support available for it. One approach could be to use the AggregatedObjective in pyPESTO, but this probably requires some implementation effort.

A minor point: you may be able to combine your two conditions files simply by listing them both in the YAML file -- maybe that helps if you are trying to keep the two parts as separate as possible. As long as the condition IDs remain unique across both files, it should be fine. If you try this and want further advice, I would ask for the full set of PEtab files, or a minimal working example (via email is also fine).