Python Subnet Discovery for Systems Biology
Project description
SimpleSEDML
SimpleSEDML is a simple API for creating directives in the Simulation Experiment Description Markup Language (SED-ML) community standard for describing simulation experiments.
SimpleSEDML provides task-oriented APIs that greatly simplify the creation of SED-ML, OMEX files, and validating the results. Some specifics are:
- APIs for running time course simulations (for either a single model or multiple model).
- APIs for doing parameter scans (for either a single model or multiple models).
- Flexibility for model representation in that a model source can be a file path or URL and may be in the Antimony language as well as SBML.
The project provides a python interface to generate SED-ML based on the abstractions provided by phraSED-ML to describe simulation experiments. These absractions are: (a) models (including changes in values of model parameters); (b) simulations (including deterministic, stochastic, and steady state); (c) tasks (which specify simulations to run on tasks and repetitions for changes in parameter values); and (d) output for data reports and plots.
Installation
pip install SimpleSEDML
Example
See this Jupyter notebook for a detailed example. It is also available as a pdf file.
Consider the model below in the Antimony language.
MODEL_ANT = '''
model myModel
J1: S1 -> S2; k1*S1
J2: S2 -> S3; k2*S2
S1 = 10
S2 = 0
k1 = 1
k2 = 1
S1 is "species1"
S2 is "species2"
end
'''
We want to simulate this model and do a time course plot of all floating species in the model.
import SimpleSEDML as ss
smtc = ss.makeSingleModelTimeCourse(MODEL_ANT, title="My Plot")
The SED-ML generated by this statement can be viewed with
print(smtc.getSEDML())
This generates the following SED-ML:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created by phraSED-ML version v1.3.0 with libSBML version 5.19.5. -->
<sedML xmlns="http://sed-ml.org/sed-ml/level1/version4" xmlns:sbml="http://www.sbml.org/sbml/level3/version2/core" level="1" version="4">
<listOfModels>
<model id="time_course_model" language="urn:sedml:language:sbml.level-3.version-2" source="/Users/jlheller/home/Technical/repos/SimpleSEDML/examples/time_course_model"/>
</listOfModels>
<listOfSimulations>
<uniformTimeCourse id="time_course_sim" initialTime="0" outputStartTime="0" outputEndTime="5" numberOfSteps="50">
<algorithm name="CVODE" kisaoID="KISAO:0000019"/>
</uniformTimeCourse>
</listOfSimulations>
<listOfTasks>
<task id="time_course_task" modelReference="time_course_model" simulationReference="time_course_sim"/>
</listOfTasks>
<listOfDataGenerators>
<dataGenerator id="plot_0_0_0" name="time">
<math xmlns="http://www.w3.org/1998/Math/MathML">
<ci> time </ci>
</math>
<listOfVariables>
<variable id="time" symbol="urn:sedml:symbol:time" taskReference="time_course_task" modelReference="time_course_model"/>
</listOfVariables>
</dataGenerator>
<dataGenerator id="plot_0_0_1" name="S1">
<math xmlns="http://www.w3.org/1998/Math/MathML">
<ci> S1 </ci>
</math>
<listOfVariables>
<variable id="S1" target="/sbml:sbml/sbml:model/sbml:listOfSpecies/sbml:species[@id='S1']" taskReference="time_course_task" modelReference="time_course_model"/>
</listOfVariables>
</dataGenerator>
<dataGenerator id="plot_0_1_1" name="S2">
<math xmlns="http://www.w3.org/1998/Math/MathML">
<ci> S2 </ci>
</math>
<listOfVariables>
<variable id="S2" target="/sbml:sbml/sbml:model/sbml:listOfSpecies/sbml:species[@id='S2']" taskReference="time_course_task" modelReference="time_course_model"/>
</listOfVariables>
</dataGenerator>
<dataGenerator id="plot_0_2_1" name="S3">
<math xmlns="http://www.w3.org/1998/Math/MathML">
<ci> S3 </ci>
</math>
<listOfVariables>
<variable id="S3" target="/sbml:sbml/sbml:model/sbml:listOfSpecies/sbml:species[@id='S3']" taskReference="time_course_task" modelReference="time_course_model"/>
</listOfVariables>
</dataGenerator>
</listOfDataGenerators>
<listOfOutputs>
<plot2D id="plot_0" name="My Plot">
<listOfCurves>
<curve id="plot_0__plot_0_0_0__plot_0_0_1" logX="false" xDataReference="plot_0_0_0" logY="false" yDataReference="plot_0_0_1"/>
<curve id="plot_0__plot_0_0_0__plot_0_1_1" logX="false" xDataReference="plot_0_0_0" logY="false" yDataReference="plot_0_1_1"/>
<curve id="plot_0__plot_0_0_0__plot_0_2_1" logX="false" xDataReference="plot_0_0_0" logY="false" yDataReference="plot_0_2_1"/>
</listOfCurves>
</plot2D>
</listOfOutputs>
</sedML>
The PhraSED-ML to generate the above SED-ML is displayed below (obtained using smtc.getPhraSEDML()). It is considerably more text than the one-line API call.
time_course_model = model "/Users/jlheller/home/Technical/repos/SimpleSEDML/examples/time_course_model"
time_course_sim = simulate uniform(0, 5, 50)
time_course_sim.algorithm = CVODE
time_course_task = run time_course_sim on time_course_model
plot "My Plot" time vs S1, S2, S3
Executing this SED-ML is done by
smtc.executeSEDML()
which generates the following plot:
Restrictions
- If there are multiple task directives and/or there is a repeated task directive AND there is a report directive, SimpleSEDML.execute only returns the results of the last simulation. You can circumvent this by iterating in python to obtain the desired reports.
- Steadystate simulations don't execute correctly (likely a
PhraSEDMLissue), but they do generate valid SED-ML.
Versions
-
0.1.2
- Updated pip version
- Fixed bug with legend for MultipleModelTimeCourse
-
0.1.0 6/3/2025
- MultipleModel constructors have model_refs as optional
- Many bug fixes
-
0.0.8
- MultipleModelParameterScan
- Refactored to create MultipleModelSimpleSEDML, common code for MultipleModelParameterScan and MultipleModelTimeCourse
-
0.0.7 5/30/2025
- Single model parameter scan, but cannot execute for steadystate.
- Display variables are used on plots.
-
0.0.6 5/27/2025
- Time courses simulate onestep, stochastic, steadystate
- Refactored API.
-
0.0.5 5/24/2025
- Added ".xml" to SBML files
- Model files are created in a target directory
- Files created during tests are eliminated
- Create separate test module for testing SingleModelTimeCourse
- __init__ exposes
makeSingleModelTimeCourse,makeMultipleModelTimeCourse,getModelInformtation,SimpleSEDML. - Create an OMEX file and validate it
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simplesedml-0.1.2.tar.gz.
File metadata
- Download URL: simplesedml-0.1.2.tar.gz
- Upload date:
- Size: 38.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1762bd7cc08632e5d01119065b2b4030b41383ed529dc7ede0335b7df08b2907
|
|
| MD5 |
ecc83181a73d087a1302fa35398c3d09
|
|
| BLAKE2b-256 |
92b1ff1bfb898e2fc1c5599fbbddd5a5f497fcbbec33e8cc882c728246e5c685
|
File details
Details for the file simplesedml-0.1.2-py3-none-any.whl.
File metadata
- Download URL: simplesedml-0.1.2-py3-none-any.whl
- Upload date:
- Size: 58.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4edd7dd619d270ae4c47a28d67402c255af8ca2f8333661b56685716caa1cc90
|
|
| MD5 |
9792f908ec48a66c7d3d57f9258d1a8e
|
|
| BLAKE2b-256 |
c4d9a527d2c34c336001a1e4c4f17327392378306083051c3aa6e1790eaa4009
|