Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
model myModel
S1 -> S2; k1*S1
S1 = 10; S2 = 0
k1 = 1
end
'''
phrasedml = '''
model1 = model "myModel"
sim1 = simulate uniform(0, 5, 100)
task1 = run sim1 on model1
plot "Figure 1" time vs S1, S2
'''
# create an experiment
exp = te.experiment(antimony, phrasedml)
# execute it
exp.execute(phrasedml)
# print python code
exp.printPython(phrasedml)
# ### OneStep
# Running a one step simulation.
# In[4]:
import tellurium as te
antimonyStr = '''
// Created by libAntimony v2.9
model *oneStep()
// Other declarations:
const compartment_, J0_v0, J1_k3, J2_k1, J2_k_1, J2_c, J2_q, J3_k2;
end
'''
phrasedmlStr = '''
model1 = model "parameterScan1D"
timecourse1 = simulate uniform(0, 20, 1000)
task0 = run timecourse1 on model1
task1 = repeat task0 for J0_v0 in [8, 4, 0.4], reset=true
plot task1.time vs task1.S1, task1.S2
'''
# phrasedml experiment
exp = te.experiment(antimonyStr, phrasedmlStr)
exp.execute(phrasedmlStr)
# ### parameterScan2D
# 2D parameter scan
# In[6]:
import tellurium as te
antimonyStr = '''
// Created by libAntimony v2.9
model *parameterScan2D()
// Compartments and Species:
compartment compartment_;
end
"""
phrasedmlStr = """
model0 = model "case_02"
model1 = model model0 with S1=5.0
sim0 = simulate uniform(0, 6, 100)
task0 = run sim0 on model1
task1 = repeat task0 for k1 in uniform(0.0, 5.0, 5), reset = true
plot "Repeated task with reset" task1.time vs task1.S1, task1.S2
plot "Repeated task varying k1" task1.k1 vs task1.S1
# report task1.time vs task1.S1, task1.S2
"""
# phrasedml experiment
exp = te.experiment(antimonyStr, phrasedmlStr)
exp.execute(phrasedmlStr)
# ### outputPlot3D
# Oscillations of MAPK pathway.
# In[9]:
import tellurium as te
antimonyStr = '''
// Created by libAntimony v2.9
model *case_09()
// Compartments and Species:
compartment compartment_;
model myModel
S1 -> S2; k1*S1
S1 = 10; S2 = 0
k1 = 1
end
'''
phrasedml = '''
model1 = model "myModel"
sim1 = simulate uniform(0, 5, 100)
task1 = run sim1 on model1
plot "Figure 1" time vs S1, S2
'''
# create an experiment
exp = te.experiment(antimony, phrasedml)
# execute it
exp.execute(phrasedml)
# print python code
exp.printPython(phrasedml)
# ### OneStep
# Running a one step simulation.
# In[4]:
import tellurium as te
antimonyStr = '''
// Created by libAntimony v2.9
model *oneStep()
end
"""
phrasedmlStr = """
model0 = model "case_02"
model1 = model model0 with S1=5.0
sim0 = simulate uniform(0, 6, 100)
task0 = run sim0 on model1
task1 = repeat task0 for k1 in uniform(0.0, 5.0, 5), reset = true
plot "Repeated task with reset" task1.time vs task1.S1, task1.S2
plot "Repeated task varying k1" task1.k1 vs task1.S1
# report task1.time vs task1.S1, task1.S2
"""
# phrasedml experiment
exp = te.experiment(antimonyStr, phrasedmlStr)
exp.execute(phrasedmlStr)
# ### outputPlot3D
# Oscillations of MAPK pathway.
# In[9]:
import tellurium as te
antimonyStr = '''
// Created by libAntimony v2.9
model *case_09()
// Compartments and Species:
compartment compartment_;
const J7_KK8, J8_V9, J8_KK9, J9_V10, J9_KK10;
end
'''
phrasedmlStr = '''
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
'''
# phrasedml experiment
exp = te.experiment(antimonyStr, phrasedmlStr)
exp.execute(phrasedmlStr)
model myModel
S1 -> S2; k1*S1
S1 = 10; S2 = 0
k1 = 1
end
'''
phrasedml = '''
model1 = model "myModel"
sim1 = simulate uniform(0, 5, 100)
task1 = run sim1 on model1
plot "Figure 1" time vs S1, S2
'''
# create experiment
exp = te.experiment(ant, phrasedml)
exp.execute()
exp.printPython()
phrasedmlStr = '''
model1 = model "repeatedStochastic"
timecourse1 = simulate uniform_stochastic(0, 4000, 1000)
timecourse1.algorithm.seed = 1003
timecourse2 = simulate uniform_stochastic(0, 4000, 1000)
task1 = run timecourse1 on model1
task2 = run timecourse2 on model1
repeat1 = repeat task1 for local.x in uniform(0, 10, 10), reset=true
repeat2 = repeat task2 for local.x in uniform(0, 10, 10), reset=true
plot "Repeats with SEED" repeat1.time vs repeat1.MAPK, repeat1.MAPK_P, repeat1.MAPK_PP, repeat1.MKK, repeat1.MKK_P, repeat1.MKKK, repeat1.MKKK_P
plot "Repeates without SEED" repeat2.time vs repeat2.MAPK, repeat2.MAPK_P, repeat2.MAPK_PP, repeat2.MKK, repeat2.MKK_P, repeat2.MKKK, repeat2.MKKK_P
'''
# phrasedml experiment
exp = te.experiment(antimonyStr, phrasedmlStr)
exp.execute(phrasedmlStr)
# ### Case 02
# Perform repeated simulation after change of initial concentration to model.
# Within every repeat the value of a parameter k1 is changed.
# The model is reset after every repeat.
# In[8]:
import tellurium as te
antimonyStr = """
model case_02
J0: S1 -> S2; k1*S1;
S1 = 10.0; S2=0.0;
const J7_KK8, J8_V9, J8_KK9, J9_V10, J9_KK10;
end
'''
phrasedmlStr = '''
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
'''
# phrasedml experiment
exp = te.experiment(antimonyStr, phrasedmlStr)
exp.execute(phrasedmlStr)
# ### Combine Archive
# The experiment, i.e. model with the simulation description, can be stored as Combine Archive.
# In[10]:
# create Combine Archive
import tempfile
f = tempfile.NamedTemporaryFile()
exp.exportAsCombine(f.name)
# print the content of the Combine Archive
import zipfile
zip=zipfile.ZipFile(f.name)