def checkStoichiometryMatrix(testId): # Stoichiometry matrix print string.ljust("Check " + testId, rpadding), errorFlag = False m = rrPython.getNumberOfFloatingSpecies() n = rrPython.getNumberOfReactions() st = rrPython.getStoichiometryMatrix() for i in range(0, m): line = readLine() words = line.split() for j in range(0, n): if expectApproximately(float(words[j]), st[i, j], 1E-6) == False: errorFlag = True break print passMsg(errorFlag)
def checkStoichiometryMatrix(testId): # Stoichiometry matrix print string.ljust ("Check " + testId, rpadding), errorFlag = False m = rrPython.getNumberOfFloatingSpecies() n = rrPython.getNumberOfReactions(); st = rrPython.getStoichiometryMatrix() for i in range(0,m): line = readLine () words = line.split() for j in range(0,n): if expectApproximately(float (words[j]), st[i,j], 1E-6) == False: errorFlag = True break print passMsg (errorFlag)
import rrPython import os import csv os.chdir('C:\\RoadRunner\\bin') function = 'getStoichiometryMatrix' rrPython.loadSBMLFromFile('C:\\RoadRunner\\Models\\feedback.xml') try: matrix = rrPython.getStoichiometryMatrix() if str(matrix) 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()
import rrPython modelPath = ('C:\\RoadRunner\\Models\\feedback.xml') rrPython.loadSBMLFromFile(modelPath) matrix = rrPython.getStoichiometryMatrix() print matrix