コード例 #1
0
def runTester(pathToModels, testModel):
    global fHandle
    global sbmlStr
    global JarnacStr

    print "Starting Tester on ", testModel

    sys.path.append(pathToModels)
    #print 'Version: ', rrPython.getVersion()
    #print 'Build Date: ', rrPython.getBuildDate()
    #print 'Copyright Message: ', rrPython.getCopyright()

    fHandle = open(pathToModels + testModel, 'r')

    sbmlStr = loadSBMLModelFromTestFile()
    JarnacStr = loadJarnacModelFromTestFile()

    print "\n", "Info:" + "\n"

    rrPython.enableLogging()
    info = rrPython.getInfo()
    for item in info:
        print item
    print

    # Load any initialization actions
    testId = jumpToNextTest()
    if testId == '[INITIALIZATION]':
        testId = jumpToNextTest()
        while testId != '[END_INITIALIZATION]':
            if functions.has_key(testId):
                func = functions[testId]
                func(testId)
            else:
                print 'No initialization function found for ' + testId
            testId = jumpToNextTest()

    # Load the model into RoadRunner
    if rrPython.loadSBML(sbmlStr) == False:
        print 'Failed to load model'
        print rrPython.getLastError()
        sys.exit(-1)

    print rrPython.getuCC('J1', 'k1')
    print rrPython.getuCC('J1', 'k_1')
    print rrPython.getuCC('J1', 'k2')
    print rrPython.getuCC('J1', 'k_2')
    print rrPython.getuCC('J1', 'k3')
    print rrPython.getuCC('J1', 'k_3')
    print rrPython.getuCC('J1', 'k4')
    print rrPython.getuCC('J1', 'k_4')

    # Now start the tests proper
    testId = jumpToNextTest()
    if testId == '[START_TESTS]':
        testId = jumpToNextTest()
        while testId != '[END_TESTS]':
            if functions.has_key(testId):
                func = functions[testId]
                func(testId)
            else:
                print string.ljust(testId, rpadding), 'NO TEST'
            testId = jumpToNextTest()
    else:
        print 'No Tests found'

    scriptTests()
コード例 #2
0
import rrPython
import numpy
import matplotlib.pyplot as plot

model = open('C:\\roadRunner\\models\\feedback.xml', 'r').read()
rrPython.loadSBML(model)
timeStart = 0.0
timeEnd = 10.0
numPoints = 50
results = rrPython.simulateEx(timeStart, timeEnd, numPoints)
print results

S1 = results[:,2]
S2 = results[:,3]
S3 = results[:,4]
x = numpy.arange(timeStart, timeEnd, (timeEnd - timeStart)/numPoints)
plot.plot(x, S1, label="S1")
plot.plot(x, S2, label="S2")
plot.plot(x, S3, label="S3")
plot.legend(bbox_to_anchor=(1.05, 1), loc=5, borderaxespad=0.)
plot.ylabel('Concentration (moles/L)')
plot.xlabel('time (s)')

plot.show()
コード例 #3
0
import rrPython
import os
import csv
os.chdir('C:\\RoadRunner\\bin')

function = 'writeSBML'
rrPython.loadSBML('abc123')
try:
    sbml = rrPython.writeSBML()
    if str(sbml) is not False:
        result = 'True'
    else:
        result = 'False'
except:
    result = 'False'

PythonTestResults = open('C:\\RoadRunner\\PythonTestResults.csv', 'a')
writer = csv.writer(PythonTestResults)
writevar = function + '=' + result
writer.writerow([writevar])
PythonTestResults.close()
コード例 #4
0
ファイル: rrTester.py プロジェクト: TotteKarlsson/roadrunner
def runTester (pathToModels, testModel):
    global fHandle
    global sbmlStr
    global JarnacStr

    print "Starting Tester on ", testModel

    sys.path.append (pathToModels)
    #print 'Version: ', rrPython.getVersion()
    #print 'Build Date: ', rrPython.getBuildDate()
    #print 'Copyright Message: ', rrPython.getCopyright()

    fHandle = open (pathToModels + testModel, 'r')

    sbmlStr = loadSBMLModelFromTestFile ()
    JarnacStr = loadJarnacModelFromTestFile ()

    print "\n", "Info:"+ "\n"

    rrPython.enableLogging()
    info = rrPython.getInfo()
    for item in info:
        print item
    print

    # Load any initialization actions
    testId = jumpToNextTest()
    if testId == '[INITIALIZATION]':
        testId = jumpToNextTest ()
        while testId != '[END_INITIALIZATION]':
            if functions.has_key(testId):
               func = functions[testId]
               func(testId)
            else:
               print 'No initialization function found for ' + testId
            testId = jumpToNextTest()

    # Load the model into RoadRunner
    if rrPython.loadSBML(sbmlStr) == False:
        print 'Failed to load model'
        print rrPython.getLastError()
        sys.exit(-1)

    print rrPython.getuCC ('J1', 'k1')
    print rrPython.getuCC ('J1', 'k_1')
    print rrPython.getuCC ('J1', 'k2')
    print rrPython.getuCC ('J1', 'k_2')
    print rrPython.getuCC ('J1', 'k3')
    print rrPython.getuCC ('J1', 'k_3')
    print rrPython.getuCC ('J1', 'k4')
    print rrPython.getuCC ('J1', 'k_4')

    # Now start the tests proper
    testId = jumpToNextTest()
    if testId == '[START_TESTS]':
        testId = jumpToNextTest()
        while testId != '[END_TESTS]':
           if functions.has_key(testId):
              func = functions[testId]
              func(testId)
           else:
              print string.ljust (testId, rpadding), 'NO TEST'
           testId = jumpToNextTest()
    else:
      print 'No Tests found'

    scriptTests()
