Location: Glucose Uptake in Enterocyte @ c052b0c46028 / SEDML_files / Fig06.py

Author:
nima <nafs080@aucklanduni.ac.nz>
Date:
2020-09-30 10:48:46+13:00
Desc:
Renamed the files
Permanent Source URI:
https://models.physiomeproject.org/workspace/572/rawfile/c052b0c460280139dad150937fbee4fa6a026505/SEDML_files/Fig06.py

# To reproduce the data needed for Figure 4 in associated Physiome paper,
# execute this script in the Python console in OpenCOR. This can be done
# with the following commands at the prompt in the OpenCOR Python console:
#
#     In [1]: cd path/to/folder_this_file_is_in
#     In [2]: %run Fig05.py
#

import opencor as opencor
# import numpy as np

Na_m = [0.13, 0.1275, 0.125, 0.1175, 0.11, 0.105]
Cl_m = [0.131, 0.1285, 0.126, 0.1185, 0.111, 0.106]
glucose_m = [0.0, 0.005, 0.01, 0.025, 0.04, 0.05]
#######

#Glucose flux through SGLT
glucose_i = {}

simulation = opencor.open_simulation("https://models.physiomeproject.org/workspace/572/rawfile/59488c15178b09bcb5b11f795383b1435f7b7ef1/SEDML_files/Model.sedml")
data = simulation.data()
data.set_ending_point(600)

for i, glu_m in enumerate(glucose_m):
    # reset everything in case we are running interactively and have existing results
    simulation.reset(True)
    simulation.clear_results()

    data.constants()["Apical_concentrations/Na_m"] = Na_m[i]
    data.constants()["Apical_concentrations/Cl_m"] = Cl_m[i]
    data.constants()["Cell_concentration/theta_26"] = 0  # Apical GLUT2 is turned off
    data.constants()["Apical_concentrations/glucose_m"] = glu_m
    simulation.run()
    ds = simulation.results().data_store()
    glucose_i[glu_m] = ds.voi_and_variables()["phenomonological_constants/J_Gl_SGLT"].values()
    # print((glucose_i))
    # for key, value in glucose_i.items():
    #     print(key, value)

# cache results for plotting
outfile = open("J_Gl_SGLT.csv", 'w')
cols = []
for key, item in glucose_i.items():
     outfile.write(str(key) + ",")
     cols.append(item)
outfile.write("\n")

for i in range(0, len(cols[0])):
    for j in range(0, len(cols)):
        outfile.write(str(cols[j][i]) + ",")
    outfile.write("\n")
outfile.close()
#######
#Glucose flux through GLUT
glucose_i = {}

simulation = opencor.open_simulation("https://models.physiomeproject.org/workspace/572/rawfile/59488c15178b09bcb5b11f795383b1435f7b7ef1/SEDML_files/Model.sedml")
data = simulation.data()
data.set_ending_point(600)

for i, glu_m in enumerate(glucose_m):
    # reset everything in case we are running interactively and have existing results
    simulation.reset(True)
    simulation.clear_results()

    data.constants()["Apical_concentrations/Na_m"] = Na_m[i]
    data.constants()["Apical_concentrations/Cl_m"] = Cl_m[i]
    data.constants()["Cell_concentration/theta_6"] = 0  # SGLT is turned off
    data.constants()["Apical_concentrations/glucose_m"] = glu_m
    simulation.run()
    ds = simulation.results().data_store()
    glucose_i[glu_m] = ds.voi_and_variables()["A_GLUT2/J_A_GLUT"].values()
    # print((glucose_i))
    # for key, value in glucose_i.items():
    #     print(key, value)

# cache results for plotting
outfile = open("J_Gl_GLUT.csv", 'w')
cols = []
for key, item in glucose_i.items():
     outfile.write(str(key) + ",")
     cols.append(item)
outfile.write("\n")

for i in range(0, len(cols[0])):
    for j in range(0, len(cols)):
        outfile.write(str(cols[j][i]) + ",")
    outfile.write("\n")
outfile.close()