Location: AE1-BG @ 326c38ed3757 / Fig3B.py

Author:
nima <nafs080@aucklanduni.ac.nz>
Date:
2021-10-08 10:23:03+13:00
Desc:
Put the title for documentation
Permanent Source URI:
https://models.physiomeproject.org/workspace/6b9/rawfile/326c38ed37572dad9be4b340da5f849cafa1437b/Fig3B.py

# To reproduce Figure 3 in the associated Physiome paper,
# execute this script from the command line:

#   cd [PathToThisFile]
#   [PathToOpenCOR]/pythonshell Figure3B.py

import os

import matplotlib

matplotlib.use('agg')

import numpy as np
import matplotlib.pyplot as plt

import opencor as opencor

root = "C:/Users/nafs080/work/BG-python-project/resources"
simulation = opencor.open_simulation(os.path.join(root, 'AE1-BG.sedml'))
data = simulation.data()
data.set_ending_point(10)
data.set_point_interval(1)
result = []
q_Cl_i_vec = [0,5,10,15,20,25,30,35,40,45,50,60,70,80,90,100,110,120]
for q in q_Cl_i_vec:
    simulation.reset(True)
    simulation.clear_results()
    data.constants()["AE1/q_Cl_o"] = 114
    data.constants()["AE1/q_HCO3_i"] = 26
    data.constants()["AE1/q_HCO3_o"] = 26
    data.constants()["AE1/K_Cl_o"] = 1.34784535e+00
    data.constants()["AE1/K_Cl_i"] = 1.34809503e+00
    data.constants()["AE1/K_HCO3_i"] = 8.37243345e-01
    data.constants()["AE1/K_HCO3_o"] = 8.37398440e-01
    data.constants()["AE1/K_E_o"] = 3.42812779e+00
    data.constants()["AE1/K_E_i"] = 3.71610024e-01
    data.constants()["AE1/K_ECl_o"] = 2.30943735e+02
    data.constants()["AE1/K_ECl_i"] = 2.50575623e+01
    data.constants()["AE1/K_EHCO3_o"] = 5.68610961e+02
    data.constants()["AE1/K_EHCO3_i"] = 6.15805309e+01

    data.constants()["AE1/K_Re1"] = 2.16462852e+01
    data.constants()["AE1/K_Re2"] = 2.43394395e+00
    data.constants()["AE1/K_Re3"] = 1.99577523e+02
    data.constants()["AE1/K_Re4"] = 3.21470643e+02
    data.constants()["AE1/K_Re5"] = 2.19265742e+00
    data.constants()["AE1/K_Re6"] = 3.48281500e+01

    data.states()["AE1/q_E_o"] = 0.01738
    data.states()["AE1/q_E_i"] = 0.473
    data.states()["AE1/q_ECl_o"] = 0.0396
    data.states()["AE1/q_ECl_i"] = 0.274
    data.states()["AE1/q_EHCO3_i"] = 0.0621
    data.states()["AE1/q_EHCO3_o"] = 0.00228
    data.constants()["AE1/q_Cl_i"] = q
    simulation.run()
    ds = simulation.results().data_store()
    value = ds.voi_and_variables()["AE1/v_Re2"].values()[-1]
    result.append(value)
# print(result)


simulation1 = opencor.open_simulation(os.path.join(root, 'Weinstein_2000_AE1_Fig3.sedml'))
data1 = simulation1.data()
data1.set_ending_point(10)
data1.set_point_interval(1)
result_cellml = []
for q in q_Cl_i_vec:
    simulation1.reset(True)
    simulation1.clear_results()
    data1.states()["concentrations/Cl_int"] = q
    simulation1.run()
    ds = simulation1.results().data_store()
    value1 = ds.voi_and_variables()["fluxes/J_AE1_HCO3"].values()
    result_cellml.append(value1)

# print(result_cellml)



plt.plot(q_Cl_i_vec, result, color= 'green')
plt.plot(q_Cl_i_vec, result_cellml, color= 'blue')
plt.xlabel('Cl$_i$')
plt.ylabel('HCO3 flux')
# plt.show()
plt.savefig("Figure3B.png")