### installPackage Source: https://tellurium.readthedocs.io/en/latest/tellurium_methods.html Installs a Python package from PyPI using pip. This method delegates to pip and is more reliable than using !pip install. ```APIDOC ## installPackage ### Description Installs a Python package from PyPI using pip. This method delegates to pip and is more reliable than using !pip install. ### Method installPackage ### Parameters - **package** (string) - Required - The name of the package to install. ### Example ```python import tellurium as te te.installPackage('cobra') ``` ``` -------------------------------- ### SEDMLCodeFactory.simpleTaskSetup() Source: https://tellurium.readthedocs.io/en/latest/_apidoc/tellurium.html Generates setup code for a simple task. ```APIDOC ## SEDMLCodeFactory.simpleTaskSetup() ### Description Generates setup code for a simple task. ### Method N/A (Python method) ### Endpoint N/A ### Parameters No parameters documented. ### Request Example N/A ### Response #### Success Response Returns Python code string. #### Response Example N/A ``` -------------------------------- ### Antimony layout full example Source: https://tellurium.readthedocs.io/en/latest/antimony.html Complete Antimony layout example covering global layout defaults, species group defaults, individual species overrides, and alignment settings. Use as a reference for configuring layout properties in Antimony. ```antimony model.layout.background = fuchsia # The background color model.layout.color = khaki # (or 'fillcolor') The fill color for all elements in the layout model.layout.linecolor = azure # (or 'strokecolor') The default line color for all elements in the layout model.layout.linewidth = 32 # (or 'strokewidth') The default linewidth for all elements in the layout model.layout.fontcolor = coral # The default font color for all text in the layout model.layout.font = monospace # The default font for all text in the layout (predefined options are 'serif' (default), 'sans_serif', and 'monospace', but arbitrary font names are also legal.) model.layout.fontsize = 4 # The default font size for all text in the layout (default 10) model.layout.fontstyle = italic # (or 'fontweight') The default font style for all text in the layout (options are 'normal' (default), 'bold', 'italic', and 'bold_italic'). # Group type defaults (species, compartments, reactions) species.size = {68, 101} # The default size (width, height) for all species in the layout species.width = 68 # The default height for all species in the layout species.height = 101 # The default height for all species in the layout species.color = blue # (or 'fillcolor') The default fill color for all species in the layout species.linecolor = orange # (or 'strokecolor') The default line color for all species in the layout species.linewidth = 11 # (or 'strokewidth') The default linewidth for all species in the layout species.fontcolor = green # The default font color for all species in the layout species.font = sans_serif # The default font for all species in the layout (predefined options are 'serif' (default), 'sans_serif', and 'monospace', but arbitrary font names are also legal.) species.fontsize = 8 # The default font size for all species in the layout (default 10) species.fontstyle = bold_italic # (or 'fontweight') The default font style for all species in the layout (options are 'normal' (default), 'bold', 'italic', and 'bold_italic'). species.shape = ellipse # The default shape for all species in the layout (options are 'rectangle' (default), 'square', 'ellipse', 'circle', 'triangle', 'diamond', 'pentagon', 'hexagon', and 'octagon'). # Individual species options: S1.pos = {28, 35} # The position (x, y) of S1 in the layout. By default, determined by autolayout. S1.x = 28 # (alt for pos) The x position of S1. S1.y = 35 # (alt for pos) The y position of S1. # Species options that override general species options: S1.size = {55, 66} # The size (width, height) of S1. S1.width = 55 # (alt for size). The width of S1. S1.height = 66 # (alt for size). The height of S1. S1.color = magenta # (or 'fillcolor') The fill color for S1 S1.linecolor = yellow # (or 'strokecolor') The line color for S1 S1.linewidth = 18 # (or 'strokewidth') The linewidth for S1 S1.fontcolor = gray # The font color for S1 S1.font = serif # The font for S1 (predefined options are 'serif' (default), 'sans_serif', and 'monospace', but arbitrary font names are also legal.) S1.fontsize = 19 # The font size for S1 (default 10) S1.fontstyle = bold # (or 'fontweight') The font style for S1 (options are 'normal' (default), 'bold', 'italic', and 'bold_italic'). S1.shape = ellipse # The shape for S1 (options are 'rectangle' (default), 'square', 'ellipse', 'circle', 'triangle', 'diamond', 'pentagon', 'hexagon', and 'octagon'). J0.S1.species_end = {28, 34} # The position of the outer (species-side) end of the line between 'S1' and 'J0' (where J0 is the central point of the reaction) J0.S1.b1 = {55, 31} # The first control point for the line between S1 and J0. J0.S1.b2 = {58, 25} # The second control point for the line between S1 and J0. J0.S1.rxn_end = {60, 24} # The inner (reaction-side) end of the line between S1 and J0. Usually not needed; the position is by default the position of the reaction itself. #Align example: S1->S2; S2->S3; S3->S4; S4->S5; model.layout.align_top = {S1, S2, S3} model.layout.align_right = {S3, S4, S5} ``` -------------------------------- ### Install IRkernel for R Source: https://tellurium.readthedocs.io/en/latest/walkthrough.html Install the IRkernel package and its dependencies using R commands. This is the first step to use an R kernel with Tellurium. ```R install.packages('devtools') install.packages(c('repr', 'IRdisplay', 'evaluate', 'crayon', 'pbdZMQ', 'devtools', 'uuid', 'digest')) devtools::install_github('IRkernel/IRkernel') ``` -------------------------------- ### Install pygraphviz with pip Source: https://tellurium.readthedocs.io/en/latest/notebooks.html Run this command from a terminal or command prompt to install pygraphviz. After installation, restart the kernel in the notebook (Language->Restart Running Kernel). ```bash -m pip install pygraphviz ``` -------------------------------- ### Output: load using tellurium Source: https://tellurium.readthedocs.io/en/latest/tellurium_methods.html Output marker for the tellurium loading example. ```text --- load using tellurium --- ``` -------------------------------- ### Simulate and Reset Model with reset, resetAll, resetToOrigin Source: https://tellurium.readthedocs.io/en/latest/tellurium_methods.html Python example using Tellurium to load a simple model, simulate it, and demonstrate the effects of reset, resetAll, and resetToOrigin. The example changes the parameter k1 and the initial value of k1 to show how each reset function behaves. The output is shown in the following code blocks. ```python import tellurium as te r = te.loada ('S1 -> S2; k1*S1; k1 = 0.1; S1 = 10') r.integrator.setValue('variable_step_size', True) # simulate model sim1 = r.simulate(0, 5) print('*** sim1 ***') r.plot(sim1) # continue from end concentration of sim1 r.k1 = 2.0 sim2 = r.simulate(0, 5) print('-- sim2 --') print('continue simulation from final concentrations with changed parameter') r.plot(sim2) # Reset initial concentrations, does not affect the changed parameter r.reset() sim3 = r.simulate(0, 5) print('-- sim3 --') print('reset initial concentrations but keep changed parameter') r.plot(sim3) # Change CURRENT initial of k1, resetAll clears parameter but # resets to CURRENT initial r.setValue('init(k1)', 0.3) r.resetAll() sim4 = r.simulate(0, 5) print('-- sim4 --') print('reset to CURRENT initial of k1, reset to initial parameters') print('k1 = ' + str(r.k1)) r.plot(sim4) # Reset model to the state it was loaded r.resetToOrigin() sim5 = r.simulate(0, 5) print('-- sim5 --') print('reset all to origin') r.plot(sim5); ``` ```text * sim1 * ``` ```text -- sim2 -- continue simulation from final concentrations with changed parameter ``` ```text -- sim3 -- reset initial concentrations but keep changed parameter ``` ```text -- sim4 -- reset to CURRENT initial of k1, reset to initial parameters k1 = 0.3 ``` ```text -- sim5 -- reset all to origin ``` -------------------------------- ### Export Antimony and get Antimony strings Source: https://tellurium.readthedocs.io/en/latest/tellurium_methods.html Shows how to export the current model state to an Antimony file using exportToAntimony, and how to get the current and initial Antimony strings using getCurrentAntimony and getAntimony. The current argument controls whether the current state or the initial state is exported. ```python import tellurium as te import tempfile # load model r = te.loada('S1 -> S2; k1*S1; k1 = 0.1; S1 = 10') # file for export f_antimony = tempfile.NamedTemporaryFile(suffix=".txt") # export current model state r.exportToAntimony(f_antimony.name) # to export the initial state when the model was loaded # set the current argument to False r.exportToAntimony(f_antimony.name, current=False) # The string representations of the current model are available via str_antimony = r.getCurrentAntimony() # and of the initial state when the model was loaded via str_antimony = r.getAntimony() print(str_antimony) ``` ```antimony // Created by libAntimony v2.9.4 // Compartments and Species: species S1, S2; // Reactions: _J0: S1 -> S2; k1*S1; // Species initializations: S1 = 10; S2 = ; // Variable initializations: k1 = 0.1; // Other declarations: const k1; ``` -------------------------------- ### Output: load using roadrunner Source: https://tellurium.readthedocs.io/en/latest/tellurium_methods.html Output marker for the roadrunner loading example. ```text --- load using roadrunner --- ``` -------------------------------- ### plotSurface example Source: https://tellurium.readthedocs.io/en/latest/paramscan.html Performs a parameter scan using plotSurface() with a model and colormap settings. ```python r = te.loada(''' $Xo -> S1; vo; S1 -> S2; k1*S1 - k2*S2; S2 -> $X1; k3*S2; vo = 1 k1 = 2; k2 = 0; k3 = 3; ''') # parameter scan p = te.ParameterScan(r, # settings startTime = 0, endTime = 6, numberOfPoints = 50, startValue = 1, endValue = 5, colormap = "cool", independent = ["Time", "k1"], dependent = "S1", xlabel = "Time", ylabel = "x", title = "Model" ) # plot p.plotSurface() ``` -------------------------------- ### Export SBML and get SBML strings Source: https://tellurium.readthedocs.io/en/latest/tellurium_methods.html Shows how to export the current model state to an SBML file using exportToSBML, and how to get the current and initial SBML strings using getCurrentSBML and getSBML. The current argument controls whether the current state or the initial state is exported. ```python import tellurium as te import tempfile # load model r = te.loada('S1 -> S2; k1*S1; k1 = 0.1; S1 = 10') # file for export f_sbml = tempfile.NamedTemporaryFile(suffix=".xml") # export current model state r.exportToSBML(f_sbml.name) # to export the initial state when the model was loaded # set the current argument to False r.exportToSBML(f_sbml.name, current=False) # The string representations of the current model are available via str_sbml = r.getCurrentSBML() # and of the initial state when the model was loaded via str_sbml = r.getSBML() print(str_sbml) ``` ```xml k1 S1 ``` -------------------------------- ### 3D Plotting with PhraSEDML using executeInlineOmex Source: https://tellurium.readthedocs.io/en/latest/notebooks.html This example demonstrates 3D plotting in Tellurium using PhraSEDML. It defines an Antimony model (case_09) and a PhraSEDML script that simulates the model and plots multiple variables in 3D. The syntax is `plot vs vs `. The example uses `te.executeInlineOmex` to run the combined OMEX string. ```python import tellurium as te antimony_str = ''' // Created by libAntimony v2.9 model *case_09() // Compartments and Species: compartment compartment_; species MKKK in compartment_, MKKK_P in compartment_, MKK in compartment_; species MKK_P in compartment_, MKK_PP in compartment_, MAPK in compartment_; species MAPK_P in compartment_, MAPK_PP in compartment_; // Reactions: J0: MKKK => MKKK_P; (J0_V1*MKKK)/((1 + (MAPK_PP/J0_Ki)^J0_n)*(J0_K1 + MKKK)); J1: MKKK_P => MKKK; (J1_V2*MKKK_P)/(J1_KK2 + MKKK_P); J2: MKK => MKK_P; (J2_k3*MKKK_P*MKK)/(J2_KK3 + MKK); J3: MKK_P => MKK_PP; (J3_k4*MKKK_P*MKK_P)/(J3_KK4 + MKK_P); J4: MKK_PP => MKK_P; (J4_V5*MKK_PP)/(J4_KK5 + MKK_PP); J5: MKK_P => MKK; (J5_V6*MKK_P)/(J5_KK6 + MKK_P); J6: MAPK => MAPK_P; (J6_k7*MKK_PP*MAPK)/(J6_KK7 + MAPK); J7: MAPK_P => MAPK_PP; (J7_k8*MKK_PP*MAPK_P)/(J7_KK8 + MAPK_P); J8: MAPK_PP => MAPK_P; (J8_V9*MAPK_PP)/(J8_KK9 + MAPK_PP); J9: MAPK_P => MAPK; (J9_V10*MAPK_P)/(J9_KK10 + MAPK_P); // Species initializations: MKKK = 90; MKKK_P = 10; MKK = 280; MKK_P = 10; MKK_PP = 10; MAPK = 280; MAPK_P = 10; MAPK_PP = 10; // Compartment initializations: compartment_ = 1; // Variable initializations: J0_V1 = 2.5; J0_Ki = 9; J0_n = 1; J0_K1 = 10; J1_V2 = 0.25; J1_KK2 = 8; J2_k3 = 0.025; J2_KK3 = 15; J3_k4 = 0.025; J3_KK4 = 15; J4_V5 = 0.75; J4_KK5 = 15; J5_V6 = 0.75; J5_KK6 = 15; J6_k7 = 0.025; J6_KK7 = 15; J7_k8 = 0.025; J7_KK8 = 15; J8_V9 = 0.5; J8_KK9 = 15; J9_V10 = 0.5; J9_KK10 = 15; // Other declarations: const compartment_, J0_V1, J0_Ki, J0_n, J0_K1, J1_V2, J1_KK2, J2_k3, J2_KK3; const J3_k4, J3_KK4, J4_V5, J4_KK5, J5_V6, J5_KK6, J6_k7, J6_KK7, J7_k8; const J7_KK8, J8_V9, J8_KK9, J9_V10, J9_KK10; end ''' phrasedml_str = ''' mod1 = model "case_09" # sim1 = simulate uniform_stochastic(0, 4000, 1000) sim1 = simulate uniform(0, 4000, 1000) task1 = run sim1 on mod1 repeat1 = repeat task1 for local.x in uniform(0, 10, 10), reset=true plot "MAPK oscillations" repeat1.MAPK vs repeat1.time vs repeat1.MAPK_P, repeat1.MAPK vs repeat1.time vs repeat1.MAPK_PP, repeat1.MAPK vs repeat1.time vs repeat1.MKK # report repeat1.MAPK vs repeat1.time vs repeat1.MAPK_P, repeat1.MAPK vs repeat1.time vs repeat1.MAPK_PP, repeat1.MAPK vs repeat1.time vs repeat1.MKK ''' # create the inline OMEX string inline_omex = '\n'.join([antimony_str, phrasedml_str]) # execute the inline OMEX te.executeInlineOmex(inline_omex) ``` -------------------------------- ### getFloatingSpeciesAmounts() - get all amounts Source: https://tellurium.readthedocs.io/en/latest/_apidoc/tellurium.roadrunner.html Example from the getFloatingSpeciesAmounts documentation showing how to retrieve all floating species amounts when no index argument is provided. The output is a list of amounts, e.g., [15,2,3,20]. ```python >>> e.getFloatingSpeciesAmounts() [15,2,3,20] ``` -------------------------------- ### simpleTaskSetup() (SEDMLCodeFactory static method) Source: https://tellurium.readthedocs.io/en/latest/genindex.html Static method of SEDMLCodeFactory in tellurium.sedml.tesedml. It creates setup code for a simple task. ```APIDOC ## Method: simpleTaskSetup() ### Description Static method of SEDMLCodeFactory in tellurium.sedml.tesedml. It creates setup code for a simple task. ### Class `tellurium.sedml.tesedml.SEDMLCodeFactory` ### Static Method `simpleTaskSetup()` ### Usage Call as a static method on the class. ### Example ```python code = SEDMLCodeFactory.simpleTaskSetup(...) ``` ``` -------------------------------- ### getFloatingSpeciesAmounts([3,0]) - get specific amounts Source: https://tellurium.readthedocs.io/en/latest/_apidoc/tellurium.roadrunner.html Example from the getFloatingSpeciesAmounts documentation showing how to retrieve amounts for specific floating species indices using an index array. The output is a list of amounts for the requested indices, e.g., [10,15]. ```python >>> getFloatingSpeciesAmounts([3,0]) [10,15] ``` -------------------------------- ### Full Antimony layout example Source: https://tellurium.readthedocs.io/en/latest/antimony.html A complete model demonstrating layout configuration: enabling layout, autolayout options, general style, alignment, and size settings. ```antimony J0: S1->S2; # If you just want layout on: model.layout = on # Only need to turn on if don't define anything else; doesn't work to turn it off. //Autolayout options: model.autolayout.maxNumConnectedEdges = 5 # If a single species is involved in more than this number of reactions, it gets aliased. Default 3. # General layout defaults: model.layout.style = calm # Set the overall style to one of Adel's predefined styles. model.layout.align_top = {S1} # Align these nodes in the same row at the top of the layout. # (Also available: align_ - bottom, right, left, hCenter, vCenter, and circular) model.layout.size = {505, 404} # {width, height} The size of the entire layout. model.layout.width = 505 # alt for 'size' The width of the entire layout. model.layout.height = 404 # alt for 'size' The height of the entire layout. ``` -------------------------------- ### Simulate with points argument Source: https://tellurium.readthedocs.io/en/latest/notebooks.html Shows how to call simulate with start, end, and points using keyword or positional arguments. The output is identical for both calls. ```python # simulate from 0 to 6 with 6 points in the result r.reset() # pass args explicitly via keywords res1 = r.simulate(start=0, end=10, points=6) print(res1) r.reset() # use positional args to pass start, end, num. points res2 = r.simulate(0, 10, 6) print(res2) ``` ```text time, [S1], [S2] [[ 0, 10, 0], [ 2, 1.23775, 8.76225], [ 4, 0.253289, 9.74671], [ 6, 0.0444091, 9.95559], [ 8, 0.00950381, 9.9905], [ 10, 0.00207671, 9.99792]] time, [S1], [S2] [[ 0, 10, 0], [ 2, 1.23775, 8.76225], [ 4, 0.253289, 9.74671], [ 6, 0.0444091, 9.95559], [ 8, 0.00950381, 9.9905], [ 10, 0.00207671, 9.99792]] ``` -------------------------------- ### Antimony: Basic assignments with formulas Source: https://tellurium.readthedocs.io/en/latest/antimony.html Shows how to initialize elements with formulas, including arithmetic and trigonometric functions. Assignments are evaluated at model initialization. ```antimony model pathway() # Examples of different assignments A = 1.2 k1 = 2.3 + A k2 = sin(0.5) k3 = k2/k1 S1 -> S2; k1*S1 S2 -> S3; k2*S2 S3 -> S4; k3*S3 S1 = 10 end ``` -------------------------------- ### Install Tellurium with pip Source: https://tellurium.readthedocs.io/en/latest/installation.html Standard pip installation command for Tellurium on Mac, Linux, and Windows. Requires Python 3.7, 3.8, or 3.9. ```bash $ pip install tellurium ``` -------------------------------- ### Set integrator settings and run simulation Source: https://tellurium.readthedocs.io/en/latest/notebooks.html Shows how to check the current integrator, enable variable stepping, set tolerances via property or setValue, and run a simulation. The output includes the integrator details and time values. ```python # what is the current integrator? print('The current integrator is:') print(r.integrator) # enable variable stepping r.integrator.variable_step_size = True # adjust the tolerances (can set directly or via setValue) r.integrator.absolute_tolerance = 1e-3 # set directly via property r.integrator.setValue('relative_tolerance', 1e-1) # set via a call to setValue # run a simulation, stop after reaching or passing time 10 r.reset() results = r.simulate(0, 10) r.plot() # print the time values from the simulation print('Time values:') print(results[:,0]) ``` ```text The current integrator is: < roadrunner.Integrator() > name: cvode settings: relative_tolerance: 0.000001 absolute_tolerance: 0.000000000001 stiff: true maximum_bdf_order: 5 maximum_adams_order: 12 maximum_num_steps: 20000 maximum_time_step: 0 minimum_time_step: 0 initial_time_step: 0 multiple_steps: false variable_step_size: false ``` ```text Time values: [0.00000000e+00 3.43225906e-07 3.43260229e-03 3.77551929e-02 7.20777836e-02 1.60810095e-01 4.37546265e-01 7.14282434e-01 1.23145372e+00 1.74862501e+00 2.26579629e+00 2.78296758e+00 3.30013887e+00 3.81731015e+00 4.33448144e+00 4.85165273e+00 5.36882401e+00 5.88599530e+00 6.40316659e+00 6.92033787e+00 7.43750916e+00 7.95468045e+00 8.47185173e+00 9.25832855e+00 1.00000000e+01] ``` -------------------------------- ### getODEsFromModel usage example Source: https://tellurium.readthedocs.io/en/latest/_apidoc/tellurium.utils.html Shows how to call te.getODEsFromModel with a roadrunner instance created by te.loada. The example loads a simple model and then extracts ODEs. ```python >>> r = te.loada ('S1 -> S2; k1*S1; k1=1') >>> te.getODEsFromModel (r) ``` -------------------------------- ### LatexExport.saveToFile usage example Source: https://tellurium.readthedocs.io/en/latest/_apidoc/tellurium.teio.html Example from the saveToFile method documentation showing how to simulate and export results using LatexExport. The result is passed to the export method. ```python result = rr.simulate(0, 6, 20, [‘Time’, ‘S1’, ‘S2’]) p.export(result, model1) ``` -------------------------------- ### Import a module without naming Source: https://tellurium.readthedocs.io/en/latest/antimony.html Imports the 'example' module into 'example2' by using its name followed by parentheses. Order matters in Antimony. ```antimony model example S + E -> ES; end model example2 example(); end ``` -------------------------------- ### Import multiple submodules and nested modules Source: https://tellurium.readthedocs.io/en/latest/antimony.html Imports two copies of 'example' and one of 'example2' (which itself contains a submodule). Results in three reactions and one initial condition. ```antimony model example3 A: example(); B: example(); C: example2(); end ``` -------------------------------- ### Install, upgrade, and remove packages with Tellurium Source: https://tellurium.readthedocs.io/en/latest/notebooks.html Use te.installPackage to install a package like cobra, te.upgradePackage to update it, and te.removePackage (commented out) to remove it. Works in Tellurium notebook and Tellurium Spyder. ```python import tellurium as te # install cobra (https://github.com/opencobra/cobrapy) te.installPackage('cobra') # update cobra to latest version te.upgradePackage('cobra') # remove cobra # te.removePackage('cobra') ``` -------------------------------- ### Install pygraphviz on 64-bit Fedora Linux Source: https://tellurium.readthedocs.io/en/latest/notebooks.html Use this command to install pygraphviz on 64-bit Fedora Linux, specifying the include and library paths for Graphviz. You may need to modify the paths for your system. ```bash /path/to/python3 -m pip install pygraphviz --install-option="--include-path=/usr/include/graphviz" --install-option="--library-path=/usr/lib64/graphviz/" ``` -------------------------------- ### __main(tspan, solver, options) Source: https://tellurium.readthedocs.io/en/latest/tellurium_methods.html Simulates the model over the given time span using the specified ODE solver and options. Returns the time vector, simulation results, and a structure containing model information. ```APIDOC ## __main(tspan, solver, options) ### Description Simulates the model over the given time span using the specified ODE solver and options. Returns the time vector, simulation results, and a structure containing model information. ### Method Function call ### Endpoint __main(tspan, solver, options) ### Parameters #### Input Arguments - **tspan** (vector) - Required - The time vector for the simulation. It can contain every time point, or just the start and end (e.g. [0 1 2 3] or [0 100]). - **solver** (function handle) - Required - The function handle for the odeN solver you wish to use (e.g. @ode23s). - **options** (structure) - Required - The options structure returned from the MATLAB odeset function used for setting tolerances and other parameters for the solver. ### Request Example ```matlab options = odeset('RelTol',1e-12,'AbsTol',1e-9); [t x rInfo] = __main(linspace(0,100,100),@ode23s,options); ``` ### Response #### Output Arguments - **t** (vector) - The time vector that corresponds with the solution. If tspan only contains the start and end times, t will contain points spaced out by the solver. - **x** (matrix) - The simulation results. - **rInfo** (structure) - A structure containing information about the model. The fields within rInfo are: - **stoich** (matrix) - The stoichiometry matrix of the model. - **floatingSpecies** (cell array) - A cell array containing floating species name, initial value, and indicator of the units being in concentration or amount. - **compartments** (cell array) - A cell array containing compartment names and volumes. - **params** (cell array) - A cell array containing parameter names and values. - **boundarySpecies** (cell array) - A cell array containing boundary species name, initial value, and indicator of the units being in concentration or amount. - **rateRules** (cell array) - A cell array containing the names of variables used in a rate rule. #### Response Example ```matlab % Example of rInfo structure fields rInfo.stoich = [-1; 1]; rInfo.floatingSpecies = {'S1', 10, 0; 'S2', 0, 0}; rInfo.compartments = {'default_compartment', 1}; rInfo.params = {'k1', 0.1}; rInfo.boundarySpecies = {}; rInfo.rateRules = {}; ``` ``` -------------------------------- ### SEDMLCodeFactory.selectionsForTask() Source: https://tellurium.readthedocs.io/en/latest/_apidoc/tellurium.html Gets selections for a task. ```APIDOC ## SEDMLCodeFactory.selectionsForTask() ### Description Gets selections for a task. ### Method N/A (Python method) ### Endpoint N/A ### Parameters No parameters documented. ### Request Example N/A ### Response #### Success Response Returns a list of selections. #### Response Example N/A ``` -------------------------------- ### PlottingFigure.getDatasets Source: https://tellurium.readthedocs.io/en/latest/_apidoc/tellurium.plotting.html Get an iterable of all datasets. ```APIDOC ## PlottingFigure.getDatasets ### Description Get an iterable of all datasets. ### Method getDatasets ### Signature getDatasets() ``` -------------------------------- ### Define a simple module Source: https://tellurium.readthedocs.io/en/latest/antimony.html Minimal module definition using 'model' and 'end' keywords. The module name is 'example'. ```antimony model example S + E -> ES; end ``` -------------------------------- ### Using a module with renamed symbols Source: https://tellurium.readthedocs.io/en/latest/antimony.html Shows how to instantiate a module with new symbol names, equivalent to writing two 'is' declarations. ```antimony A: side_reaction(spec2, k2); ``` ```antimony A.S is spec2; A.k1 is k2; ``` -------------------------------- ### getStrings() Source: https://tellurium.readthedocs.io/en/latest/genindex.html Method of Accumulator to get strings. ```APIDOC ## getStrings() ### Description Retrieves the accumulated strings. ### Method GET ### Endpoint Accumulator.getStrings() ### Parameters None ### Response #### Success Response - **strings** (list) - List of strings. #### Response Example ``` ['string1', 'string2'] ``` ``` -------------------------------- ### ODEExtractor.__init__ method Source: https://tellurium.readthedocs.io/en/latest/_modules/tellurium/utils/misc.html Initializes the ODEExtractor by importing libsbml (or tesbml as fallback), parsing the SBML string, and building species and reaction accumulators. ```python def __init__(self, sbmlStr): try: try: import libsbml except ImportError: import tesbml as libsbml except ImportError: raise Exception("Cannot import libsbml. Try tellurium.installPackage('libsbml')") self.doc = libsbml.readSBMLFromString (sbmlStr) self.model = self.doc.getModel() self.species_map = {} self.species_symbol_map = {} self.use_species_names = False self.use_ids = True self.accumulators = {} self.accumulator_list = [] def reactionParticipant(participant, stoich): stoich_sign = 1 if stoich < 0: stoich_sign = -1 if participant.isSetStoichiometry(): stoich = participant.getStoichiometry() elif participant.isSetStoichiometryMath(): raise RuntimeError('Stoichiometry math not supported') self.accumulators[participant.getSpecies()].addReaction(r, stoich_sign*stoich) newReactant = lambda p: reactionParticipant(p, -1) newProduct = lambda p: reactionParticipant(p, 1) for s in (self.model.getSpecies(i) for i in range(self.model.getNumSpecies())): self.species_map[s.getId()] = s if s.isSetName() and self.use_species_names: self.species_symbol_map[s.getId()] = s.getName() else: self.species_symbol_map[s.getId()] = s.getId() a = Accumulator(s.getId()) self.accumulators[s.getId()] = a self.accumulator_list.append(a) for r in (self.model.getReaction(i) for i in range(self.model.getNumReactions())): for reactant in (r.getReactant(i) for i in range(r.getNumReactants())): newReactant(reactant) for product in (r.getProduct(i) for i in range(r.getNumProducts())): newProduct(product) ``` -------------------------------- ### ExtendedRoadRunner.dv() Source: https://tellurium.readthedocs.io/en/latest/genindex.html Method to get the derivative values. ```APIDOC ## ExtendedRoadRunner.dv() ### Description Method to get the derivative values. ### Method `dv()` ### Class `tellurium.roadrunner.extended_roadrunner.ExtendedRoadRunner` ``` -------------------------------- ### getLocationsByFormat() Source: https://tellurium.readthedocs.io/en/latest/_apidoc/tellurium.html Gets locations of entries by format. ```APIDOC ## getLocationsByFormat() ### Description Gets locations of entries by format. ### Method Function call ### Endpoint `tellurium.utils.omex.getLocationsByFormat` ### Parameters No parameters documented. ### Request Example No request example available. ### Response No response documented. ``` -------------------------------- ### Complete Antimony model with initial conditions Source: https://tellurium.readthedocs.io/en/latest/antimony.html Adds initial values for species and parameters to the basic reaction, making the model simulatable. The equals sign sets initial conditions. ```antimony S1 -> S2; k1*S1 S1 = 10 S2 = 0 k1 = 0.1 ``` -------------------------------- ### PlottingFigure.getMergedTaggedDatasets Source: https://tellurium.readthedocs.io/en/latest/_apidoc/tellurium.plotting.html Get merged tagged datasets. ```APIDOC ## PlottingFigure.getMergedTaggedDatasets ### Description Get merged tagged datasets. ### Method getMergedTaggedDatasets ### Signature getMergedTaggedDatasets() ``` -------------------------------- ### Antimony rate laws and initialization Source: https://tellurium.readthedocs.io/en/latest/antimony.html Shows a model with various rate laws (mass-action, reversible, Michaelis-Menten, Hill) and initial values for species and parameters. ```antimony model pathway() # Examples of different rate laws and initialization S1 -> S2; k1*S1 S2 -> S3; k2*S2 - k3*S3 S3 -> S4; Vm*S3/(Km + S3) S4 -> S5; Vm*S4^n/(Km + S4)^n S1 = 10 S2 = 0 S3 = 0 S4 = 0 S5 = 0 k1 = 0.1 k2 = 0.2 k3 = 0.2 Vm = 6.7 Km = 1E-3 n = 4 end ``` -------------------------------- ### getFunctionStartRegex function Source: https://tellurium.readthedocs.io/en/latest/_modules/tellurium/teconverters/antimony_regex.html Returns a regex string that matches the start of an Antimony function definition on a whole line. The pattern allows optional whitespace, the 'function' keyword, a function name, optional parentheses, and optional comments starting with '#' or '//'. ```python def getFunctionStartRegex(): """ Return the regex string for Antimony model start. Matches whole line. """ return r'^\s*function\s*([^()]*)\s*(\([^)]*\))?\s*((#|(//)).*)?$' ``` -------------------------------- ### Load test model, get SBML, and convert to Antimony Source: https://tellurium.readthedocs.io/en/latest/tellurium_methods.html Shows how to load a test model, simulate and plot it, obtain its SBML, and convert the SBML to Antimony form. The output is the Antimony representation of the feedback model. ```python # To load one of the test models use loadTestModel: # r = te.loadTestModel('feedback.xml') # result = r.simulate (0, 10, 100) # r.plot (result) # If you need to obtain the SBML for the test model, use getTestModel sbml = te.getTestModel('feedback.xml') # To look at one of the test model in Antimony form: ant = te.sbmlToAntimony(te.getTestModel('feedback.xml')) print(ant) ``` ```text // Created by libAntimony v2.9.4 model *feedback() // Compartments and Species: compartment compartment_; species S1 in compartment_, S2 in compartment_, S3 in compartment_, S4 in compartment_; species $X0 in compartment_, $X1 in compartment_; // Reactions: J0: $X0 => S1; J0_VM1*(X0 - S1/J0_Keq1)/(1 + X0 + S1 + S4^J0_h); J1: S1 => S2; (10*S1 - 2*S2)/(1 + S1 + S2); J2: S2 => S3; (10*S2 - 2*S3)/(1 + S2 + S3); J3: S3 => S4; (10*S3 - 2*S4)/(1 + S3 + S4); J4: S4 => $X1; J4_V4*S4/(J4_KS4 + S4); // Species initializations: S1 = 0; S2 = 0; S3 = 0; S4 = 0; X0 = 10; X1 = 0; // Compartment initializations: compartment_ = 1; // Variable initializations: J0_VM1 = 10; J0_Keq1 = 10; J0_h = 10; J4_V4 = 2.5; J4_KS4 = 0.5; // Other declarations: const compartment_, J0_VM1, J0_Keq1, J0_h, J4_V4, J4_KS4; end ``` -------------------------------- ### Enable layout with model.layout = on Source: https://tellurium.readthedocs.io/en/latest/antimony.html Turns on the single supported Layout, invoking autolayout and applying default colors and styles. Not needed if any other visualization options are set; setting to 'off' is an error. ```antimony model.layout = on ``` -------------------------------- ### getModelStartRegex function Source: https://tellurium.readthedocs.io/en/latest/_modules/tellurium/teconverters/antimony_regex.html Returns a regex string that matches the start of an Antimony model definition on a whole line. The pattern allows optional whitespace, an asterisk, the 'model' keyword, a model name, optional parentheses, and optional comments starting with '#' or '//'. ```python def getModelStartRegex(): """ Return the regex string for Antimony model start. Matches whole line. """ return r'^\s*\*?\s*model\s*[^()\s]+\s*(\([^)]*\))?\s*((#|(//)).*)?$' ``` -------------------------------- ### getSeed() Source: https://tellurium.readthedocs.io/en/latest/genindex.html Method of ExtendedRoadRunner to get the random seed. ```APIDOC ## getSeed() ### Description Retrieves the current random seed used for stochastic simulations. ### Method GET ### Endpoint ExtendedRoadRunner.getSeed() ### Parameters None ### Response #### Success Response - **seed** (int) - The random seed. #### Response Example ``` 12345 ``` ``` -------------------------------- ### getLastReport() Source: https://tellurium.readthedocs.io/en/latest/_apidoc/tellurium.html Gets the last report generated by SED-ML. ```APIDOC ## getLastReport() ### Description Gets the last report generated by SED-ML. ### Method Function call ### Endpoint `tellurium.tellurium.getLastReport()` ### Parameters None ### Response Returns the last report object. ``` -------------------------------- ### Resulting reactions from nested modules Source: https://tellurium.readthedocs.io/en/latest/antimony.html Shows the reactions and initial condition resulting from the previous example3 model. The submodule 'C' contains its own submodule 'A'. ```antimony A.S + A.E -> A.ES B.S + B.E -> B.ES C.A.S + C.A.E -> C.A.ES C.A.S = 3; ``` -------------------------------- ### SEDMLCodeFactory.getOrderedSubtasks() Source: https://tellurium.readthedocs.io/en/latest/_apidoc/tellurium.html Gets ordered subtasks from a repeated task. ```APIDOC ## SEDMLCodeFactory.getOrderedSubtasks() ### Description Gets ordered subtasks from a repeated task. ### Method N/A (Python method) ### Endpoint N/A ### Parameters No parameters documented. ### Request Example N/A ### Response #### Success Response Returns a list of ordered subtasks. #### Response Example N/A ```