Location: SLC transporters @ 54428a600e2c / src / plot_SGLT1.py

Author:
Weiwei Ai <wai484@aucklanduni.ac.nz>
Date:
2024-05-27 16:40:34+12:00
Desc:
Fixed typos
Permanent Source URI:
http://models.cellml.org/workspace/b65/rawfile/54428a600e2c560005a2d9d0a5608082f90a7c0c/src/plot_SGLT1.py

import os
import sys
# Get the directory containing the current file
current_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(current_dir, '../dataPlot/'))
from dataPlot import plot_line2D, subplots_ajdust
path_=os.path.join(current_dir, '../Electrogenic cotransporter/CellMLV2/sim_results/')
data_path=os.path.join(current_dir, '../Electrogenic cotransporter/data/')

save_fig = {'save_fig': True, 'fig_format': 'png', 'file_path': path_, 'filename': 'SGLT1_fit_fig10'}
filename_50 = data_path+'Fig10_Parent1992_50mV.csv'
filename_150 = data_path+'Fig10_Parent1992_150mV.csv'
filename_BG_150 = path_+'report_task_SGLT1_BG_fig10_150mV_post.csv'
filename_BG_50 = path_+'report_task_SGLT1_BG_fig10_50mV_post.csv'
filename_50_sugar = data_path+'Fig10_Parent1992_50mV_sugar.csv'
filename_150_sugar = data_path+'Fig10_Parent1992_150mV_sugar.csv'
filename_BG_150_sugar = path_+'report_task_SGLT1_BG_fig10_150mV_sugar_post.csv'
filename_BG_50_sugar = path_+'report_task_SGLT1_BG_fig10_50mV_sugar_post.csv'


subtitle_kwargs={}
fig_cfg = {'num_rows': 1, 'num_cols': 2, 'width':8, 'height':4, 'fig_title': None, 'title_y': 0.98, 'fontsize': 8, 
           'left': 0.1, 'bottom': 0.2, 'right': 0.95, 'top': 0.95, 'wspace': 0.25, 'hspace': 0.2}
fig, axs= subplots_ajdust(fig_cfg, **subtitle_kwargs)

plot_cfg = {}
line_cfg = {}

line_cfg[1] = { 'xdata': (filename_50,'x'), 'ydata':(filename_50,'Curve1'),
                'color': 'k', 'linestyle': '-',  'label': 'Parent et al. (1992) @50mV'}
line_cfg[2] = { 'xdata': (filename_150,'x'), 'ydata':(filename_150,'Curve1'),
                'color': 'k', 'linestyle': '-.',  'label': 'Parent et al. (1992) @-150mV'}
line_cfg[3] = { 'xdata': (filename_BG_50,'tms'), 'ydata':(filename_BG_50,'Ii'),
                'color': 'b', 'linestyle': '--',  'label': 'Bond graph @50mV'}
line_cfg[4] = { 'xdata': (filename_BG_150,'tms'), 'ydata':(filename_BG_150,'Ii'),
                'color': 'r', 'linestyle': '--',  'label': 'Bond graph @-150mV'}
line_cfg[5] = { 'xdata': (filename_50_sugar,'x'), 'ydata':(filename_50_sugar,'Curve1'),
                'color': 'k', 'linestyle': '-',  'label': 'Parent et al. (1992) @50mV'}
line_cfg[6] = { 'xdata': (filename_150_sugar,'x'), 'ydata':(filename_150_sugar,'Curve1'),
                'color': 'k', 'linestyle': '-.',  'label': 'Parent et al. (1992) @-150mV'}
line_cfg[7] = { 'xdata': (filename_BG_50_sugar,'tms'), 'ydata':(filename_BG_50_sugar,'Ii'),
                'color': 'b', 'linestyle': '--',  'label': 'Bond graph @50mV'}
line_cfg[8] = { 'xdata': (filename_BG_150_sugar,'tms'), 'ydata':(filename_BG_150_sugar,'Ii'),
                'color': 'r', 'linestyle': '--',  'label': 'Bond graph @-150mV'}

plot_cfg[1] = {'ylabel': 'i (nA)', 'xlabel': 'Time (ms)','show_grid': 'both', 'grid_axis': 'both',  'ylim': [-500, 1500], 'xlim': [0, 80],
                'line': [1,2,3,4], 'legend': [1,2,3,4], 'title': '(a) Before the addition of glucose','title_y': -0.25}
plot_cfg[2] = {'ylabel': 'i (nA)', 'xlabel': 'Time (ms)','show_grid': 'both', 'grid_axis': 'both',  'ylim': [-500, 400], 'xlim': [0, 80],
                'line': [5,6,7,8], 'legend': [5,6,7,8], 'title': '(b) After the addition of glucose','title_y': -0.25}

plot_line2D(axs, plot_cfg, line_cfg, save_fig)

save_fig = {'save_fig': True, 'fig_format': 'png', 'file_path': path_, 'filename': 'SGLT1_fit_fig5_primary'}
filename = data_path+'Fig5_Parent1992.csv'
filename_BG= path_+'fig5_BG.csv'
filename_ss= path_+'fig5_ss.csv'
filename_BG_fast= path_+'fig5_BG_fast.csv'
filename_ss_fast= path_+'fig5_ss_fast.csv'


subtitle_kwargs={}
fig_cfg = {'num_rows': 1, 'num_cols': 2, 'width':8, 'height':4, 'fig_title': None, 'title_y': 0.98, 'fontsize': 8, 
           'left': 0.1, 'bottom': 0.2, 'right': 0.95, 'top': 0.9, 'wspace': 0.28, 'hspace': 0.2}
fig, axs= subplots_ajdust(fig_cfg, **subtitle_kwargs)

plot_cfg = {}
line_cfg = {}

line_cfg[1] = { 'xdata': (filename,'x'), 'ydata':(filename,'Curve1'),
                'color': 'k', 'linestyle': '-',  'label': 'Parent et al. (1992)'}
line_cfg[2] = { 'xdata': (filename_BG,'V_E'), 'ydata':(filename_BG,'Ii'),
                'color': 'r', 'linestyle': '-.',  'label': 'Bond graph'}
line_cfg[3] = { 'xdata': (filename_ss,'V0_Vm'), 'ydata':(filename_ss,'Ii'),
                'color': 'm', 'linestyle': '-.',  'label': 'Steady state (37) from bond graph'}
line_cfg[4] = { 'xdata': (filename_BG_fast,'V_E'), 'ydata':(filename_BG_fast,'Ii'),
                'color': 'g', 'linestyle': '-.',  'label': 'Bond graph-fast binding '}
line_cfg[5] = { 'xdata': (filename_ss_fast,'V0_Vm'), 'ydata':(filename_ss_fast,'Ii'),
                'color': 'b', 'linestyle': '-.',  'label': 'Steady-state Eqs 37 and 38' }


plot_cfg[1] = {'ylabel': 'i (nA)', 'xlabel': 'V (mV)','show_grid': 'both', 'grid_axis': 'both', 'title': '(a)','title_y': -0.25,
                'line': [1,2], 'legend': [1,2]}
plot_cfg[2] = {'ylabel': 'i (nA)', 'xlabel': 'V (mV)','show_grid': 'both', 'grid_axis': 'both', 'title': '(b)','title_y': -0.25,
                'line': [4,5], 'legend': [4,5]}

plot_line2D(axs, plot_cfg, line_cfg, save_fig)