sbmlsim.combine.sedml.parser
¶
SED-ML support for sbmlsim.
This modules parses SED-ML based simulation experiments in the sbmlsim SimulationExperiment format and executes them.
Overview SED-ML¶
SED-ML is build of the main classes - DataDescription - Model - Simulation - Task - DataGenerator - Output
DataDescription¶
The DataDescription allows to reference external data, and contains a description on how to access the data, in what format it is, and what subset of data to extract.
Model¶
The Model class is used to reference the models used in the simulation experiment. SED-ML itself is independent of the model encoding underlying the models. The only requirement is that the model needs to be referenced by using an unambiguous identifier which allows for finding it, for example using a MIRIAM URI. To specify the language in which the model is encoded, a set of predefined language URNs is provided. The SED-ML Change class allows the application of changes to the referenced models, including changes on the XML attributes, e.g. changing the value of an observable, computing the change of a value using mathematics, or general changes on any XML element of the model representation that is addressable by XPath expressions, e.g. substituting a piece of XML by an updated one.
Simulation¶
The Simulation class defines the simulation settings and the steps taken during simulation. These include the particular type of simulation and the algorithm used for the execution of the simulation; preferably an unambiguous reference to such an algorithm should be given, using a controlled vocabulary, or ontologies. One example for an ontology of simulation algorithms is the Kinetic Simulation Algorithm Ontology KiSAO. Further information encodable in the Simulation class includes the step size, simulation duration, and other simulation-type dependent information.
Task¶
SED-ML makes use of the notion of a Task class to combine a defined model (from the Model class) and a defined simulation setting (from the Simulation class). A task always holds one reference each. To refer to a specific model and to a specific simulation, the corresponding IDs are used.
DataGenerator¶
The raw simulation result sometimes does not correspond to the desired output of the simulation, e.g. one might want to normalise a plot before output, or apply post-processing like mean-value calculation. The DataGenerator class allows for the encoding of such post-processings which need to be applied to the simulation result before output. To define data generators, any addressable variable or parameter of any defined model (from instances of the Model class) may be referenced, and new entities might be specified using MathML definitions.
Output¶
The Output class defines the output of the simulation, in the sense that it specifies what shall be plotted in the output. To do so, an output type is defined, e.g. 2D-plot, 3D-plot or data table, and the according axes or columns are all assigned to one of the formerly specified instances of the DataGenerator class.
For information about SED-ML please refer to http://www.sed-ml.org/ and the SED-ML specification.
Module Contents¶
Classes¶
Supported target types in SBML models. |
|
Target in an SBML model. |
|
Serialize SimulationExperiment to SED-ML. |
|
Parse SED-ML to sbmlsim.SimulationExperiment. |
Attributes¶
- class sbmlsim.combine.sedml.parser.SBMLModelTargetType[source]¶
Bases:
enum.Enum
Supported target types in SBML models.
- class sbmlsim.combine.sedml.parser.SBMLModelTarget(selection, target_type)[source]¶
Target in an SBML model.
- Parameters:
selection (str) –
target_type (SBMLModelTargetType) –
- static sbmlsim_model_targets(r)[source]¶
Model targets which are supported by sbmlsim.
- Parameters:
r (sbmlsim.model.rr_model.roadrunner.ExecutableModel) –
- Return type:
Dict[str, SBMLModelTarget]
- class sbmlsim.combine.sedml.parser.SEDMLSerializer(exp_class, working_dir, sedml_filename, omex_path=None, data_path=None)[source]¶
Serialize SimulationExperiment to SED-ML.
Creates the SED-ML and the COMBINE archive containing all models and data for the simulation experiment.
- Parameters:
exp_class (Type[sbmlsim.experiment.SimulationExperiment]) –
working_dir (pathlib.Path) –
sedml_filename (str) –
omex_path (pathlib.Path) –
data_path (pathlib.Path) –
- _selection_lookup_table()[source]¶
Lookup table for sbmlsim model selections.
- Return type:
Dict[str, Dict[str, SBMLModelTarget]]
- datagenerator_id_from_data(data)[source]¶
Get the data generator id from data.
- Parameters:
data (sbmlsim.data.Data) –
- Return type:
str
- serialize_datasets()[source]¶
Serialize sbmlsim.DataSets to libsedml.DataDescription.
Write experiment datasets in SedDocument.
- serialize_simulations()[source]¶
Serialize simulations.
Write experiment simulations in SedDocument.
- serialize_figures()[source]¶
Serialize sbmlsim.Figures to libsedml.SedFigures.
Write experiment figures in SedDocument.
- serialize_axis(axis, sed_axis)[source]¶
Serialize sbmlsim.Axis to libsedml.SEDAxis.
- Parameters:
axis (sbmlsim.plot.Axis) –
sed_axis (libsedml.SedAxis) –
- Return type:
None
- serialize_style(style, sed_style)[source]¶
Serialize sbmlsim.Style to libsedml.Style.
- Parameters:
style (sbmlsim.plot.plotting.Style) –
sed_style (libsedml.SedStyle) –
- Return type:
None
- class sbmlsim.combine.sedml.parser.SEDMLParser(sed_doc, exec_dir, working_dir, name=None)[source]¶
Parse SED-ML to sbmlsim.SimulationExperiment.
- Parameters:
sed_doc (libsedml.SedDocument) –
exec_dir (pathlib.Path) –
working_dir (pathlib.Path) –
name (Optional[str]) –
- _wrap_plot_in_figure(sed_plot)[source]¶
Create sbmlsim.Plot from libsedml.Plot and wraps in sbmlsim.Figure.
- Parameters:
sed_plot (Union[libsedml.SedPlot2D, libsedml.SedPlot3D]) –
- Return type:
- _create_experiment_class()[source]¶
Create SimulationExperiment class from information.
See sbmlsim.experiment.Experiment for the expected functions.
- Return type:
- static parse_xpath_target(xpath)[source]¶
Resolve targets in xpath expression.
Uses a heuristics to figure out the targets.
- Parameters:
xpath (str) –
- Return type:
str
- parse_model(sed_model, source, sed_changes)[source]¶
Convert SedModel to AbstractModel.
- Parameters:
sed_changes (List[libsedml.SedChange]) –
sed_model (libsedml.SedModel) –
source (str) –
- Return type:
:param source:s :param sed_model: :return:
- resolve_model_changes()[source]¶
Resolve the original model sources and full change lists.
Going through the tree of model upwards until root is reached and collecting changes on the way (example models m* and changes c*) m1 (source) -> m2 (c1, c2) -> m3 (c3, c4) resolves to m1 (source) [] m2 (source) [c1,c2] m3 (source) [c1,c2,c3,c4] The order of changes is important (at least between nodes on different levels of hierarchies), because later changes of derived models could reverse earlier changes.
Uses recursive search strategy, which should be okay as long as the model tree hierarchy is not getting to deep.
- parse_change(sed_change)[source]¶
Parse the libsedml.Change.
Currently only a limited subset of model changes is supported. Namely changes of parameters and concentrations within a SedChangeAttribute.
- Parameters:
sed_change (libsedml.SedChange) –
- Return type:
Dict
- parse_algorithm_parameter(sed_alg_par)[source]¶
Parse algorithm parameter information.
- Parameters:
sed_alg_par (libsedml.SedAlgorithmParameter) –
- Return type:
- parse_simulation(sed_sim)[source]¶
Parse simulation information.
- Parameters:
sed_sim (libsedml.SedSimulation) –
- Return type:
- parse_task(sed_task)[source]¶
Parse arbitrary task (repeated or simple, or simple repeated).
- Parameters:
sed_task (libsedml.SedAbstractTask) –
- Return type:
- _parse_simple_task(task_node)[source]¶
Parse simple task.
- Parameters:
task_node (sbmlsim.combine.sedml.task.TaskNode) –
- Return type:
- abstract _parse_repeated_task(node)[source]¶
Parse repeated task.
Will be translated into a multi-dimensional scan.
- Parameters:
node (sbmlsim.combine.sedml.task.TaskNode) –
- parse_figure(sed_figure)[source]¶
Parse figure information.
- Parameters:
sed_figure (libsedml.SedFigure) –
- Return type:
- parse_plot2d(sed_plot2d)[source]¶
Parse the libsedml.Plot2D into a sbmlsim.Plot.
- Parameters:
sed_plot2d (libsedml.SedPlot2D) –
- Return type:
- abstract parse_plot3d(sed_plot3d)[source]¶
Parse Plot3D.
- Parameters:
sed_plot3d (libsedml.SedPlot3D) –
- Return type:
- parse_report(sed_report)[source]¶
Parse Report.
- Return dictionary of label:
dataGenerator.id mapping.
- Parameters:
sed_report (libsedml.SedReport) –
- Return type:
Dict[str, str]
- parse_axis(sed_axis)[source]¶
Parse axes information.
- Parameters:
sed_axis (libsedml.SedAxis) –
- Return type:
Optional[sbmlsim.plot.Axis]
- parse_abstract_curve(sed_acurve)[source]¶
Parse abstract curve.
- Parameters:
sed_acurve (libsedml.SedAbstractCurve) –
- Return type:
- parse_style(sed_style)[source]¶
Parse SED-ML style.
- Parameters:
sed_style (Union[str, libsedml.SedStyle]) –
- Return type:
Optional[sbmlsim.plot.plotting.Style]
- parse_line(sed_line)[source]¶
Parse line information.
- Parameters:
sed_line (libsedml.SedLine) –
- Return type:
Optional[sbmlsim.plot.plotting.Line]
- parse_marker(sed_marker)[source]¶
Parse the line information.
- Parameters:
sed_marker (libsedml.SedMarker) –
- Return type:
Optional[sbmlsim.plot.plotting.Marker]
- parse_fill(sed_fill)[source]¶
Parse fill information.
- Parameters:
sed_fill (libsedml.SedFill) –
- Return type:
Optional[sbmlsim.plot.plotting.Fill]
- data_from_datagenerator(sed_dg_ref)[source]¶
Evaluate DataGenerator with actual data.
Uses results of SimulationExperiment for evaluation.
- Parameters:
sed_dg_ref (Optional[str]) –
- Return type:
Optional[sbmlsim.data.Data]