import rrPython import os import csv os.chdir('C:\\RoadRunner\\bin') function = 'setSelectionList' rrPython.loadSBMLFromFile('C:\\RoadRunner\\Models\\feedback.xml') try: points = rrPython.setSelectionList('time,S1') if str(points) 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 import os import csv os.chdir("C:\\RoadRunner\\bin") function = "setSelectionList" rrPython.loadSBMLFromFile("C:\\RoadRunner\\Models\\feedback.xml") try: points = rrPython.setSelectionList("time,S1") if str(points) 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()
rrPython.setNumPoints(numberOfPoints) #if concheck == 1: # compvalues = rrPython.getCompartmentByIndex() curtime = ['time'] species = curtime + varlist #i=0 #pattern = re.compile('[\W_]+') #for species[i] in species: # species[i] = pattern.sub('',species[i])#removes non-alphanumeric characters from all variables names. Probably no longer needed. # i+=1 species = str(species).strip("[]") species = species.replace("'", "") species = species.replace(" ", "") rrPython.setSelectionList(species) #rrPython.ComputeAndAssignConservationLaws(0) k = rrPython.simulate() kk = [] kk = k.split('\n') ############The block of code below was used to multiply values by the compartment ############volume to get results in moles instead of concentration where needed #iterate = 0 #if concheck == 1: # for iterate in range(len(kk)): # iterate2 = 1 # kkelement = kk[iterate] # for iterate2 in range(len(kkelement)): # if iterate2 == 0: