vivarium-collective / vivarium-biosimulators

A Vivarium wrapper for BioSimulators
1 stars 0 forks source link

import biosimulator module in the init #7

Closed eagmon closed 3 years ago

eagmon commented 3 years ago

This changes the BiosimulatorsProcess to dynamically load a BioSimulators module in the init. This will allow the same process to implement any of the fully-standardized BioSimulators. The process needs the BioSimulators id, for example 'biosimulators_tellurium':

    config = {
        'biosimulator_id': 'biosimulators_tellurium',
        'sbml_path': 'vivarium_biosimulators/models/BIOMD0000000297_url.xml',
    }
    process = BiosimulatorsProcess(config)

Currently, this only supports BioSimulators already installed in the python environment. In the future we will need to move away from this, and make better use of Docker images for the individual BioSimulators.

TODO:

jonrkarr commented 3 years ago

The BioSimulators ids are tellurium, copasi, etc.

The Python modules are generally biosimulators_* to differentiate them from the modules for the underlying simulation tools. There are some exceptions where the developers organized their BioSimulators API elsewhere (e.g., smoldyn.biosimulators).

The appropriate Python modules can be looked up at https://api.biosimulators.org/simulators/tellurium/2.2.0. The Python modules are encoded as pythonApi.module.

eagmon commented 3 years ago

Update on this PR: I added a test that iterates over the list BIOSIMULATOR_IDS and attempts to load each into the BioscrapeProcess. So far the simulators with checks are passing:

The failing simulators fails for different reasons:

cobrapy:

ValueError: UniformTimeCourseSimulation `simulation` is not supported.
- Simulation simulation of type `UniformTimeCourseSimulation` is not supported. Simulation must be an instance of one of the following:
      - SteadyStateSimulation

bionetgen:

ValueError: Language for model `model` is not supported.
  - Model language `urn:sedml:language:sbml` is not supported. Models must be in BNGL format (e.g., `sed:model/@language` must match `^urn:sedml:language:bngl(\.|$)` such as `urn:sedml:language:bngl`)

libsbmlsim:

File "/Users/eranagmon/.pyenv/versions/v-tellurium/lib/python3.9/site-packages/biosimulators_libsbmlsim/data_model.py", line 11, in <module>
    import libsbmlsim
ModuleNotFoundError: No module named 'libsbmlsim'

rbapy:

File "/Users/eranagmon/.pyenv/versions/v-tellurium/lib/python3.9/site-packages/biosimulators_utils/model_lang/rba/validation.py", line 10, in <module>
    import rba
ModuleNotFoundError: No module named 'rba'

xpp:

ValueError: Language for model `model` is not supported.
  - Model language `urn:sedml:language:sbml` is not supported. Models must be in XPP format (e.g., `sed:model/@language` must match `^urn:sedml:language:xpp(\.|$)` such as `urn:sedml:language:xpp`).
jonrkarr commented 3 years ago

COBRApy executes steady state simulations. BioNetGen executes BNGL files, RBApy executes RBA files, and XPP executes ODE files. All except COBRApy require non-pypi dependencies. See the installation instructions or use the Docker image.

jonrkarr commented 3 years ago

To do this, you will need to use the simulator specs to discern their capabilities. You will also need an equally broad set of example models. Our package for reasoning over KiSAO may also be helpful.

eagmon commented 3 years ago

Thanks @jonrkarr -- I'm temporarily delaying using the Docker image just as we get this process up and running. I'll check out the installation instructions and will retest later today.