PEtab icon indicating copy to clipboard operation
PEtab copied to clipboard

Add support for non-SBML models

Open dweindl opened this issue 5 years ago • 6 comments
trafficstars

Would be great if PEtab would be usable with non-SBML models. Formats to consider would include e.g. cellML, bngl, pysb, .... Personally interested in pysb support.

Will be a significant implementation effort, but probably worth it. Need to abstract from model implementation. For preparation, all libsbml.Model instances should be replaced by new class Model, abstract base class. Concrete implementations would be SbmlModel, PysbModel, ...

This does not imply any changes in file formats (yet). For the next format update, it would be good to already think about how to handle that e.g. in yaml files. Allow for sbml_model_file, xx_model_file, ... or add model_type?

Anybody interested in joining in for that?

dweindl avatar May 10 '20 11:05 dweindl

Some notes from discussion with @FFroehlich about enabling use of PySB models:

PEtab problem definition:

  • Tables can be used as is, with minor limitations:
    • PySB models don't have meaningful species IDs and species names are a bit of a pain to be used as identifiers in any formulas. Therefore, observables and complex noise models would not be directly specified in observableFormula and noiseFormula in the measurement table, but one would reference pysb.Expression IDs there.
    • For the same reason, setting initial concentrations in the conditions table is problematic. This would be handled by having parameterized pysb.Initials.
  • [ ] YAML file entry sbml_files needs to be generalized or an additional field needs to be added. (Would one want to allow combining models of different formats?)

PEtab library:

  • Add model abstraction layer
    • [ ] Create class Model base class
    • [ ] Gather all SBML-specific code in class SbmlModel
    • [ ] Create class PysbModel

Misc:

  • [ ] Would be good to have a copy of the current PEtab test suite with PySB model instead of SBML model

dweindl avatar Jul 28 '20 18:07 dweindl

I had the problem that my model was specified in BNGL and I wanted to create a PEtab problem from it to test several optimizers. SBML export from BNGL worked well, but PEtab did not support many of the characters used in the SBML export, so I wrote a script to remove them.

From my perspective the main advantage of rule-based modelling languages is the higher level of abstraction in model formulation. I think it would be good if PEtab for rule-based modelling languages would support the same level of abstraction, i.e. use patterns rather than species (except that a pattern may uniquely specify a species). In particular, this would be the case for initial concentrations in the conditions table and observableFormula and noiseFormula in the observable table (probably the whole observable table could become optional for rule-based models, as they allow explicit observable specification anyway, which is in contrast to SBML as far as I know; a reasonable default could be chosen for the noiseFormula).

For optimisation toolboxes that only work with SBML, one could provide a petab.Problem.to_sbml method that relies on the export functionality of BNGL/PySB. Sure, some auto-converted SBML species names and observableFormulas would be ugly, but (a) I see no need to write the auto-converted PEtab problem to files (other than for debugging purposes) and (b) even if they are inspected by humans, I could not think of a more systematic and concise way to represent the combinatorial complexity arising from rule-based models (I guess the developers of rule-based languages have spent a lot of thought on that).

Like I said above, I would benefit from BNGL or PySB support myself and would be happy to contribute as far as my abilities allow.

paulflang avatar Feb 07 '21 00:02 paulflang

Thanks for sharing your views @paulflang.

Agreed, that it would be convenient to allow for patterns in observable/noise formulas and species in the condition table. Might be a bit of a pain to parse, but should be feasible.

For optimisation toolboxes that only work with SBML, one could provide a petab.Problem.to_sbml method that relies on the export functionality of BNGL/PySB.

Sounds useful.

dweindl avatar Feb 08 '21 10:02 dweindl

Hey, I'm one of the PySB developers, this sounds like something that would be useful. Happy to support this from the PySB side, if anything needs adding there.

Re: Species IDs, you're correct @dweindl that species aren't canonically named in PySB, since they're generated at runtime via network generation. However, observables are named in a PySB model, so one option would be to refer to observables directly. Likewise for initial conditions, which typically refer to a named parameter (or a constant expression, which are also named).

alubbock avatar Mar 04 '21 06:03 alubbock

Hi @alubbock, great to hear that. I had some further discussion with @FFroehlich and I think we have a rough plan. We'll post an update here soon. It would be mostly what you suggested, i.e., having initials and observables defined in the PySB model and only referencing those in the other PEtab files.

dweindl avatar Mar 04 '21 19:03 dweindl

It took significantly longer than expected, but we finally posted a proposal to allow for different model formats in PEtab -> https://github.com/PEtab-dev/PEtab/pull/538

dweindl avatar Mar 18 '22 14:03 dweindl