Control analysis of SBML models
Project description
controlSBML
The Systems Biology Markup Language (SBML) is a community standard for representing
simulations of biological models, especially chemical reaction networks.
controlSBML is a package that does control analysis and design of SBML models using
the CalTech control package.
controlSBML uses the following "systems characterization" of an SBML model:
- state variables are floating species;
- inputs are reaction fluxes;
- outputs are a subset of the state variables.
We note that reaction fluxes cannot be manipulated directly. Thus,implementation requires a mapping from a reaction flux to an effector, typically a chemical
species such as an enzyme that is specific to the reaction.
The keyword effector_dct refers to a python dictionary that does this mapping.
(See the makeNonlinearIOSystem method of ControlSBML.)
controlSBML interfaes to the control package by creating two kinds of control objects for an SBML model:
NonlinearIOSystem, which wraps the actual simulation of the SBML model; andStateSpace, which is a linear MIMO model approximation of the SBML model at a specified time in the simulation.
These objects can be used in combination with other control objects to analyze system properties,
design controllers, and construct closed loop systems.
controlSBML also provides analyses of SBML models as well as a means to manipulate
elements of the SBML model.
Installation
pip install controlSBML
To find the current version:
import controlSBML as ctl
ctl.__version__
Installing slycot (optional)
To get the full set of capabilities from the control package,
you need to install slycot, a package that addresses requirements
for more sophisticated manipulation of MIMO models (e.g.,
solving algebraic Ricotti equations).
The best way is to install slycot is from binaries using anaconda.
However,
at the present time, anaconda is difficult to set up on
Google Collaboratory.
Otherwise, you need to install from source. Below are the instructions for Ubuntu.
- install cmake:
pip install cmake --upgrade - install sikit-build:
pip install scikit-build - install fortran:
sudo apt-get install gfortran - provide path to fortran:
export FC=`which gfortran - install BLAS:
sudo apt-get install libatlas-base-dev - clone Sylcot:
git clone --recurse-submodules https://github.com/python-control/Slycot.git cd Slycotpython setup.py install
Constructing ControlSBML
ctlsb = ControlSBML(model_reference)
where
model_referencecan be any of the following:
- path to a local file with the extension
.antor.xml - a python string for an SBML or Antimony model representation
- a URL to an XML file
Technical Summary
ControlSBML
Properties
roadrunneris the roadrunner object for the SBML model.jacobian_dfis the full Jacobian of the model at the current simulation time. Changes toroadrunnercan change this property.antimonyis the antimony representation of the model.A_dfis the ${\bf A}$ matrix in the linear system represented as a pandas DataFrame.B_dfis the ${\bf B}$ matrix in the linear system represented as a pandas DataFrame.C_dfis the ${\bf C}$ matrix in the linear system represented as a pandas DataFrame.state_namesis a list of floating species that constitute the state vector.input_namesis a list of reaction names that specify the input vector.output_namesis a list of floating species that constitute the output vector.
Methods
setTime(new_time)resetsroadrunnerand runs a simulation from time zero to the time specified.makeStateSpace()creates acontrolstate space object using the Jacobian of the model at the current simulation time.makeNonlinearIOSystem()creates aNonlinearIOSystemobject that simulates the SBML model.plotTrueModelplots a roadrunner simulation.plotLinearApproximationplots the linear approximation provided by an ${\bf A}$ matrix. The default ${\bf A}$ matrix is the Jacobian of the currentRoadRunnerinstance. You can either specify a different ${\bf A}$ or set theRoadRunnerinstance to a different time.plotBodeconstructs bode plots for the SISO systems formed by all combinations of inputs and outputs.
Other Functions
makeTScreates a time series object from an array. A time series object is a DataFrame whose index in time (in integer milliseconds), and the columns are variable names.simulateSystemprovides a simplified way to simulate a system (which may be aninterconnect) by creating the times and initial, returns a time series DataFrame.plotOneTSplots a single time series DataFrame.plotManyTSplots multiple time series DataFrames structured so that each column is a separate plot that compares the different times series.
Example
This notebook provides a simple example of using controlSBML.
Developer Notes
- The package works with and without
slycot. So two virtual environments are needed for testing:ctlincludesslycotandctl_tstdoes not. Note that continuous integration is done only withoutslycot.
Version History
- 0.2.22
- IOSystemFactor.makeStateFilter creates a vector of filters between 2 systems
- SISOClosedLoopSystem.makeFullStateController creates multiple filters if kf != 0
- 0.2.21 5/30/2022
- NonlinearIOSystem creates a logger.
- SISOClosedLoopSystem.makeFullStateSystem has option for filters
- Changed legend of step respoinse plot to use "reference" instead of "step"
- 0.2.20 5/27/2022
- Fix bug in SISOClosedLoopSystem.evaluateControllability because scipy didn't handle nan values.
- 0.2.19 5/27/2022
- Fix bug in SISOClosedLoopSystem.evaluateControllability because scipy didn't handle nan values.
- 0.2.18 5/26/2022
- Fix small bug
- 0.2.17 5/26/2022
- Deleted the callback_log implemented in 0.2.14.
- 0.2.16 5/24/2022
- Refactored SISOClosedLoopSystem
- Implemented SISOClosedLoopSystem.makeFullStateController
- Fixed bug with makePIDController where ki, kd are ineffective.
- 0.2.15 5/21/2022
- Fix bug in reverting the semantics of control input to be setting the species as a static.
- 0.2.14 5/11/2022
- Provide callback for each manufactured IOsystemFactory
- Reverted semantics of control input to a NonlinearIOSystem to be setting the value rather than adding or subtracting a value.
- 0.2.13 5/9/2022
- SISOClosedLoopSystem provides a way to construct a closed loop system for an SBML model. The system has a PID controller and a filter.
- IOSysemFactory has a log
- 0.2.12 5/3/2022
- IOSystemFactory creates IOSystem objects for Adder, Multiplier, Filter, PIDController, Sinusoid, Constant, Passthru
- State inputs add to state, not replace the state value.
- 0.2.11 4/25/2022
- Fix bug in calculating transfer function that incorrectly considered state
- 0.2.9 4/19/2022
- Fluxes can be outputs
- Construction of transfer function includes atol option for simplification
- 0.2.8 4/17/2022
- Added options to plotTrueModel
- Updated Using ControlSBML with an example of doing feedback
- 0.2.7 4/11/2022
- Species can be inputs
- makeStateSpace, makeTransferFunction have timepoint argument
- 0.2.6 4/10/2020
- Default for constructor: is_reduced=False
- makeTransferFunction
- 0.2.5 4/8/2022
- Improve performance by not recalculating Jacobian
- Fix bugs related to implementation of is_reduced as applied on NonlinearIOSystem
- 0.2.4 3/31/2024 - Create reduced A matrix
- mat2Df - fixed bug with printing column names
- Create reduced A matrix for makeStateSpace so that A is non-singular Default output_names is all floating species
- 0.2.3, 3/22/2022 - Bug fix for mat2DF
- 0.2.2, 3/22/2022 - Bug fix
- 0.2.1, 3/22/2022 - Bug fix
- 0.2.0, 3/22/2022 - Version for class
- ppMat - pretty print a matrix
- plotMat - display a heatmap for a matrix
- mat2TS - convert a matrix to a timeseries
- mat2DF - convert a matrix to a dataframe
- 0.1.6, 3/16/2022
Using-Control-SBML.ipynbhas an example of doing feedback control design withcontrolSBML.control.NonlinearIOSystemwraps an SBML model. Can be used in the construction of systems usingcontrol.interconnectand in simulations usingcontrol.input_output_response. One caveat is that this may work poorly for models implemented as SBML rate rules.
- 0.1.5, 3/5/2022.
- More options for plotting and simulations
- plotBode
- Inputs are identified by reaction Ids
- 0.1.3, 2/13/2022. First release.
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 controlSBML-0.0.8.tar.gz.
File metadata
- Download URL: controlSBML-0.0.8.tar.gz
- Upload date:
- Size: 36.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2dfa415487fc97b37a434f6f1c844754a9f5458e876185941929d373356888b
|
|
| MD5 |
681f337670a419c1134d6f4333a6dd3c
|
|
| BLAKE2b-256 |
65c70e33c76a27707d28164ab896b00aa43c38f4e69421382066a4e678c25aba
|
File details
Details for the file controlSBML-0.0.8-py3-none-any.whl.
File metadata
- Download URL: controlSBML-0.0.8-py3-none-any.whl
- Upload date:
- Size: 43.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40fdd911a2e752c86c1f9b35423579bd79c83167f6df837d3babb2a06b536643
|
|
| MD5 |
892dde1d2fbc50364915103ff36aeedd
|
|
| BLAKE2b-256 |
a10429bda56c018093aaaba08d3617f1af2f35e3ac1c36fed16cfa20e81c7258
|