def executeOmex(self): '''Executes this Omex instance.''' import phrasedml phrasedml.clearReferencedSBML() workingDir = tempfile.mkdtemp(suffix="_sedml") self.writeFiles(workingDir) from tellurium import executeSEDML for sedml_asset in self.getSedmlAssets(): if sedml_asset.getMaster(): sedml_path = os.path.join(workingDir, sedml_asset.getLocation()) executeSEDML(sedml_path, workingDir=os.path.dirname(sedml_path))
def executeOmex(self): """ Executes this Omex instance. :return: """ import phrasedml phrasedml.clearReferencedSBML() workingDir = tempfile.mkdtemp(suffix="_sedml") self.writeFiles(workingDir) from tellurium import executeSEDML for sedml_asset in self.getSedmlAssets(): if sedml_asset.getMaster(): sedml_path = os.path.join(workingDir, sedml_asset.getLocation()) executeSEDML(sedml_path, workingDir=os.path.dirname(sedml_path))
plot "Figure 1.3 Timecourse after post-processing" task1.PX/max(task1.PX) vs task1.PZ/max(task1.PZ), \ task1.PY/max(task1.PY) vs task1.PX/max(task1.PX), \ task1.PZ/max(task1.PZ) vs task1.PY/max(task1.PY) """.format(urn) # convert to SED-ML sedmlStr = phrasedml.convertString(phrasedmlStr) if sedmlStr == None: print(phrasedml.getLastError()) # Run the SED-ML file with results written in workingDir import tempfile import shutil workingDir = tempfile.mkdtemp(suffix="_sedml") te.executeSEDML(sedmlStr, workingDir=workingDir) shutil.rmtree(workingDir) # ### Execute Combine Archive # Executing the SED-ML from a combine archive. # In[2]: import tellurium as te from tellurium.tests.testdata import sedxDir import os omexPath = os.path.join(sedxDir, "BIOMD0000000003.sedx") print(omexPath) te.executeSEDML(omexPath)
import re import os import matplotlib # switch the backend of matplotlib, so plots can be tested matplotlib.pyplot.switch_backend("Agg") # location of test cases CASES_DIRECTORY = os.path.join(".", 'testdata', 'sbml-test-cases-2014-10-22') # find all L3V1 SEDML files pattern = re.compile("""^\d{5}-sbml-l3v1-sedml.xml$""") matches = [] for root, dirnames, filenames in os.walk(CASES_DIRECTORY): for filename in filenames: if pattern.match(filename): matches.append(os.path.join(root, filename)) matches = sorted(matches) # execute the SEDML import tellurium as te for match in matches: print(match) try: te.executeSEDML(match) except RuntimeError: print("RUNTIME ERROR: {}".format(match)) pass
# Applying postprocessing plot "Figure 1.3 Timecourse after post-processing" task1.PX/max(task1.PX) vs task1.PZ/max(task1.PZ), \ task1.PY/max(task1.PY) vs task1.PX/max(task1.PX), \ task1.PZ/max(task1.PZ) vs task1.PY/max(task1.PY) """.format(urn) # convert to SED-ML sedmlStr = phrasedml.convertString(phrasedmlStr) if sedmlStr == None: print(phrasedml.getLastError()) # Run the SED-ML file with results written in workingDir import tempfile import shutil workingDir = tempfile.mkdtemp(suffix="_sedml") te.executeSEDML(sedmlStr, workingDir=workingDir) shutil.rmtree(workingDir) # ### Execute Combine Archive # Executing the SED-ML from a combine archive. # In[2]: import tellurium as te from tellurium.tests.testdata import sedxDir import os omexPath = os.path.join(sedxDir, "BIOMD0000000003.sedx") print(omexPath) te.executeSEDML(omexPath)
plot "Figure 1.3 Timecourse after post-processing" task1.PX/max(task1.PX) vs task1.PZ/max(task1.PZ), \ task1.PY/max(task1.PY) vs task1.PX/max(task1.PX), \ task1.PZ/max(task1.PZ) vs task1.PY/max(task1.PY) """.format(urn) # [1] convert to SED-ML & run # convert to SED-ML sedmlStr = phrasedml.convertString(phrasedmlStr) if sedmlStr == None: print(phrasedml.getLastError()) # Run the SED-ML file with results written in workingDir import tempfile import shutil workingDir = tempfile.mkdtemp(suffix="_sedml") te.executeSEDML(sedmlStr, workingDir=workingDir) shutil.rmtree(workingDir) # [2] store as combine archive and run import os from tellurium.tecombine import CombineArchive combine = CombineArchive() combine.addSEDMLStr(sedmlStr, 'specificationL1V2.sedml') from tellurium.tests.testdata import sedxDir combinePath = os.path.join(sedxDir, 'specificationL1V2.sedx') combine.write(combinePath) # Run Combine archive te.executeSEDML(combinePath) # remove sedx (not hashable due to timestamp)
plot "Figure 1.3 Timecourse after post-processing" task1.PX/max(task1.PX) vs task1.PZ/max(task1.PZ), \ task1.PY/max(task1.PY) vs task1.PX/max(task1.PX), \ task1.PZ/max(task1.PZ) vs task1.PY/max(task1.PY) """.format(urn) # [1] convert to SED-ML & run # convert to SED-ML sedmlStr = phrasedml.convertString(phrasedmlStr) if sedmlStr == None: print(phrasedml.getLastError()) # Run the SED-ML file with results written in workingDir import tempfile import shutil workingDir = tempfile.mkdtemp(suffix="_sedml") te.executeSEDML(sedmlStr, workingDir=workingDir) shutil.rmtree(workingDir) # [2] store as combine archive and run import os from tellurium.tecombine import CombineArchive combine = CombineArchive() combine.addSEDMLStr(sedmlStr, 'specificationL1V2.sedml') from tellurium.tests.testdata import sedxDir combinePath = os.path.join(sedxDir, 'specificationL1V2.sedx') combine.write(combinePath) # Run Combine archive te.executeSEDML(combinePath)