コード例 #5
0
ファイル: loadSBML.py プロジェクト: zafarali/CompuCell3D
import rrPython
import os
import csv
os.chdir('C:\\RoadRunner\\bin')

function = 'loadSBML'
file = open('C:\\RoadRunner\\Models\\feedback.xml','r').read()
#rrPython.loadSBML(file)

try:
    sbml = rrPython.loadSBML(file)
    if str(sbml) is not False:
        result = 'True'
    else:
        result = 'False'
except:
    result = 'False'


PythonTestResults = open('C:\\RoadRunner\\PythonTestResults.csv','a')
writer = csv.writer(PythonTestResults)
writevar = function + '=' + result
writer.writerow([writevar])
PythonTestResults.close()
コード例 #6
0
import rrPython
import numpy
import matplotlib.pyplot as plot

model = open('C:\\roadRunner\\models\\feedback.xml', 'r').read()
rrPython.loadSBML(model)
timeStart = 0.0
timeEnd = 10.0
numPoints = 50
results = rrPython.simulateEx(timeStart, timeEnd, numPoints)
print results

S1 = results[:, 2]
S2 = results[:, 3]
S3 = results[:, 4]
x = numpy.arange(timeStart, timeEnd, (timeEnd - timeStart) / numPoints)
plot.plot(x, S1, label="S1")
plot.plot(x, S2, label="S2")
plot.plot(x, S3, label="S3")
plot.legend(bbox_to_anchor=(1.05, 1), loc=5, borderaxespad=0.)
plot.ylabel('Concentration (moles/L)')
plot.xlabel('time (s)')

plot.show()
コード例 #7
0
ファイル: writeSBML.py プロジェクト: Alcibiades586/roadrunner
import rrPython
import os
import csv
os.chdir('C:\\RoadRunner\\bin')

function = 'writeSBML'
rrPython.loadSBML('abc123')
try:
    sbml = rrPython.writeSBML()
    if str(sbml) is not False:
        result = 'True'
    else:
        result = 'False'
except:
    result = 'False'


PythonTestResults = open('C:\\RoadRunner\\PythonTestResults.csv','a')
writer = csv.writer(PythonTestResults)
writevar = function + '=' + result
writer.writerow([writevar])
PythonTestResults.close()
コード例 #8
0
import csv
import re
import rrPython
path = 'C:/SBML_test_cases/'
os.chdir(path)

it = []#for name of xml file
ip = []#for name of settings file
ic = []#for name of results file
for path, dirs, files in os.walk(os.getcwd()):
    for xml in [os.path.abspath(os.path.join(path, filename)) for filename in files if fnmatch.fnmatch(filename, '*l2v4.xml')]:
        it.append(xml)
        ip.append(xml)
        ic.append(xml)
        f = open(xml,'r').read()
        rrPython.loadSBML(f)
        b = ""
        j=0
        while j<len(it[-1])-13:
            b+=it[-1][j]
            j+=1
        ip[-1]=b+"settings.txt"
        ic[-1]=b+"results.csv"
        concheck = 0 #used later to check if values should be concentrations or amounts
        f=open(ip[-1]) #loading model parameters
        for line in f: # reads all parameters from settings.txt
                text = line.split()
                if len(text) > 0: #checks for something in line
                        if text[0] == 'start:':
                                startTime = float(text[1])
                        if text[0] == 'duration:':
コード例 #9
0
path = 'C:/SBML_test_cases/'
os.chdir(path)

it = []  #for name of xml file
ip = []  #for name of settings file
ic = []  #for name of results file
for path, dirs, files in os.walk(os.getcwd()):
    for xml in [
            os.path.abspath(os.path.join(path, filename)) for filename in files
            if fnmatch.fnmatch(filename, '*l2v4.xml')
    ]:
        it.append(xml)
        ip.append(xml)
        ic.append(xml)
        f = open(xml, 'r').read()
        rrPython.loadSBML(f)
        b = ""
        j = 0
        while j < len(it[-1]) - 13:
            b += it[-1][j]
            j += 1
        ip[-1] = b + "settings.txt"
        ic[-1] = b + "results.csv"
        concheck = 0  #used later to check if values should be concentrations or amounts
        f = open(ip[-1])  #loading model parameters
        for line in f:  # reads all parameters from settings.txt
            text = line.split()
            if len(text) > 0:  #checks for something in line
                if text[0] == 'start:':
                    startTime = float(text[1])
                if text[0] == 'duration:':