本文整理汇总了Python中tellurium.loadSBMLModel函数的典型用法代码示例。如果您正苦于以下问题:Python loadSBMLModel函数的具体用法?Python loadSBMLModel怎么用?Python loadSBMLModel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了loadSBMLModel函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: spark_work
def spark_work(model_with_parameters):
import tellurium as te
if(antimony == "antimony"):
model_roadrunner = te.loada(model_with_parameters[0])
else:
model_roadrunner = te.loadSBMLModel(model_with_parameters[0])
parameter_scan_initilisation = te.ParameterScan(model_roadrunner,**model_with_parameters[1])
simulator = getattr(parameter_scan_initilisation, function_name)
return(simulator())
示例2: test_roadrunner
def test_roadrunner(self):
# load test model as SBML
sbml = te.getTestModel('feedback.xml')
rr = te.loadSBMLModel(sbml)
# simulate
s = rr.simulate(0, 100.0, 200)
rr.plot(s)
self.assertIsNotNone(rr)
self.assertIsNotNone(s)
self.assertEqual(s.shape[0], 200)
self.assertEqual(s["time"][0], 0)
self.assertAlmostEqual(s["time"][-1], 100.0)
示例3: test_roadrunner
def test_roadrunner(self):
# load test model as SBML
from tellurium.tests.testdata import FEEDBACK_SBML
# sbml = te.getTestModel('feedback.xml')
rr = te.loadSBMLModel(FEEDBACK_SBML)
# simulate
s = rr.simulate(0, 100.0, 200)
rr.plot(s)
self.assertIsNotNone(rr)
self.assertIsNotNone(s)
self.assertEqual(s.shape[0], 200)
self.assertEqual(s["time"][0], 0)
self.assertAlmostEqual(s["time"][-1], 100.0)
示例4: stochastic_work
def stochastic_work(model_object):
import tellurium as te
if model_type == "antimony":
model_roadrunner = te.loada(model_object.model)
else:
model_roadrunner = te.loadSBMLModel(model_object.model)
model_roadrunner.integrator = model_object.integrator
# seed the randint method with the current time
random.seed()
# it is now safe to use random.randint
model_roadrunner.setSeed(random.randint(1000, 99999))
model_roadrunner.integrator.variable_step_size = model_object.variable_step_size
model_roadrunner.reset()
simulated_data = model_roadrunner.simulate(model_object.from_time, model_object.to_time, model_object.step_points)
return([simulated_data.colnames,np.array(simulated_data)])
示例5:
import tellurium as te
from tellurium.sedml.mathml import *
import numpy as np
import matplotlib.pyplot as plt
import mpl_toolkits.mplot3d
import libsedml
import pandas
import os.path
workingDir = "/home/mkoenig/git/tellurium/tellurium/tests/testdata/sedml/sedx/_te_BM12"
# --------------------------------------------------------
# Models
# --------------------------------------------------------
# Model <model1>
model1 = te.loadSBMLModel(os.path.join(workingDir, "model1.xml"))
# --------------------------------------------------------
# Tasks
# --------------------------------------------------------
# Task <task1>
# Task: <task1>
task1 = [None]
model1.setIntegrator("cvode")
model1.timeCourseSelections = ["[Z]", "[X]", "[Y]", "time"]
task1[0] = model1.simulate(start=0.0, end=100.0, steps=1000)
# --------------------------------------------------------
# DataGenerators
# --------------------------------------------------------
# DataGenerator <time>
示例6:
import tellurium as te
from tellurium.sedml.mathml import *
import numpy as np
import matplotlib.pyplot as plt
import mpl_toolkits.mplot3d
import libsedml
import pandas
import os.path
workingDir = '/home/mkoenig/git/tellurium/tellurium/tests/testdata/sedml/sed-ml'
# --------------------------------------------------------
# Models
# --------------------------------------------------------
# Model <model1>
model1 = te.loadSBMLModel(os.path.join(workingDir, '../models/BorisEJB.xml'))
# --------------------------------------------------------
# Tasks
# --------------------------------------------------------
# Task <task1>
# Task: <task1>
task1 = [None]
model1.setIntegrator('cvode')
model1.conservedMoietyAnalysis = True
model1.steadyStateSelections = ['[MKKK]', '[MKKK_P]', '[MAPK]', '[MAPK_PP]', '[MKK_P]', '[MAPK_P]', 'time', '[MKK]']
model1.simulate()
task1[0] = model1.steadyState()
model1.conservedMoietyAnalysis = False
# --------------------------------------------------------
示例7:
import tellurium as te
from tellurium.sedml.mathml import *
import numpy as np
import matplotlib.pyplot as plt
import mpl_toolkits.mplot3d
import libsedml
import pandas
import os.path
workingDir = '/home/mkoenig/git/tellurium/tellurium/tests/testdata/sedml/sed-ml'
# --------------------------------------------------------
# Models
# --------------------------------------------------------
# Model <model1>
model1 = te.loadSBMLModel(os.path.join(workingDir, '../models/curien.xml'))
# --------------------------------------------------------
# Tasks
# --------------------------------------------------------
# Task <task1>
# Task: <task1>
task1 = [None]
model1.setIntegrator('cvode')
model1.timeCourseSelections = ['[Phser]', 'time']
task1[0] = model1.simulate(start=0.0, end=500.0, steps=500)
# --------------------------------------------------------
# DataGenerators
# --------------------------------------------------------
# DataGenerator <time>
示例8: enumerate
from tellurium.sedml.mathml import *
import numpy as np
import matplotlib.pyplot as plt
import mpl_toolkits.mplot3d
import libsedml
import pandas
import os.path
Config.LOADSBMLOPTIONS_RECOMPILE = True
workingDir = '/home/mkoenig/git/tellurium/examples/tellurium-files/phrasedml/_te_oneStep'
# --------------------------------------------------------
# Models
# --------------------------------------------------------
# Model <model1>
model1 = te.loadSBMLModel(os.path.join(workingDir, 'oneStep.xml'))
# --------------------------------------------------------
# Tasks
# --------------------------------------------------------
# Task <task0>
# not part of any DataGenerator: task0
# Task <task1>
task1 = []
__range__x = np.linspace(start=0.0, stop=10.0, num=101)
for __k__x, __value__x in enumerate(__range__x):
if __k__x == 0:
model1.reset()
# Task: <task0>
示例9:
# coding: utf-8
# Back to the main [Index](../index.ipynb)
# ### Model loading from BioModels
# Models can be easily retrieved from BioModels via their identifier.
# In[1]:
#!!! DO NOT CHANGE !!! THIS FILE WAS CREATED AUTOMATICALLY FROM NOTEBOOKS !!! CHANGES WILL BE OVERWRITTEN !!! CHANGE CORRESPONDING NOTEBOOK FILE !!!
from __future__ import print_function
import tellurium as te
# Load model from biomodels.
r = te.loadSBMLModel("http://www.ebi.ac.uk/biomodels-main/download?mid=BIOMD0000000010")
result = r.simulate(0, 3000, 5000)
r.plot(result);
# In[2]:
示例10: test_loadSBMLModel_file
def test_loadSBMLModel_file(self):
r = te.loadSBMLModel(self.sbml_file)
self.assertIsNotNone(r)
示例11:
import tellurium as te
from tellurium.sedml.mathml import *
import numpy as np
import matplotlib.pyplot as plt
import mpl_toolkits.mplot3d
import libsedml
import pandas
import os.path
workingDir = '/home/mkoenig/git/tellurium/tellurium/tests/testdata/sedml/sedx/_te_ClockSedML'
# --------------------------------------------------------
# Models
# --------------------------------------------------------
# Model <model1>
model1 = te.loadSBMLModel(os.path.join(workingDir, 'Clock_BIOMD21.xml'))
# Model <model2>
model2 = te.loadSBMLModel(os.path.join(workingDir, 'Clock_BIOMD21.xml'))
# /sbml:sbml/sbml:model/sbml:listOfParameters/sbml:parameter[@id='V_dT']/@value 4.8
model2['V_dT'] = 4.8
# /sbml:sbml/sbml:model/sbml:listOfParameters/sbml:parameter[@id='V_mT']/@value 0.28
model2['V_mT'] = 0.28
# --------------------------------------------------------
# Tasks
# --------------------------------------------------------
# Task <task1>
# Task: <task1>
task1 = [None]
model1.setIntegrator('cvode')
model1.timeCourseSelections = ['[Mt]', 'time']
示例12:
from tellurium.sedml.mathml import *
import numpy as np
import matplotlib.pyplot as plt
import mpl_toolkits.mplot3d
import libsedml
import pandas
import os.path
Config.LOADSBMLOPTIONS_RECOMPILE = True
workingDir = r'/home/mkoenig/git/tellurium/tellurium/tests/testdata/sedml/sed-ml'
# --------------------------------------------------------
# Models
# --------------------------------------------------------
# Model <Application0>
Application0 = te.loadSBMLModel(os.path.join(workingDir, '../models/app2sim.xml'))
# Model <Application0_0>
Application0_0 = te.loadSBMLModel(os.path.join(workingDir, '../models/app2sim.xml'))
# /sbml:sbml/sbml:model/sbml:listOfSpecies/sbml:species[@id='s1'] 10.0
Application0_0['init([s1])'] = 10.0
# --------------------------------------------------------
# Tasks
# --------------------------------------------------------
# Task <task_0_0>
# Task: <task_0_0>
task_0_0 = [None]
Application0.setIntegrator('cvode')
Application0.timeCourseSelections = ['[s0]', '[s1]', 'time']
task_0_0[0] = Application0.simulate(start=0.0, end=20.0, steps=1000)
示例13: str
elif i[3] == 0:
m.addReaction(["S" + str(i[0]), "S" + str(i[1])],
["S" + str(i[2])], "k" + str(count) + "*S" +
str(i[0]) + "*S" + str(i[1]))
elif i[1] == 0:
m.addReaction(["S" + str(i[0])], ["S" + str(i[1]),
"S" + str(i[2])], "k" + str(count) + "*S" +
str(i[0]))
else:
m.addReaction(["S" + str(i[0]), "S" + str(i[1])], ["S" + str(i[2]),
"S" + str(i[3])], "k" + str(count) + "*S" +
str(i[0]) + "*S" + str(i[1]))
te.saveToFile('ProteinModel.xml', str(m))
r = te.loadSBMLModel('ProteinModel.xml')
try:
if forbidZeros:
r.simulate()
for i in r.getSteadyStateValues():
if i < 1e-5:
raise ValueError
r.simulate(end=1000)
steady = r.steadyState()
if steady < 10e-6:
print "Success!"
print ("Number of tries = " + str(zcount))
zcount = 0
for i in data:
zcount += 1
示例14:
from __future__ import print_function, division
import libsbml
import tellurium as te
import lxml.etree as ET
from io import StringIO
import tempfile
r = te.loada('''
J0: S1 -> S2; k1*S1;
S1=10.0; S2=0.0; k1=1.0;
''')
# create SBML file
f = tempfile.NamedTemporaryFile('w', suffix=".xml")
r.exportToSBML(f.name)
# create C14N canonical XML
et = ET.parse(f.name)
output = StringIO.StringIO()
et.write_c14n(output)
c14n_xml = output.getvalue()
# TODO: in addition sort all elements of the listOfs
# read with libsbml
doc = libsbml.readSBMLFromString(c14n_xml)
# read with roadrunner
te.loadSBMLModel(c14n_xml)
示例15: test_loadSBMLModel_str
def test_loadSBMLModel_str(self):
r = te.loadSBMLModel(self.sbml_str)
self.assertIsNotNone(r)