Discussion and changes to abstract

This commit is contained in:
nkoch1 2022-10-27 11:06:25 -04:00
parent 2b537f790a
commit 6c2ba406b8
8 changed files with 691 additions and 775 deletions

View File

@ -2,24 +2,130 @@ import pandas as pd
import numpy as np
import h5py
import os
from ast import literal_eval
#%% correlation analysis
#%% create JSON files for each alt type
# folder
top_dir = '../Sensitivity_Analysis'
# for each alt_type create pd df
shift_AUC = pd.DataFrame()
shift_rheo = pd.DataFrame()
shift_fI = pd.DataFrame(dtype=object)
shift_I_mag = pd.DataFrame(dtype=object)
slope_AUC = pd.DataFrame()
slope_rheo = pd.DataFrame()
slope_fI = pd.DataFrame(dtype=object)
slope_I_mag = pd.DataFrame(dtype=object)
g_AUC = pd.DataFrame()
g_rheo = pd.DataFrame()
g_fI = pd.DataFrame(dtype=object)
g_I_mag = pd.DataFrame(dtype=object)
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN',
print('SA pd gen')
dir_names = ['RS_pyramidal', 'RS_inhib', 'FS','RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate', 'Cb_stellate_Kv',
'Cb_stellate_Kv_only', 'STN', 'STN_Kv', 'STN_Kv_only']
for dir_name in dir_names:
folder = os.path.join(top_dir, dir_name)
print(folder)
# for each alt_type create pd df
shift_AUC = pd.DataFrame()
shift_rheo = pd.DataFrame()
shift_fI = pd.DataFrame(dtype=object)
shift_I_mag = pd.DataFrame(dtype=object)
slope_AUC = pd.DataFrame()
slope_rheo = pd.DataFrame()
slope_fI = pd.DataFrame(dtype=object)
slope_I_mag = pd.DataFrame(dtype=object)
g_AUC = pd.DataFrame()
g_rheo = pd.DataFrame()
g_fI = pd.DataFrame(dtype=object)
g_I_mag = pd.DataFrame(dtype=object)
for root, dirs, files in os.walk(folder):
for file in files:
if file.endswith('.hdf5'):
with h5py.File(os.path.join(folder, file), "r+") as f:
alt = f['data'].attrs['alteration']
test = f['data'].attrs['alteration_info'].replace(' ', ',')
alt_info = literal_eval(test)
var = alt_info[0]
alt_type = alt_info[1]
if alt_type == 'shift':
shift_AUC.loc[alt, var] = f['analysis']['AUC'][()]
shift_rheo.loc[alt, var] = f['analysis']['rheobase'][()]
shift_fI.loc[alt, var] = 0
shift_fI = shift_fI.astype(object)
shift_fI.at[alt, var] = f['analysis']['F_inf'][:].tolist()
shift_I_mag.loc[alt, var] = 0
shift_I_mag = shift_I_mag.astype(object)
shift_I_mag.at[alt, var] = ((np.arange(f['data'].attrs['I_low'], f['data'].attrs['I_high'],
(f['data'].attrs['I_high'] - f['data'].attrs['I_low']) /
f['data'].attrs['stim_num'])) * 1000).tolist() # nA
elif alt_type == 'slope':
slope_AUC.loc[alt, var] = f['analysis']['AUC'][()]
slope_rheo.loc[alt, var] = f['analysis']['rheobase'][()]
slope_fI.loc[alt, var] = 0
slope_fI = slope_fI.astype(object)
slope_fI.at[alt, var] = f['analysis']['F_inf'][:].tolist()
slope_I_mag.loc[alt, var] = 0
slope_I_mag = slope_I_mag.astype(object)
slope_I_mag.at[alt, var] = ((np.arange(f['data'].attrs['I_low'], f['data'].attrs['I_high'],
(f['data'].attrs['I_high'] - f['data'].attrs['I_low']) /
f['data'].attrs['stim_num'])) * 1000).tolist()
elif alt_type == 'g':
g_AUC.loc[alt, var] = f['analysis']['AUC'][()]
g_rheo.loc[alt, var] = f['analysis']['rheobase'][()]
g_fI.loc[alt, var] = 0
g_fI = g_fI.astype(object)
g_fI.at[alt, var] = f['analysis']['F_inf'][:].tolist()
g_I_mag.loc[alt, var] = 0
g_I_mag = g_I_mag.astype(object)
g_I_mag.at[alt, var] = ((np.arange(f['data'].attrs['I_low'], f['data'].attrs['I_high'],
(f['data'].attrs['I_high'] - f['data'].attrs['I_low']) /
f['data'].attrs['stim_num'])) * 1000).tolist()
else:
print(file, 'Unknown alteration type')
# save df with folder+alt_type
save_folder = os.path.join(top_dir, 'SA_summary_df')
if not os.path.isdir(save_folder):
os.makedirs(save_folder)
shift_AUC.to_json(os.path.join(save_folder, '{}_shift_AUC.json'.format(dir_name)))
shift_rheo.to_json(os.path.join(save_folder, '{}_shift_rheo.json'.format(dir_name)))
shift_fI.to_json(os.path.join(save_folder, '{}_shift_fI.json'.format(dir_name)))
shift_I_mag.to_json(os.path.join(save_folder, '{}_shift_I_mag.json'.format(dir_name)))
slope_AUC.to_json(os.path.join(save_folder, '{}_slope_AUC.json'.format(dir_name)))
slope_rheo.to_json(os.path.join(save_folder, '{}_slope_rheo.json'.format(dir_name)))
slope_fI.to_json(os.path.join(save_folder, '{}_slope_fI.json'.format(dir_name)))
slope_I_mag.to_json(os.path.join(save_folder, '{}_slope_I_mag.json'.format(dir_name)))
g_AUC.to_json(os.path.join(save_folder, '{}_g_AUC.json'.format(dir_name)))
g_rheo.to_json(os.path.join(save_folder, '{}_g_rheo.json'.format(dir_name)))
g_fI.to_json(os.path.join(save_folder, '{}_g_fI.json'.format(dir_name)))
g_I_mag.to_json(os.path.join(save_folder, '{}_g_I_mag.json'.format(dir_name)))
# requires _shift_rheo.json
#%% correlation analysis ###########################################################################################
models = ['RS_pyramidal', 'RS_inhib', 'FS','RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN',
'STN_Kv', 'STN_Kv_only']
model_labels = ['RS pyramidal', 'RS inhibitory', 'FS', 'IB', 'Cb stellate', 'Cb stellate +$K_V1.1$',
model_labels = ['RS_pyramidal', 'RS_inhib', 'FS', 'RS_pyramidal +$K_V1.1$', 'RS_inhib +$K_V1.1$', 'FS +$K_V1.1$','Cb stellate', 'Cb stellate +$K_V1.1$',
'Cb stellate $\Delta$$K_V1.1$', 'STN', 'STN +$K_V1.1$', 'STN $\Delta$$K_V1.1$']
# colors = [cm.tab10(i) for i in range(20)]
# clr_dict = {}
# for m in range(len(models)):
# clr_dict[models[m]] = colors[m]
var = ['m', 'h', 'n', 's', 'u', 'a', 'b', 'n_A', 'h_a']
var_dict = {}
var_dict['RS_pyramidal'] = ['m', 'h', 'n', 's', 'u']
var_dict['RS_inhib'] = ['m', 'h', 'n', 's', 'u']
var_dict['FS'] = ['m', 'h', 'n', 's', 'u']
var_dict['IB'] = ['m', 'h', 'n', 's', 'u']
var_dict['RS_pyramidal'] = ['m', 'h', 'n']
var_dict['RS_inhib'] = ['m', 'h', 'n']
var_dict['FS'] = ['m', 'h', 'n']
var_dict['RS_pyramidal_Kv'] = ['m', 'h', 'n', 's', 'u']
var_dict['RS_inhib_Kv'] = ['m', 'h', 'n', 's', 'u']
var_dict['FS_Kv'] = ['m', 'h', 'n', 's', 'u']
var_dict['Cb_stellate'] = ['m', 'h', 'n', 'a', 'b']
var_dict['Cb_stellate_Kv'] = ['m', 'h', 'n', 'a', 'b', 's', 'u']
var_dict['Cb_stellate_Kv_only'] = ['m', 'h', 'n', 's', 'u']
@ -27,659 +133,496 @@ var_dict['STN'] = ['m', 'h', 'n', 'n_A', 'h_A', 's', 'u']
var_dict['STN_Kv'] = ['m', 'h', 'n', 'n_A', 'h_A', 's', 'u']
var_dict['STN_Kv_only'] = ['m', 'h', 'n', 's', 'u']
folder = './SA_fig/corr_df'
folder = './Sensitivity_Analysis/corr_df'
if not os.path.isdir(folder):
os.makedirs(folder)
# % AUC
# % rheo
# % shift
shift_m = pd.DataFrame()
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN',
'STN_Kv', 'STN_Kv_only']
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate', 'Cb_stellate_Kv',
'Cb_stellate_Kv_only', 'STN', 'STN_Kv', 'STN_Kv_only']
for mod in models:
with open('./SA_summary_df/{}_shift_rheo.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
shift_m[mod] = pd.read_json(json_file)['m'].sort_index()
shift_m.sort_index(inplace=True)
shift_m.replace(0., np.NaN, inplace=True)
shift_m = (shift_m - shift_m.loc[0, :]) # /shift_m.loc[0,:]
shift_m = (shift_m - shift_m.loc[0, :])
shift_m.to_json(os.path.join(folder, 'shift_m_rheo.json'))
shift_h = pd.DataFrame()
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN',
'STN_Kv', 'STN_Kv_only']
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate', 'Cb_stellate_Kv',
'Cb_stellate_Kv_only', 'STN', 'STN_Kv', 'STN_Kv_only']
for mod in models:
with open('./SA_summary_df/{}_shift_rheo.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
shift_h[mod] = pd.read_json(json_file)['h'].sort_index()
shift_h.sort_index(inplace=True)
shift_h.replace(0., np.NaN, inplace=True)
shift_h = (shift_h - shift_h.loc[0, :]) # /shift_h.loc[0,:]
shift_h = (shift_h - shift_h.loc[0, :])
shift_h.to_json(os.path.join(folder, 'shift_h_rheo.json'))
shift_n = pd.DataFrame()
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN',
'STN_Kv', 'STN_Kv_only']
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate', 'Cb_stellate_Kv',
'Cb_stellate_Kv_only', 'STN', 'STN_Kv', 'STN_Kv_only']
for mod in models:
with open('./SA_summary_df/{}_shift_rheo.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
shift_n[mod] = pd.read_json(json_file)['n'].sort_index()
shift_n.sort_index(inplace=True)
shift_n.replace(0., np.NaN, inplace=True)
shift_n = (shift_n - shift_n.loc[0, :]) # /shift_n.loc[0,:]
shift_n = (shift_n - shift_n.loc[0, :])
shift_n.to_json(os.path.join(folder, 'shift_n_rheo.json'))
shift_s = pd.DataFrame()
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN_Kv', 'STN_Kv_only']
models = ['RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN_Kv', 'STN_Kv_only']
for mod in models:
with open('./SA_summary_df/{}_shift_rheo.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
shift_s[mod] = pd.read_json(json_file)['s'].sort_index()
shift_s.sort_index(inplace=True)
shift_s.replace(0., np.NaN, inplace=True)
shift_s = (shift_s - shift_s.loc[0, :]) # /shift_s.loc[0,:]
shift_s = (shift_s - shift_s.loc[0, :])
shift_s.to_json(os.path.join(folder, 'shift_s_rheo.json'))
shift_u = pd.DataFrame()
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN_Kv', 'STN_Kv_only']
models = ['RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN_Kv', 'STN_Kv_only']
for mod in models:
with open('./SA_summary_df/{}_shift_rheo.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
shift_u[mod] = pd.read_json(json_file)['u'].sort_index()
shift_u.sort_index(inplace=True)
shift_u.replace(0., np.NaN, inplace=True)
shift_u = (shift_u - shift_u.loc[0, :]) # /shift_u.loc[0,:]
shift_u = (shift_u - shift_u.loc[0, :])
shift_u.to_json(os.path.join(folder, 'shift_u_rheo.json'))
shift_a = pd.DataFrame()
models = ['Cb_stellate', 'Cb_stellate_Kv']
for mod in models:
with open('./SA_summary_df/{}_shift_rheo.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
# test =pd.read_json(json_file)
shift_a[mod] = pd.read_json(json_file)['n_A'].sort_index()
models = ['STN', 'STN_Kv']
for mod in models:
with open('./SA_summary_df/{}_shift_rheo.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
shift_a[mod] = pd.read_json(json_file)['a'].sort_index()
shift_a.sort_index(inplace=True)
shift_a.replace(0., np.NaN, inplace=True)
shift_a = (shift_a - shift_a.loc[0, :]) # /shift_a.loc[0,:]
shift_a = (shift_a - shift_a.loc[0, :])
shift_a.to_json(os.path.join(folder, 'shift_a_rheo.json'))
shift_b = pd.DataFrame()
models = ['Cb_stellate', 'Cb_stellate_Kv']
for mod in models:
with open('./SA_summary_df/{}_shift_rheo.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
shift_b[mod] = pd.read_json(json_file)['h_A'].sort_index()
models = ['STN', 'STN_Kv']
for mod in models:
with open('./SA_summary_df/{}_shift_rheo.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
shift_b[mod] = pd.read_json(json_file)['b'].sort_index()
shift_b.sort_index(inplace=True)
shift_b.replace(0., np.NaN, inplace=True)
shift_b = (shift_b - shift_b.loc[0, :]) # /shift_b.loc[0,:]
shift_b = (shift_b - shift_b.loc[0, :])
shift_b.to_json(os.path.join(folder, 'shift_b_rheo.json'))
# % slope
slope_m = pd.DataFrame()
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN',
'STN_Kv', 'STN_Kv_only']
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate', 'Cb_stellate_Kv',
'Cb_stellate_Kv_only', 'STN', 'STN_Kv', 'STN_Kv_only']
for mod in models:
with open('./SA_summary_df/{}_slope_rheo.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
slope_m[mod] = pd.read_json(json_file, convert_axes=False, convert_dates=False)['m'].sort_index()
# slope_m.set_index(slope_m.index.astype('float'))
slope_m.index = slope_m.index.map(float)
slope_m.sort_index(inplace=True)
slope_m.replace(0., np.NaN, inplace=True)
slope_m = (slope_m - slope_m.loc[1.0, :]) # /slope_m.loc[1.0,:]
slope_m = (slope_m - slope_m.loc[1.0, :])
slope_m.to_json(os.path.join(folder, 'slope_m_rheo.json'))
slope_h = pd.DataFrame()
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN',
'STN_Kv', 'STN_Kv_only']
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate', 'Cb_stellate_Kv',
'Cb_stellate_Kv_only', 'STN', 'STN_Kv', 'STN_Kv_only']
for mod in models:
with open('./SA_summary_df/{}_slope_rheo.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
slope_h[mod] = pd.read_json(json_file, convert_axes=False, convert_dates=False)['h'].sort_index()
slope_h.index = slope_h.index.map(float)
slope_h.sort_index(inplace=True)
slope_h.replace(0., np.NaN, inplace=True)
slope_h = (slope_h - slope_h.loc[1.0, :]) # /slope_h.loc[1.0,:]
slope_h = (slope_h - slope_h.loc[1.0, :])
slope_h.to_json(os.path.join(folder, 'slope_h_rheo.json'))
slope_n = pd.DataFrame()
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN',
'STN_Kv', 'STN_Kv_only']
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate', 'Cb_stellate_Kv',
'Cb_stellate_Kv_only', 'STN', 'STN_Kv', 'STN_Kv_only']
for mod in models:
with open('./SA_summary_df/{}_slope_rheo.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
slope_n[mod] = pd.read_json(json_file, convert_axes=False, convert_dates=False)['n'].sort_index()
slope_n.index = slope_n.index.map(float)
slope_n.sort_index(inplace=True)
slope_n.replace(0., np.NaN, inplace=True)
slope_n = (slope_n - slope_n.loc[1.0, :]) # /slope_n.loc[1.0,:]
slope_n = (slope_n - slope_n.loc[1.0, :])
slope_n.to_json(os.path.join(folder, 'slope_n_rheo.json'))
slope_s = pd.DataFrame()
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN_Kv', 'STN_Kv_only']
models = [ 'RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN_Kv', 'STN_Kv_only']
for mod in models:
with open('./SA_summary_df/{}_slope_rheo.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
slope_s[mod] = pd.read_json(json_file, convert_axes=False, convert_dates=False)['s'].sort_index()
slope_s.index = slope_s.index.map(float)
slope_s.sort_index(inplace=True)
slope_s.replace(0., np.NaN, inplace=True)
slope_s = (slope_s - slope_s.loc[1.0, :]) # /slope_s.loc[1.0,:]
slope_s = (slope_s - slope_s.loc[1.0, :])
slope_s.to_json(os.path.join(folder, 'slope_s_rheo.json'))
slope_u = pd.DataFrame()
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN_Kv', 'STN_Kv_only']
models = ['RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN_Kv', 'STN_Kv_only']
for mod in models:
with open('./SA_summary_df/{}_slope_rheo.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
slope_u[mod] = pd.read_json(json_file, convert_axes=False, convert_dates=False)['u'].sort_index()
slope_u.index = slope_u.index.map(float)
slope_u.sort_index(inplace=True)
slope_u.replace(0., np.NaN, inplace=True)
slope_u = (slope_u - slope_u.loc[1.0, :]) # /slope_u.loc[1.0,:]
slope_u = (slope_u - slope_u.loc[1.0, :])
slope_u.to_json(os.path.join(folder, 'slope_u_rheo.json'))
slope_a = pd.DataFrame()
models = ['Cb_stellate', 'Cb_stellate_Kv']
for mod in models:
with open('./SA_summary_df/{}_slope_rheo.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
# test =pd.read_json(json_file)
slope_a[mod] = pd.read_json(json_file, convert_axes=False, convert_dates=False)['n_A'].sort_index()
models = ['STN', 'STN_Kv']
for mod in models:
with open('./SA_summary_df/{}_slope_rheo.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
slope_a[mod] = pd.read_json(json_file, convert_axes=False, convert_dates=False)['a'].sort_index()
slope_a.index = slope_a.index.map(float)
slope_a.sort_index(inplace=True)
slope_a.replace(0., np.NaN, inplace=True)
slope_a = (slope_a - slope_a.loc[1.0, :]) # /slope_a.loc[1.0,:]
slope_a = (slope_a - slope_a.loc[1.0, :])
slope_a.to_json(os.path.join(folder, 'slope_a_rheo.json'))
slope_b = pd.DataFrame()
models = ['Cb_stellate', 'Cb_stellate_Kv']
for mod in models:
with open('./SA_summary_df/{}_slope_rheo.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
slope_b[mod] = pd.read_json(json_file, convert_axes=False, convert_dates=False)['h_A'].sort_index()
models = ['STN', 'STN_Kv']
for mod in models:
with open('./SA_summary_df/{}_slope_rheo.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
slope_b[mod] = pd.read_json(json_file, convert_axes=False, convert_dates=False)['b'].sort_index()
slope_b.index = slope_b.index.map(float)
slope_b.sort_index(inplace=True)
slope_b.replace(0., np.NaN, inplace=True)
slope_b = (slope_b - slope_b.loc[1.0, :]) # /slope_b.loc[1.0,:]
slope_b = (slope_b - slope_b.loc[1.0, :]) #
slope_b.to_json(os.path.join(folder, 'slope_b_rheo.json'))
# % g
g_Na = pd.DataFrame()
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN',
'STN_Kv', 'STN_Kv_only']
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate', 'Cb_stellate_Kv',
'Cb_stellate_Kv_only', 'STN', 'STN_Kv', 'STN_Kv_only']
for mod in models:
with open('./SA_summary_df/{}_g_rheo.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
g_Na[mod] = pd.read_json(json_file, convert_axes=False, convert_dates=False)['Na'].sort_index()
g_Na.index = g_Na.index.map(float)
g_Na.sort_index(inplace=True)
g_Na.replace(0., np.NaN, inplace=True)
g_Na = (g_Na - g_Na.loc[1.0, :]) # /g_Na.loc[1.0,:]
g_Na = (g_Na - g_Na.loc[1.0, :])
g_Na.to_json(os.path.join(folder, 'g_Na_rheo.json'))
g_Kd = pd.DataFrame()
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN',
'STN_Kv', 'STN_Kv_only']
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate', 'Cb_stellate_Kv',
'Cb_stellate_Kv_only', 'STN', 'STN_Kv', 'STN_Kv_only']
for mod in models:
with open('./SA_summary_df/{}_g_rheo.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
g_Kd[mod] = pd.read_json(json_file, convert_axes=False, convert_dates=False)['Kd'].sort_index()
g_Kd.index = g_Kd.index.map(float)
g_Kd.sort_index(inplace=True)
g_Kd.replace(0., np.NaN, inplace=True)
g_Kd = (g_Kd - g_Kd.loc[1.0, :]) # /g_Kd.loc[1.0,:]
g_Kd = (g_Kd - g_Kd.loc[1.0, :])
g_Kd.to_json(os.path.join(folder, 'g_Kd_rheo.json'))
g_Kv = pd.DataFrame()
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN_Kv', 'STN_Kv_only']
models = ['RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN_Kv', 'STN_Kv_only']
for mod in models:
with open('./SA_summary_df/{}_g_rheo.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
g_Kv[mod] = pd.read_json(json_file, convert_axes=False, convert_dates=False)['Kv'].sort_index()
g_Kv.index = g_Kv.index.map(float)
g_Kv.sort_index(inplace=True)
g_Kv.replace(0., np.NaN, inplace=True)
g_Kv = (g_Kv - g_Kv.loc[1.0, :]) # /g_Kv.loc[1.0,:]
g_Kv = (g_Kv - g_Kv.loc[1.0, :])
g_Kv.to_json(os.path.join(folder, 'g_Kv_rheo.json'))
g_A = pd.DataFrame()
models = ['Cb_stellate', 'Cb_stellate_Kv', 'STN', 'STN_Kv']
for mod in models:
with open('./SA_summary_df/{}_g_rheo.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
g_A[mod] = pd.read_json(json_file, convert_axes=False, convert_dates=False)['A'].sort_index()
g_A.index = g_A.index.map(float)
g_A.sort_index(inplace=True)
g_A.replace(0., np.NaN, inplace=True)
g_A = (g_A - g_A.loc[1.0, :]) # /g_A.loc[1.0,:]
g_A = (g_A - g_A.loc[1.0, :])
g_A.to_json(os.path.join(folder, 'g_A_rheo.json'))
g_Leak = pd.DataFrame()
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN',
'STN_Kv', 'STN_Kv_only']
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate', 'Cb_stellate_Kv',
'Cb_stellate_Kv_only', 'STN', 'STN_Kv', 'STN_Kv_only']
for mod in models:
with open('./SA_summary_df/{}_g_rheo.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
g_Leak[mod] = pd.read_json(json_file, convert_axes=False, convert_dates=False)['Leak'].sort_index()
g_Leak.index = g_Leak.index.map(float)
g_Leak.sort_index(inplace=True)
g_Leak.replace(0., np.NaN, inplace=True)
g_Leak = (g_Leak - g_Leak.loc[1.0, :]) # /g_Leak.loc[1.0,:]
g_Leak = (g_Leak - g_Leak.loc[1.0, :])
g_Leak.to_json(os.path.join(folder, 'g_Leak_rheo.json'))
# % AUC rel
# % AUC
# % shift
shift_m = pd.DataFrame()
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN',
'STN_Kv', 'STN_Kv_only']
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate', 'Cb_stellate_Kv',
'Cb_stellate_Kv_only', 'STN', 'STN_Kv', 'STN_Kv_only']
for mod in models:
with open('./SA_summary_df/{}_shift_AUC_rel.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
with open('./SA_summary_df/{}_shift_AUC.json'.format(mod)) as json_file:
shift_m[mod] = pd.read_json(json_file)['m'].sort_index()
shift_m.sort_index(inplace=True)
shift_m.replace(0., np.NaN, inplace=True)
shift_m = (shift_m - shift_m.loc[0, :]) / shift_m.loc[0, :]
shift_m.to_json(os.path.join(folder, 'shift_m_AUC_rel.json'))
shift_m.to_json(os.path.join(folder, 'shift_m_AUC.json'))
shift_h = pd.DataFrame()
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN',
'STN_Kv', 'STN_Kv_only']
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate', 'Cb_stellate_Kv',
'Cb_stellate_Kv_only', 'STN', 'STN_Kv', 'STN_Kv_only']
for mod in models:
with open('./SA_summary_df/{}_shift_AUC_rel_acc.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
with open('./SA_summary_df/{}_shift_AUC.json'.format(mod)) as json_file:
shift_h[mod] = pd.read_json(json_file)['h'].sort_index()
shift_h.sort_index(inplace=True)
shift_h.replace(0., np.NaN, inplace=True)
shift_h = (shift_h - shift_h.loc[0, :]) / shift_h.loc[0, :]
shift_h.to_json(os.path.join(folder, 'shift_h_AUC_rel.json'))
shift_h.to_json(os.path.join(folder, 'shift_h_AUC.json'))
shift_n = pd.DataFrame()
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN',
'STN_Kv', 'STN_Kv_only']
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate', 'Cb_stellate_Kv',
'Cb_stellate_Kv_only', 'STN', 'STN_Kv', 'STN_Kv_only']
for mod in models:
with open('./SA_summary_df/{}_shift_AUC_rel_acc.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
with open('./SA_summary_df/{}_shift_AUC.json'.format(mod)) as json_file:
shift_n[mod] = pd.read_json(json_file)['n'].sort_index()
shift_n.sort_index(inplace=True)
shift_n.replace(0., np.NaN, inplace=True)
shift_n = (shift_n - shift_n.loc[0, :]) / shift_n.loc[0, :]
shift_n.to_json(os.path.join(folder, 'shift_n_AUC_rel.json'))
shift_n.to_json(os.path.join(folder, 'shift_n_AUC.json'))
shift_s = pd.DataFrame()
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN_Kv', 'STN_Kv_only']
models = ['RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN_Kv', 'STN_Kv_only']
for mod in models:
with open('./SA_summary_df/{}_shift_AUC_rel_acc.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
with open('./SA_summary_df/{}_shift_AUC.json'.format(mod)) as json_file:
shift_s[mod] = pd.read_json(json_file)['s'].sort_index()
shift_s.sort_index(inplace=True)
shift_s.replace(0., np.NaN, inplace=True)
shift_s = (shift_s - shift_s.loc[0, :]) / shift_s.loc[0, :]
shift_s.to_json(os.path.join(folder, 'shift_s_AUC_rel.json'))
shift_s.to_json(os.path.join(folder, 'shift_s_AUC.json'))
shift_u = pd.DataFrame()
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN_Kv', 'STN_Kv_only']
models = ['RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN_Kv', 'STN_Kv_only']
for mod in models:
with open('./SA_summary_df/{}_shift_AUC_rel_acc.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
with open('./SA_summary_df/{}_shift_AUC.json'.format(mod)) as json_file:
shift_u[mod] = pd.read_json(json_file)['u'].sort_index()
shift_u.sort_index(inplace=True)
shift_u.replace(0., np.NaN, inplace=True)
shift_u = (shift_u - shift_u.loc[0, :]) / shift_u.loc[0, :]
shift_u.to_json(os.path.join(folder, 'shift_u_AUC_rel.json'))
shift_u.to_json(os.path.join(folder, 'shift_u_AUC.json'))
shift_a = pd.DataFrame()
models = ['Cb_stellate', 'Cb_stellate_Kv']
for mod in models:
with open('./SA_summary_df/{}_shift_AUC_rel_acc.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
# test =pd.read_json(json_file)
with open('./SA_summary_df/{}_shift_AUC.json'.format(mod)) as json_file:
shift_a[mod] = pd.read_json(json_file)['n_A'].sort_index()
models = ['STN', 'STN_Kv']
for mod in models:
with open('./SA_summary_df/{}_shift_AUC_rel_acc.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
with open('./SA_summary_df/{}_shift_AUC.json'.format(mod)) as json_file:
shift_a[mod] = pd.read_json(json_file)['a'].sort_index()
shift_a.sort_index(inplace=True)
shift_a.replace(0., np.NaN, inplace=True)
shift_a = (shift_a - shift_a.loc[0, :]) / shift_a.loc[0, :]
shift_a.to_json(os.path.join(folder, 'shift_a_AUC_rel.json'))
shift_a.to_json(os.path.join(folder, 'shift_a_AUC.json'))
shift_b = pd.DataFrame()
models = ['Cb_stellate', 'Cb_stellate_Kv']
for mod in models:
with open('./SA_summary_df/{}_shift_AUC_rel_acc.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
with open('./SA_summary_df/{}_shift_AUC.json'.format(mod)) as json_file:
shift_b[mod] = pd.read_json(json_file)['h_A'].sort_index()
models = ['STN', 'STN_Kv']
for mod in models:
with open('./SA_summary_df/{}_shift_AUC_rel_acc.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
with open('./SA_summary_df/{}_shift_AUC.json'.format(mod)) as json_file:
shift_b[mod] = pd.read_json(json_file)['b'].sort_index()
shift_b.sort_index(inplace=True)
shift_b.replace(0., np.NaN, inplace=True)
shift_b = (shift_b - shift_b.loc[0, :]) / shift_b.loc[0, :]
shift_b.to_json(os.path.join(folder, 'shift_b_AUC_rel.json'))
shift_b.to_json(os.path.join(folder, 'shift_b_AUC.json'))
# % slope
slope_m = pd.DataFrame()
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN',
'STN_Kv', 'STN_Kv_only']
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate', 'Cb_stellate_Kv',
'Cb_stellate_Kv_only', 'STN', 'STN_Kv', 'STN_Kv_only']
for mod in models:
with open('./SA_summary_df/{}_slope_AUC_rel_acc.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
with open('./SA_summary_df/{}_slope_AUC.json'.format(mod)) as json_file:
slope_m[mod] = pd.read_json(json_file, convert_axes=False, convert_dates=False)['m'].sort_index()
# slope_m.set_index(slope_m.index.astype('float'))
slope_m.index = slope_m.index.map(float)
slope_m.sort_index(inplace=True)
slope_m.replace(0., np.NaN, inplace=True)
slope_m = (slope_m - slope_m.loc[1.0, :]) / slope_m.loc[1.0, :]
slope_m.to_json(os.path.join(folder, 'slope_m_AUC_rel.json'))
slope_m.to_json(os.path.join(folder, 'slope_m_AUC.json'))
slope_h = pd.DataFrame()
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN',
'STN_Kv', 'STN_Kv_only']
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate', 'Cb_stellate_Kv',
'Cb_stellate_Kv_only', 'STN', 'STN_Kv', 'STN_Kv_only']
for mod in models:
with open('./SA_summary_df/{}_slope_AUC_rel_acc.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
with open('./SA_summary_df/{}_slope_AUC.json'.format(mod)) as json_file:
slope_h[mod] = pd.read_json(json_file, convert_axes=False, convert_dates=False)['h'].sort_index()
slope_h.index = slope_h.index.map(float)
slope_h.sort_index(inplace=True)
slope_h.replace(0., np.NaN, inplace=True)
slope_h = (slope_h - slope_h.loc[1.0, :]) / slope_h.loc[1.0, :]
slope_h.to_json(os.path.join(folder, 'slope_h_AUC_rel.json'))
slope_h.to_json(os.path.join(folder, 'slope_h_AUC.json'))
slope_n = pd.DataFrame()
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN',
'STN_Kv', 'STN_Kv_only']
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate', 'Cb_stellate_Kv',
'Cb_stellate_Kv_only', 'STN', 'STN_Kv', 'STN_Kv_only']
for mod in models:
with open('./SA_summary_df/{}_slope_AUC_rel_acc.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
with open('./SA_summary_df/{}_slope_AUC.json'.format(mod)) as json_file:
slope_n[mod] = pd.read_json(json_file, convert_axes=False, convert_dates=False)['n'].sort_index()
slope_n.index = slope_n.index.map(float)
slope_n.sort_index(inplace=True)
slope_n.replace(0., np.NaN, inplace=True)
slope_n = (slope_n - slope_n.loc[1.0, :]) / slope_n.loc[1.0, :]
slope_n.to_json(os.path.join(folder, 'slope_n_AUC_rel.json'))
slope_n.to_json(os.path.join(folder, 'slope_n_AUC.json'))
slope_s = pd.DataFrame()
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN_Kv', 'STN_Kv_only']
models = ['RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN_Kv', 'STN_Kv_only']
for mod in models:
with open('./SA_summary_df/{}_slope_AUC_rel_acc.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
with open('./SA_summary_df/{}_slope_AUC.json'.format(mod)) as json_file:
slope_s[mod] = pd.read_json(json_file, convert_axes=False, convert_dates=False)['s'].sort_index()
slope_s.index = slope_s.index.map(float)
slope_s.sort_index(inplace=True)
slope_s.replace(0., np.NaN, inplace=True)
slope_s = (slope_s - slope_s.loc[1.0, :]) / slope_s.loc[1.0, :]
slope_s.to_json(os.path.join(folder, 'slope_s_AUC_rel.json'))
slope_s.to_json(os.path.join(folder, 'slope_s_AUC.json'))
slope_u = pd.DataFrame()
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN_Kv', 'STN_Kv_only']
models = ['RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN_Kv', 'STN_Kv_only']
for mod in models:
with open('./SA_summary_df/{}_slope_AUC_rel_acc.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
with open('./SA_summary_df/{}_slope_AUC.json'.format(mod)) as json_file:
slope_u[mod] = pd.read_json(json_file, convert_axes=False, convert_dates=False)['u'].sort_index()
slope_u.index = slope_u.index.map(float)
slope_u.sort_index(inplace=True)
slope_u.replace(0., np.NaN, inplace=True)
slope_u = (slope_u - slope_u.loc[1.0, :]) / slope_u.loc[1.0, :]
slope_u.to_json(os.path.join(folder, 'slope_u_AUC_rel.json'))
slope_u.to_json(os.path.join(folder, 'slope_u_AUC.json'))
slope_a = pd.DataFrame()
models = ['Cb_stellate', 'Cb_stellate_Kv']
for mod in models:
with open('./SA_summary_df/{}_slope_AUC_rel_acc.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
# test =pd.read_json(json_file)
with open('./SA_summary_df/{}_slope_AUC.json'.format(mod)) as json_file:
slope_a[mod] = pd.read_json(json_file, convert_axes=False, convert_dates=False)['n_A'].sort_index()
models = ['STN', 'STN_Kv']
for mod in models:
with open('./SA_summary_df/{}_slope_AUC_rel_acc.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
with open('./SA_summary_df/{}_slope_AUC.json'.format(mod)) as json_file:
slope_a[mod] = pd.read_json(json_file, convert_axes=False, convert_dates=False)['a'].sort_index()
slope_a.index = slope_a.index.map(float)
slope_a.sort_index(inplace=True)
slope_a.replace(0., np.NaN, inplace=True)
slope_a = (slope_a - slope_a.loc[1.0, :]) / slope_a.loc[1.0, :]
slope_a.to_json(os.path.join(folder, 'slope_a_AUC_rel.json'))
slope_a.to_json(os.path.join(folder, 'slope_a_AUC.json'))
slope_b = pd.DataFrame()
models = ['Cb_stellate', 'Cb_stellate_Kv']
for mod in models:
with open('./SA_summary_df/{}_slope_AUC_rel_acc.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
with open('./SA_summary_df/{}_slope_AUC.json'.format(mod)) as json_file:
slope_b[mod] = pd.read_json(json_file, convert_axes=False, convert_dates=False)['h_A'].sort_index()
models = ['STN', 'STN_Kv']
for mod in models:
with open('./SA_summary_df/{}_slope_AUC_rel_acc.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
with open('./SA_summary_df/{}_slope_AUC.json'.format(mod)) as json_file:
slope_b[mod] = pd.read_json(json_file, convert_axes=False, convert_dates=False)['b'].sort_index()
slope_b.index = slope_b.index.map(float)
slope_b.sort_index(inplace=True)
slope_b.replace(0., np.NaN, inplace=True)
slope_b = (slope_b - slope_b.loc[1.0, :]) / slope_b.loc[1.0, :]
slope_b.to_json(os.path.join(folder, 'slope_b_AUC_rel.json'))
slope_b.to_json(os.path.join(folder, 'slope_b_AUC.json'))
# % g
g_Na = pd.DataFrame()
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN',
'STN_Kv', 'STN_Kv_only']
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate', 'Cb_stellate_Kv',
'Cb_stellate_Kv_only', 'STN', 'STN_Kv', 'STN_Kv_only']
for mod in models:
with open('./SA_summary_df/{}_g_AUC_rel_acc.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
with open('./SA_summary_df/{}_g_AUC.json'.format(mod)) as json_file:
g_Na[mod] = pd.read_json(json_file, convert_axes=False, convert_dates=False)['Na'].sort_index()
g_Na.index = g_Na.index.map(float)
g_Na.sort_index(inplace=True)
g_Na.replace(0., np.NaN, inplace=True)
g_Na = (g_Na - g_Na.loc[1.0, :]) / g_Na.loc[1.0, :]
g_Na.to_json(os.path.join(folder, 'g_Na_AUC_rel.json'))
g_Na.to_json(os.path.join(folder, 'g_Na_AUC.json'))
g_Kd = pd.DataFrame()
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN',
'STN_Kv', 'STN_Kv_only']
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate', 'Cb_stellate_Kv',
'Cb_stellate_Kv_only', 'STN', 'STN_Kv', 'STN_Kv_only']
for mod in models:
with open('./SA_summary_df/{}_g_AUC_rel_acc.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
with open('./SA_summary_df/{}_g_AUC.json'.format(mod)) as json_file:
g_Kd[mod] = pd.read_json(json_file, convert_axes=False, convert_dates=False)['Kd'].sort_index()
g_Kd.index = g_Kd.index.map(float)
g_Kd.sort_index(inplace=True)
g_Kd.replace(0., np.NaN, inplace=True)
g_Kd = (g_Kd - g_Kd.loc[1.0, :]) / g_Kd.loc[1.0, :]
g_Kd.to_json(os.path.join(folder, 'g_Kd_AUC_rel.json'))
g_Kd.to_json(os.path.join(folder, 'g_Kd_AUC.json'))
g_Kv = pd.DataFrame()
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN_Kv', 'STN_Kv_only']
models = ['RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN_Kv', 'STN_Kv_only']
for mod in models:
with open('./SA_summary_df/{}_g_AUC_rel_acc.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
with open('./SA_summary_df/{}_g_AUC.json'.format(mod)) as json_file:
g_Kv[mod] = pd.read_json(json_file, convert_axes=False, convert_dates=False)['Kv'].sort_index()
g_Kv.index = g_Kv.index.map(float)
g_Kv.sort_index(inplace=True)
g_Kv.replace(0., np.NaN, inplace=True)
g_Kv = (g_Kv - g_Kv.loc[1.0, :]) / g_Kv.loc[1.0, :]
g_Kv.to_json(os.path.join(folder, 'g_Kv_AUC_rel.json'))
g_Kv.to_json(os.path.join(folder, 'g_Kv_AUC.json'))
g_A = pd.DataFrame()
models = ['Cb_stellate', 'Cb_stellate_Kv', 'STN', 'STN_Kv']
for mod in models:
with open('./SA_summary_df/{}_g_AUC_rel_acc.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
with open('./SA_summary_df/{}_g_AUC.json'.format(mod)) as json_file:
g_A[mod] = pd.read_json(json_file, convert_axes=False, convert_dates=False)['A'].sort_index()
g_A.index = g_A.index.map(float)
g_A.sort_index(inplace=True)
g_A.replace(0., np.NaN, inplace=True)
g_A = (g_A - g_A.loc[1.0, :]) / g_A.loc[1.0, :]
g_A.to_json(os.path.join(folder, 'g_A_AUC_rel.json'))
g_A.to_json(os.path.join(folder, 'g_A_AUC.json'))
g_Leak = pd.DataFrame()
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN',
'STN_Kv', 'STN_Kv_only']
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate', 'Cb_stellate_Kv',
'Cb_stellate_Kv_only', 'STN', 'STN_Kv', 'STN_Kv_only']
for mod in models:
with open('./SA_summary_df/{}_g_AUC_rel_acc.json'.format(mod)) as json_file:
# data = pd.read_json(json_file)
with open('./SA_summary_df/{}_g_AUC.json'.format(mod)) as json_file:
g_Leak[mod] = pd.read_json(json_file, convert_axes=False, convert_dates=False)['Leak'].sort_index()
g_Leak.index = g_Leak.index.map(float)
g_Leak.sort_index(inplace=True)
g_Leak.replace(0., np.NaN, inplace=True)
g_Leak = (g_Leak - g_Leak.loc[1.0, :]) / g_Leak.loc[1.0, :]
g_Leak.to_json(os.path.join(folder, 'g_Leak_AUC_rel.json'))
#%% create JSON files for each alt type
# folder
top_dir = '/home/koch/SA_new'
# for each alt_type create pd df
shift_AUC = pd.DataFrame()
shift_rheo = pd.DataFrame()
shift_fI = pd.DataFrame(dtype=object)
shift_I_mag = pd.DataFrame(dtype=object)
g_Leak.to_json(os.path.join(folder, 'g_Leak_AUC.json'))
slope_AUC = pd.DataFrame()
slope_rheo = pd.DataFrame()
slope_fI = pd.DataFrame(dtype=object)
slope_I_mag = pd.DataFrame(dtype=object)
g_AUC = pd.DataFrame()
g_rheo = pd.DataFrame()
g_fI = pd.DataFrame(dtype=object)
g_I_mag = pd.DataFrame(dtype=object)
#%% todo: CREATE CSV FILES ###################################################################################################
#% AUC
print('SA pd gen')
dir_names = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN',
'STN_Kv', 'STN_Kv_only']
for dir_name in dir_names:
folder = os.path.join(top_dir, dir_name)
print(folder)
# for each alt_type create pd df
shift_AUC = pd.DataFrame()
shift_rheo = pd.DataFrame()
shift_fI = pd.DataFrame(dtype=object)
shift_I_mag = pd.DataFrame(dtype=object)
slope_AUC = pd.DataFrame()
slope_rheo = pd.DataFrame()
slope_fI = pd.DataFrame(dtype=object)
slope_I_mag = pd.DataFrame(dtype=object)
g_AUC = pd.DataFrame()
g_rheo = pd.DataFrame()
g_fI = pd.DataFrame(dtype=object)
g_I_mag = pd.DataFrame(dtype=object)
for root, dirs, files in os.walk(folder):
for file in files:
if file.endswith('.hdf5'):
with h5py.File(os.path.join(folder, file), "r+") as f:
alt = f['data'].attrs['alteration']
test = f['data'].attrs['alteration_info'].replace(' ', ',')
alt_info = literal_eval(test)
var = alt_info[0]
alt_type = alt_info[1]
if alt_type == 'shift':
shift_AUC.loc[alt, var] = f['analysis']['AUC'][()]
shift_rheo.loc[alt, var] = f['analysis']['rheobase'][()]
shift_fI.loc[alt, var] = 0
shift_fI = shift_fI.astype(object)
shift_fI.at[alt, var] = f['analysis']['F_inf'][:].tolist()
shift_I_mag.loc[alt, var] = 0
shift_I_mag = shift_I_mag.astype(object)
shift_I_mag.at[alt, var] = ((np.arange(f['data'].attrs['I_low'], f['data'].attrs['I_high'],
(f['data'].attrs['I_high'] - f['data'].attrs['I_low']) /
f['data'].attrs['stim_num'])) * 1000).tolist() # nA
elif alt_type == 'slope':
slope_AUC.loc[alt, var] = f['analysis']['AUC'][()]
slope_rheo.loc[alt, var] = f['analysis']['rheobase'][()]
slope_fI.loc[alt, var] = 0
slope_fI = slope_fI.astype(object)
slope_fI.at[alt, var] = f['analysis']['F_inf'][:].tolist()
slope_I_mag.loc[alt, var] = 0
slope_I_mag = slope_I_mag.astype(object)
slope_I_mag.at[alt, var] = ((np.arange(f['data'].attrs['I_low'], f['data'].attrs['I_high'],
(f['data'].attrs['I_high'] - f['data'].attrs['I_low']) /
f['data'].attrs['stim_num'])) * 1000).tolist()
elif alt_type == 'g':
g_AUC.loc[alt, var] = f['analysis']['AUC'][()]
g_rheo.loc[alt, var] = f['analysis']['rheobase'][()]
g_fI.loc[alt, var] = 0
g_fI = g_fI.astype(object)
g_fI.at[alt, var] = f['analysis']['F_inf'][:].tolist()
g_I_mag.loc[alt, var] = 0
g_I_mag = g_I_mag.astype(object)
g_I_mag.at[alt, var] = ((np.arange(f['data'].attrs['I_low'], f['data'].attrs['I_high'],
(f['data'].attrs['I_high'] - f['data'].attrs['I_low']) /
f['data'].attrs['stim_num'])) * 1000).tolist()
else:
print(file, 'Unknown alteration type')
# save df with folder+alt_type
save_folder = os.path.join(top_dir, 'SA_summary_df')
if not os.path.isdir(save_folder):
os.makedirs(save_folder)
shift_AUC.to_json(os.path.join(save_folder, '{}_shift_AUC.json'.format(dir_name)))
shift_rheo.to_json(os.path.join(save_folder, '{}_shift_rheo.json'.format(dir_name)))
shift_fI.to_json(os.path.join(save_folder, '{}_shift_fI.json'.format(dir_name)))
shift_I_mag.to_json(os.path.join(save_folder, '{}_shift_I_mag.json'.format(dir_name)))
slope_AUC.to_json(os.path.join(save_folder, '{}_slope_AUC.json'.format(dir_name)))
slope_rheo.to_json(os.path.join(save_folder, '{}_slope_rheo.json'.format(dir_name)))
slope_fI.to_json(os.path.join(save_folder, '{}_slope_fI.json'.format(dir_name)))
slope_I_mag.to_json(os.path.join(save_folder, '{}_slope_I_mag.json'.format(dir_name)))
g_AUC.to_json(os.path.join(save_folder, '{}_g_AUC.json'.format(dir_name)))
g_rheo.to_json(os.path.join(save_folder, '{}_g_rheo.json'.format(dir_name)))
g_fI.to_json(os.path.join(save_folder, '{}_g_fI.json'.format(dir_name)))
g_I_mag.to_json(os.path.join(save_folder, '{}_g_I_mag.json'.format(dir_name)))
#%% CREATE CSV FILES ###################################################################################################
#%% AUC
# from ./Code/From_Neuronal_models/tau_analysis/AUC_corr_df_gen.py
AUC_shift_df = pd.read_json('./Sensitivity_analysis/shift_box_kendall_corr_rel.json', orient='records')
AUC_slope_df = pd.read_json('./Sensitivity_analysis/slope_box_kendall_corr_rel.json', orient='records') #, lines=True)
AUC_g_df = pd.read_json('./Sensitivity_analysis/g_box_kendall_corr_rel.json', orient='records')
for i in np.array(['FS', 'IB', 'RS inhibitory', 'RS pyramidal']):
AUC_shift_df.loc[AUC_shift_df['model'] == i, 'model'] = i + ' +$K_V1.1$' # ''+$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'
AUC_slope_df.loc[AUC_slope_df['model'] == i, 'model'] = i + ' +$K_V1.1$' #' +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'
AUC_g_df.loc[AUC_g_df['model'] == i, 'model'] = i + ' +$K_V1.1$' #' +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'
# for i in np.array(['FS', 'IB', 'RS inhibitory', 'RS pyramidal']):
# AUC_shift_df.loc[AUC_shift_df['model'] == i, 'model'] = i + ' +$K_V1.1$' # ''+$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'
# AUC_slope_df.loc[AUC_slope_df['model'] == i, 'model'] = i + ' +$K_V1.1$' #' +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'
# AUC_g_df.loc[AUC_g_df['model'] == i, 'model'] = i + ' +$K_V1.1$' #' +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'
AUC_shift_df_posp = pd.read_json('./Sensitivity_analysis/shift_box_kendall_corr_rel_pospischil.json', orient='records')
AUC_slope_df_posp = pd.read_json('./Sensitivity_analysis/slope_box_kendall_corr_rel_pospischil.json', orient='records') #, lines=True)
@ -695,7 +638,7 @@ AUC_g_df.to_csv('AUC_g_corr.csv')
#%% rheo
#% rheo
rheo_shift_df = pd.read_json('./Sensitivity_analysis/rheo_shift_box_kendall_corr.json', orient='records')
rheo_slope_df = pd.read_json('./Sensitivity_analysis/rheo_slope_box_kendall_corr.json', orient='records') #, lines=True)
rheo_g_df = pd.read_json('./Sensitivity_analysis/rheo_g_box_kendall_corr.json', orient='records')

View File

@ -1,477 +0,0 @@
import pandas as pd
import h5py
import json
import os
import numpy as np
from ast import literal_eval
# todo: run some and test
# todo: develop consistent file structure
# todo: Model fI
# %% todo: Model fI
# for each model
# | (index) | mag | alt | type | F | I |
# | 0 | -10 | m | shift | array | array |
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate', 'Cb_stellate_Kv',
'Cb_stellate_Kv_only', 'STN', 'STN_Kv', 'STN_Kv_only']
model_names = ['RS pyramidal', 'RS inhibitory', 'FS', 'RS pyramidal +Kv1.1', 'RS inhibitory +Kv1.1', 'FS +Kv1.1',
'Cb stellate', 'Cb stellate +Kv1.1', 'Cb stellate $\Delta$Kv1.1', 'STN', 'STN +Kv1.1',
'STN $\Delta$Kv1.1']
# for each model get csv file with all shifts, scale and g
for model_name in models:
df = pd.DataFrame(columns=['mag', 'alt', 'type', 'F', 'I'])
folder = '../Neuron_models/{}'.format(model_name)
fname = os.path.join(folder, "{}.hdf5".format(model_name))
# for each alt in model
# with h5py.File(fname, "r+") as f:
# df.loc[model_name, 'alt'] = f['data'].attrs['alteration']
# test = f['data'].attrs['alteration_info'].replace(' ', ',')
# alt_info = literal_eval(test)
# var = alt_info[0]
# alt_type = alt_info[1]
# df.loc[model_name, 'mag'] = var
# df.loc[model_name, 'type'] = alt_type
# df.loc[model_name, 'F'] = f['analysis']['F_inf'][:]
# I_mag = np.arange(f['data'].attrs['I_low'], f['data'].attrs['I_high'],
# (f['data'].attrs['I_high'] - f['data'].attrs['I_low']) / f['data'].attrs['stim_num']) * 1000
# df.loc[model_name, 'I'] = I
# df.to_csv('./Model_fI/{}.csv'.format(model_name))
# %% todo: rheo/AUC_{}_corr
# | (index) | model | corr | p_value | g | color
rheo_corr = pd.DataFrame(columns=['model', 'corr', 'p_value', 'g', 'color'])
rheo_corr.to_csv('rheo_corr.csv')
AUC_corr = pd.DataFrame(columns=['model', 'corr', 'p_value', 'g', 'color'])
AUC_corr.to_csv('AUC_corr.csv')
# # AUC_shift = pd.DataFrame(columns=['alteration', 'RS Pyramidal','RS Inhibitory','FS','IB',
# # 'RS Pyramidal +$K_V1.1$','RS Inhibitory +$K_V1.1$',
# # 'FS +$K_V1.1$','IB +$K_V1.1$','Cb stellate','Cb stellate +$K_V1.1$',
# # 'Cb stellate $\Delta$$K_V1.1$','STN','STN +$K_V1.1$',
# # 'STN $\Delta$$K_V1.1$'])
# #
# # AUC_slope = pd.DataFrame(columns=['alteration','RS Pyramidal','RS Inhibitory','FS','IB','RS Pyramidal +$K_V1.1$','RS Inhibitory +$K_V1.1$',
# # 'FS +$K_V1.1$','IB +$K_V1.1$',
# # 'Cb stellate','Cb stellate +$K_V1.1$',
# # 'Cb stellate $\Delta$$K_V1.1$','STN','STN +$K_V1.1$',
# # 'STN $\Delta$$K_V1.1$'])
# #
# # AUC_g = pd.DataFrame(columns=['alteration','RS Pyramidal','RS Inhibitory','FS','IB','RS Pyramidal +$K_V1.1$','RS Inhibitory +$K_V1.1$',
# # 'FS +$K_V1.1$','IB +$K_V1.1$',
# # 'Cb stellate','Cb stellate +$K_V1.1$',
# # 'Cb stellate $\Delta$$K_V1.1$','STN','STN +$K_V1.1$',
# # 'STN $\Delta$$K_V1.1$'])
# #
# # script_dir = os.path.dirname(os.path.realpath("__file__"))
# # fname = os.path.join(script_dir, )
# # # f = h5py.File(fname, "r")
# #
# # models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB','Cb_stellate','Cb_stellate_Kv','Cb_stellate_Kv_only','STN','STN_Kv',
# # 'STN_Kv_only']
# # model_labels = ['RS Pyramidal +$K_V1.1$','RS Inhibitory +$K_V1.1$',
# # 'FS +$K_V1.1$','IB +$K_V1.1$','Cb stellate','Cb stellate +$K_V1.1$',
# # 'Cb stellate $\Delta$$K_V1.1$','STN','STN +$K_V1.1$',
# # 'STN $\Delta$$K_V1.1$']
# # posp_models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB']
# # posp_model_labels = ['RS Pyramidal','RS Inhibitory', 'FS','IB']
# #
# #
# # shift_interest = 'n'
# # for i in range(len(models)):
# # with open('./SA_summary_df/{}_shift_AUC_rel_acc.json'.format(models[i])) as json_file:
# # data = pd.read_json(json_file, convert_dates=False, convert_axes=False)
# # data.replace(0., np.NaN, inplace=True)
# # data = (data - data.loc['0', :])/ data.loc['0', :] # normalize AUC
# # data.sort_index(inplace=True)
# # AUC_shift[model_labels[i]] =data[shift_interest]
# # for i in range(len(posp_models)):
# # with open('./SA_summary_df_pospischil/{}_shift_AUC_rel_acc_pospischil.json'.format(models[i])) as json_file:
# # data = pd.read_json(json_file, convert_dates=False, convert_axes=False)
# # data.replace(0., np.NaN, inplace=True)
# # data = (data - data.loc['0', :])/ data.loc['0', :] # normalize AUC
# # data.sort_index(inplace=True)
# # AUC_shift[posp_model_labels[i]] =data[shift_interest]
# # AUC_shift['alteration'] = AUC_shift.index
# #
# #
# #
# # slope_interest = 's'
# # for i in range(len(models)):
# # with open('./SA_summary_df/{}_slope_AUC_rel_acc.json'.format(models[i])) as json_file:
# # data = pd.read_json(json_file, convert_dates=False, convert_axes=False)
# # data.replace(0., np.NaN, inplace=True)
# # data = (data - data.loc['1.0', :])/ data.loc['1.0', :] # normalize AUC
# # data.sort_index(inplace=True)
# # try:
# # AUC_slope[model_labels[i]] = data[slope_interest]
# # except:
# # pass
# # for i in range(len(posp_models)):
# # with open('./SA_summary_df_pospischil/{}_slope_AUC_rel_acc_pospischil.json'.format(models[i])) as json_file:
# #
# # data = pd.read_json(json_file, convert_dates=False, convert_axes=False)
# # data.replace(0., np.NaN, inplace=True)
# # data = (data - data.loc['1.0', :])/ data.loc['1.0', :] # normalize AUC
# # data.sort_index(inplace=True)
# # try:
# # AUC_slope[posp_model_labels[i]] =data[slope_interest]
# # except:
# # pass
# # AUC_slope['alteration'] = AUC_slope.index
# #
# # g_interest = 'Kd'
# # for i in range(len(models)):
# # with open('./SA_summary_df/{}_g_AUC_rel_acc.json'.format(models[i])) as json_file:
# # data = pd.read_json(json_file, convert_dates=False, convert_axes=False)
# # data.replace(0., np.NaN, inplace=True)
# # data = (data - data.loc['1.0', :])/ data.loc['1.0', :] # normalize AUC
# # data.sort_index(inplace=True)
# # AUC_g[model_labels[i]] =data[g_interest]
# # for i in range(len(posp_models)):
# # with open('./SA_summary_df_pospischil/{}_g_AUC_rel_acc_pospischil.json'.format(models[i])) as json_file:
# # data = pd.read_json(json_file, convert_dates=False, convert_axes=False)
# # data.replace(0., np.NaN, inplace=True)
# # data = (data - data.loc['1.0', :])/ data.loc['1.0', :] # normalize AUC
# # data.sort_index(inplace=True)
# # AUC_g[posp_model_labels[i]] =data[g_interest]
# # AUC_g['alteration'] = AUC_g.index
# #
# # AUC_shift.to_csv('AUC_shift_ex.csv')
# # AUC_slope.to_csv('AUC_slope_ex.csv')
# # AUC_g.to_csv('AUC_g_ex.csv')
#
#
# # rheo_shift = pd.DataFrame(columns=['alteration', 'RS Pyramidal', 'RS Inhibitory', 'FS', 'IB',
# # 'RS Pyramidal +$K_V1.1$','RS Inhibitory +$K_V1.1$',
# # 'FS +$K_V1.1$','IB +$K_V1.1$','Cb stellate',
# # 'Cb stellate +$K_V1.1$',
# # 'Cb stellate $\Delta$$K_V1.1$', 'STN',
# # 'STN +$K_V1.1$',
# # 'STN $\Delta$$K_V1.1$'])
# #
# # rheo_slope = pd.DataFrame(columns=['alteration', 'RS Pyramidal', 'RS Inhibitory', 'FS', 'IB','RS Pyramidal +$K_V1.1$',
# # 'RS Inhibitory +$K_V1.1$',
# # 'FS +$K_V1.1$','IB +$K_V1.1$',
# # 'Cb stellate',
# # 'Cb stellate +$K_V1.1$',
# # 'Cb stellate $\Delta$$K_V1.1$', 'STN',
# # 'STN +$K_V1.1$',
# # 'STN $\Delta$$K_V1.1$'])
# #
# # rheo_g = pd.DataFrame(columns=['alteration', 'RS Pyramidal', 'RS Inhibitory', 'FS', 'IB',
# # 'RS Pyramidal +$K_V1.1$','RS Inhibitory +$K_V1.1$',
# # 'FS +$K_V1.1$','IB +$K_V1.1$','Cb stellate',
# # 'Cb stellate +$K_V1.1$',
# # 'Cb stellate $\Delta$$K_V1.1$', 'STN',
# # 'STN +$K_V1.1$',
# # 'STN $\Delta$$K_V1.1$'])
# #
# # script_dir = os.path.dirname(os.path.realpath("__file__"))
# # fname = os.path.join(script_dir, )
# # # f = h5py.File(fname, "r")
# #
# # models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB', 'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN',
# # 'STN_Kv',
# # 'STN_Kv_only']
# # model_labels = ['RS Pyramidal +$K_V1.1$', 'RS Inhibitory +$K_V1.1$', 'FS +$K_V1.1$', 'IB +$K_V1.1$', 'Cb stellate',
# # 'Cb stellate +$K_V1.1$',
# # 'Cb stellate $\Delta$$K_V1.1$', 'STN',
# # 'STN +$K_V1.1$',
# # 'STN $\Delta$$K_V1.1$']
# # posp_models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB']
# # posp_model_labels = ['RS Pyramidal','RS Inhibitory', 'FS','IB']
# #
# # shift_interest = 's'
# # for i in range(len(models)):
# # with open('./SA_summary_df/{}_shift_rheo.json'.format(models[i])) as json_file:
# # data = pd.read_json(json_file, convert_dates=False, convert_axes=False)
# # data.replace(0., np.NaN, inplace=True)
# # data = (data - data.loc['0', :]) #/ data.loc['0', :] # normalize AUC
# # data.sort_index(inplace=True)
# # try:
# # rheo_shift[model_labels[i]] = data[shift_interest]
# # except:
# # pass
# # for i in range(len(posp_models)):
# # with open('./SA_summary_df_pospischil/{}_shift_rheo_pospischil.json'.format(models[i])) as json_file:
# # data = pd.read_json(json_file, convert_dates=False, convert_axes=False)
# # data.replace(0., np.NaN, inplace=True)
# # data = (data - data.loc['0', :]) #/ data.loc['0', :] # normalize AUC
# # data.sort_index(inplace=True)
# # try:
# # rheo_shift[posp_model_labels[i]] = data[shift_interest]
# # except:
# # pass
# # rheo_shift['alteration'] = rheo_shift.index
# #
# # slope_interest = 'u'
# # for i in range(len(models)):
# # with open('./SA_summary_df/{}_slope_rheo.json'.format(models[i])) as json_file:
# #
# # data = pd.read_json(json_file, convert_dates=False, convert_axes=False)
# # data.replace(0., np.NaN, inplace=True)
# # data = (data - data.loc['1.0', :]) #/ data.loc['1.0', :] # normalize AUC
# # data.sort_index(inplace=True)
# # try:
# # rheo_slope[model_labels[i]] = data[slope_interest]
# # except:
# # pass
# # for i in range(len(posp_models)):
# # with open('./SA_summary_df_pospischil/{}_slope_rheo_pospischil.json'.format(models[i])) as json_file:
# # data = pd.read_json(json_file, convert_dates=False, convert_axes=False)
# # data.replace(0., np.NaN, inplace=True)
# # data = (data - data.loc['1.0', :]) #/ data.loc['1.0', :] # normalize AUC
# # data.sort_index(inplace=True)
# # # if models[i] == 'STN_Kv_only' or models[i] == 'Cb_stellate_Kv_only':
# # # data = data.drop(columns=['A'])
# # try:
# # rheo_slope[posp_model_labels[i]] = data[slope_interest]
# # except:
# # pass
# # rheo_slope['alteration'] = rheo_slope.index
# #
# # g_interest = 'Leak'
# # for i in range(len(models)):
# # with open('./SA_summary_df/{}_g_rheo.json'.format(models[i])) as json_file:
# # data = pd.read_json(json_file, convert_dates=False, convert_axes=False)
# # data.replace(0., np.NaN, inplace=True)
# # data = (data - data.loc['1.0', :]) #/ data.loc['1.0', :] # normalize AUC
# # data.sort_index(inplace=True)
# # rheo_g[model_labels[i]] = data[g_interest]
# # for i in range(len(posp_models)):
# # with open('./SA_summary_df_pospischil/{}_g_rheo_pospischil.json'.format(models[i])) as json_file:
# # data = pd.read_json(json_file, convert_dates=False, convert_axes=False)
# # data.replace(0., np.NaN, inplace=True)
# # data = (data - data.loc['1.0', :]) #/ data.loc['1.0', :] # normalize AUC
# # data.sort_index(inplace=True)
# # rheo_g[posp_model_labels[i]] = data[g_interest]
# # rheo_g['alteration'] = rheo_g.index
# #
# #
# # rheo_shift.to_csv('rheo_shift_ex.csv')
# # rheo_slope.to_csv('rheo_slope_ex.csv')
# # rheo_g.to_csv('rheo_g_ex.csv')
#
# %% firing_values.csv,model_spiking.csv, model_F_inf.csv
import numpy as np
import pandas as pd
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate', 'Cb_stellate_Kv',
'Cb_stellate_Kv_only', 'STN', 'STN_Kv', 'STN_Kv_only']
model_names = ['RS pyramidal', 'RS inhibitory', 'FS', 'RS pyramidal +Kv1.1', 'RS inhibitory +Kv1.1', 'FS +Kv1.1',
'Cb stellate', 'Cb stellate +Kv1.1', 'Cb stellate $\Delta$Kv1.1', 'STN', 'STN +Kv1.1',
'STN $\Delta$Kv1.1']
firing_values = pd.DataFrame(columns=models, index=['spike_ind', 'ramp_up', 'ramp_down'])
# firing_values.loc['spike_ind', :] = np.array(
# [0.3, 0.04375, 0.25, 0.3, 0.0875, 0.25, 0.3, 0.65, 0.375, 0.125, 0.475, 0.4])
models = ['RS_pyr', 'RS_pyr_Kv', 'RS_inhib', 'RS_inhib_Kv', 'FS', 'FS_Kv',
'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Delta_Kv',
'STN', 'STN_Kv', 'STN_Delta_Kv']
col_names = ['I', 'I_inhib']
for mod in models: col_names.append(mod)
model_F_inf = pd.DataFrame(columns=col_names)
col_names = ['t']
for mod in models: col_names.append(mod)
spiking = pd.DataFrame(columns=col_names)
# index for example trace
spike_ind = {'RS_pyramidal': 60, 'RS_inhib':25, 'FS':50, 'RS_pyramidal_Kv':60,
'RS_inhib_Kv':50, 'FS_Kv':50, 'Cb_stellate':60, 'Cb_stellate_Kv':130,
'Cb_stellate_Kv_only':75, 'STN': 25, 'STN_Kv':95, 'STN_Kv_only':80}
for model_name in models:
folder = '../Neuron_models/{}'.format(model_name)
fname = os.path.join(folder, "{}.hdf5".format(model_name)) # RS_inhib
with h5py.File(fname, "r+") as f:
I_mag = np.arange(f['data'].attrs['I_low'], f['data'].attrs['I_high'],
(f['data'].attrs['I_high'] - f['data'].attrs['I_low']) / f['data'].attrs['stim_num']) * 1000
start = np.int(f['data'].attrs['initial_period'] * 1 / f['data'].attrs['dt'])
stim_len = np.int((f['data'].attrs['stim_time'] - start) * f['data'].attrs['dt'])
time = np.arange(0, stim_len, f['data'].attrs['dt'])
spiking[model_name] = f['data']['V_m'][spike_ind[model_name]][start:]
model_F_inf[model_name] = f['analysis']['F_inf'][:]
firing_values.loc['spike_ind', model_name] = I_mag[spike_ind[model_name]]
firing_values.loc['ramp_down', model_name] = f['analysis']['ramp_I_down'][()]
firing_values.loc['ramp_up', model_name] = f['analysis']['ramp_I_up'][()]
firing_values.to_csv('firing_values.csv')
spiking.to_csv('model_spiking.csv')
model_F_inf.to_csv('model_F_inf.csv')
# %% model_ramp.csv
# | (index) | t | models ....
import numpy as np
import pandas as pd
models = ['RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN',
'STN_Kv', 'STN_Kv_only']
model_names = ['RS pyramidal', 'RS inhibitory', 'FS', 'Cb stellate', 'Cb stellate +Kv1.1', 'Cb stellate $\Delta$Kv1.1',
'STN', 'STN +Kv1.1', 'STN $\Delta$Kv1.1']
col_names = ['t']
for mod in models: col_names.append(mod)
model_ramp = pd.DataFrame(columns=col_names)
sec = 4
dt = 0.01
ramp_len = int(sec * 1000 * 1 / dt)
t_ramp = np.arange(0, ramp_len) * dt
model_ramp.loc[:, 't'] = t_ramp
for model_name in models:
folder = '../Neuron_models/{}'.format(model_name)
fname = os.path.join(folder, "{}.hdf5".format(model_name)) # RS_inhib
with h5py.File(fname, "r+") as f:
model_ramp.loc[:, model_name] = f['analysis']['V_m_ramp'][()]
model_ramp.to_csv('model_ramp.csv')
# %% sim_mut_AUC.csv, sim_mut_rheo.csv
# generate mutation plot data
mutations = json.load(open("../mutations_effects_dict.json"))
keys_to_remove = ['V408L', 'T226R', 'R239S', 'R324T']
for key in keys_to_remove:
del mutations[key]
mutations_f = []
mutations_n = []
for mut in mutations:
mutations_n.append(mut)
mutations_f.append(mut.replace(" ", "_"))
models = ['RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN',
'STN_Kv', 'STN_Kv_only']
model_names = ['RS pyramidal', 'RS inhibitory', 'FS', 'Cb stellate', 'Cb stellate +Kv1.1', 'Cb stellate $\Delta$Kv1.1',
'STN', 'STN +Kv1.1', 'STN $\Delta$Kv1.1']
AUC = pd.DataFrame(columns=mutations_n)
rheobase = pd.DataFrame(columns=mutations_n)
save_folder = '../KCNA1_mutations'
if not os.path.isdir(save_folder):
os.makedirs(save_folder)
for model_name in models:
folder = '../KCNA1_mutations/{}'.format(model_name)
for mut in list(mutations_n):
fname = os.path.join(folder, "{}.hdf5".format(mut.replace(" ", "_")))
with h5py.File(fname, "r+") as f:
rheobase.loc[mut.replace(" ", "_"), model_name] = f['analysis']['rheobase'][()]
AUC.loc[mut.replace(" ", "_"), model_name] = f['analysis']['AUC'][()]
AUC.replace(0., np.NaN, inplace=True)
rheobase.replace(0., np.NaN, inplace=True)
rheobase = (rheobase - rheobase.loc['WT', :]) /rheobase.loc['WT', :]
AUC = (AUC - AUC.loc['WT', :]) /AUC.loc['WT', :]
AUC.to_csv(os.path.join(save_folder, 'sim_mut_AUC.csv'))
rheobase.to_csv(os.path.join(save_folder, 'sim_mut_rheobase.csv'))
#########################################################################################################################
#########################################################################################################################
#########################################################################################################################
#########################################################################################################################
#########################################################################################################################
#########################################################################################################################
#########################################################################################################################
#########################################################################################################################
#%% sim_mut_rheo.csv, sim_mut_AUC.csv
# models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB','Cb_stellate','Cb_stellate_Kv','Cb_stellate_Kv_only','STN','STN_Kv','STN_Kv_only']
# mutations = json.load(open("./mutations_effects_dict.json"))
# mutations2 = []
# for mut in mutations:
# mutations2.append(mut.replace(" ", "_"))
# AUC_total = pd.DataFrame(columns=list(mutations2), index=models)
# AUC_rel_total = pd.DataFrame(columns=list(mutations2), index=models)
# rheo_total = pd.DataFrame(columns=list(mutations2), index=models)
# rheo_fit_total = pd.DataFrame(columns=list(mutations2), index=models)
# for mod in models:
# print(mod)
# with open('./mut_summary_df/{}_AUC.json'.format(mod)) as json_file:
# df = pd.read_json(json_file, convert_dates=False, convert_axes=False)
# # df[mutations2].to_json('./mut_summary_df/{}_AUC.json'.format(mod))
# AUC_total.loc[mod, :] = df.loc['0',:]
# with open('./mut_summary_df/{}_AUC_rel.json'.format(mod)) as json_file:
# df = pd.read_json(json_file, convert_dates=False, convert_axes=False)
# # df[mutations2].to_json('./mut_summary_df/{}_AUC.json'.format(mod))
# AUC_rel_total.loc[mod, :] = df.loc['0',:]
# with open('./mut_summary_df/{}_rheobase.json'.format(mod)) as json_file:
# df = pd.read_json(json_file, convert_dates=False, convert_axes=False)
# # df[mutations2].to_json('./mut_summary_df/{}_AUC.json'.format(mod))
# rheo_total.loc[mod, :] = df.loc['0',:]
# with open('./mut_summary_df/{}_rheobase_fit.json'.format(mod)) as json_file:
# df = pd.read_json(json_file, convert_dates=False, convert_axes=False)
# # df[mutations2].to_json('./mut_summary_df/{}_AUC.json'.format(mod))
# rheo_fit_total.loc[mod, :] = df.loc['0',:]
#
# # AUC_diff = (AUC_score.subtract(AUC_score['wt'], axis =0))#.divide(AUC_score['wt'], axis=0)
# AUC_total.to_json('mutation_AUC_summary.json')
# AUC_rel_total.to_json('mutation_AUC_rel_summary.json')
# rheo_total.to_json('mutation_rheo_summary.json')
# rheo_fit_total.to_json('mutation_rheo_fit_summary.json')
# models = ['RS_pyramidal', 'RS_inhib', 'FS', 'IB','Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN',
# 'STN_Kv', 'STN_Kv_only']
# model_names = ['RS pyramidal', 'RS inhibitory', 'FS', 'IB', 'Cb stellate', 'Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
# 'Cb stellate $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$', 'STN', 'STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$', 'STN $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$']
#
# all_mut_rheo = pd.DataFrame(columns=[model_names])
# all_mut_AUC = pd.DataFrame(columns=[model_names])
# for mod in range(len(models)):
# AUC = pd.read_json('./CBZ_summary_df/{}_CBZ_AUC_rel_acc.json'.format(models[mod]), convert_axes=False,
# convert_dates=False)
# rheo = pd.read_json('./CBZ_summary_df/{}_CBZ_rheobase.json'.format(models[mod]), convert_axes=False,
# convert_dates=False)
# AUC.index = AUC.index.astype(float)
#
# rheo.index = rheo.index.astype(float)
#
# conc = np.array(AUC.index)
# mut_names = AUC.columns
# for m in mut_names:
# rheo[m] = rheo[m].map(lambda x: x[0])
# AUC[m] = AUC[m].map(lambda x: x[0])
# AUC.replace(0., np.NaN, inplace=True)
# rheo.replace(0., np.NaN, inplace=True)
# AUC = (AUC - AUC.loc[0, 'wt']) / AUC.loc[0, :] # normalize AUC
# AUC.sort_index(inplace=True)
# rheo = (rheo - rheo.loc[0, 'wt'])#/ rheo.loc[0, :] # normalize AUC
# rheo.sort_index(inplace=True)
#
#
# for mut in mut_names: # for each mutation
# x_mut = rheo.loc[:, mut.replace(" ", "_")]
# y_mut = AUC.loc[:, mut.replace(" ", "_")]
#
# all_mut_rheo[model_names[mod]] = rheo.loc[0.0, mut_names]
# all_mut_AUC[model_names[mod]] = AUC.loc[0.0, mut_names]
#
#
#
# all_mut_rheo.to_csv('sim_mut_rheo.csv')
# all_mut_AUC.to_csv('sim_mut_AUC.csv')
# # %% model_F_inf.csv
# # | (index) | I | I_inhib | models ....
#
# # models
# models = ['RS_pyr', 'RS_pyr_Kv', 'RS_inhib', 'RS_inhib_Kv', 'FS', 'FS_Kv',
# 'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Delta_Kv',
# 'STN', 'STN_Kv', 'STN_Delta_Kv']
# col_names = ['I', 'I_inhib']
# for mod in models: col_names.append(mod)
# model_F_inf = pd.DataFrame(columns=col_names)
# folder = '../Neuron_models'
# with h5py.File(os.path.join(folder, "RS_pyr.hdf5"), "r+") as f:
# model_F_inf['I'] = np.arange(f['data'].attrs['low'][()], f['data'].attrs['high'][()],
# (f['data'].attrs['high'][()] - f['data'].attrs['low'][()]) /
# f['data'].attrs['stim_num'][()])
# with h5py.File(os.path.join(folder, "RS_inhib.hdf5"), "r+") as f:
# model_F_inf['I_inhib'] = np.arange(f['data'].attrs['low'][()], f['data'].attrs['high'][()],
# (f['data'].attrs['high'][()] - f['data'].attrs['low'][()]) /
# f['data'].attrs['stim_num'][()])
#
# for model_name in models:
# fname = os.path.join(folder, "{}.hdf5".format(model_name)) # RS_inhib
# with h5py.File(fname, "r+") as f:
# model_F_inf[model_name] = f['analysis']['F_inf'][()]
#
# # save df
# model_F_inf.to_csv('model_F_inf.csv')

View File

@ -0,0 +1,153 @@
import pandas as pd
import h5py
import json
import os
import numpy as np
from ast import literal_eval
# todo: run some and test
# todo: Model fI, rheo_{}_corr, AUC_{}_corr
# %% todo: Model fI
# for each model
# | (index) | mag | alt | type | F | I |
# | 0 | -10 | m | shift | array | array |
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate', 'Cb_stellate_Kv',
'Cb_stellate_Kv_only', 'STN', 'STN_Kv', 'STN_Kv_only']
model_names = ['RS pyramidal', 'RS inhibitory', 'FS', 'RS pyramidal +Kv1.1', 'RS inhibitory +Kv1.1', 'FS +Kv1.1',
'Cb stellate', 'Cb stellate +Kv1.1', 'Cb stellate $\Delta$Kv1.1', 'STN', 'STN +Kv1.1',
'STN $\Delta$Kv1.1']
# for each model get csv file with all shifts, scale and g
for model_name in models:
df = pd.DataFrame(columns=['mag', 'alt', 'type', 'F', 'I'])
folder = '../Neuron_models/{}'.format(model_name)
fname = os.path.join(folder, "{}.hdf5".format(model_name))
# for each alt in model
# with h5py.File(fname, "r+") as f:
# df.loc[model_name, 'alt'] = f['data'].attrs['alteration']
# test = f['data'].attrs['alteration_info'].replace(' ', ',')
# alt_info = literal_eval(test)
# var = alt_info[0]
# alt_type = alt_info[1]
# df.loc[model_name, 'mag'] = var
# df.loc[model_name, 'type'] = alt_type
# df.loc[model_name, 'F'] = f['analysis']['F_inf'][:]
# I_mag = np.arange(f['data'].attrs['I_low'], f['data'].attrs['I_high'],
# (f['data'].attrs['I_high'] - f['data'].attrs['I_low']) / f['data'].attrs['stim_num']) * 1000
# df.loc[model_name, 'I'] = I
# df.to_csv('./Model_fI/{}.csv'.format(model_name))
# %% todo: rheo/AUC_{}_corr
# | (index) | model | corr | p_value | g | color
rheo_corr = pd.DataFrame(columns=['model', 'corr', 'p_value', 'g', 'color'])
rheo_corr.to_csv('rheo_corr.csv')
AUC_corr = pd.DataFrame(columns=['model', 'corr', 'p_value', 'g', 'color'])
AUC_corr.to_csv('AUC_corr.csv')
# %% firing_values.csv,model_spiking.csv, model_F_inf.csv # DONE ####################################################
import numpy as np
import pandas as pd
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate', 'Cb_stellate_Kv',
'Cb_stellate_Kv_only', 'STN', 'STN_Kv', 'STN_Kv_only']
model_names = ['RS pyramidal', 'RS inhibitory', 'FS', 'RS pyramidal +Kv1.1', 'RS inhibitory +Kv1.1', 'FS +Kv1.1',
'Cb stellate', 'Cb stellate +Kv1.1', 'Cb stellate $\Delta$Kv1.1', 'STN', 'STN +Kv1.1',
'STN $\Delta$Kv1.1']
firing_values = pd.DataFrame(columns=models, index=['spike_ind', 'ramp_up', 'ramp_down'])
# firing_values.loc['spike_ind', :] = np.array(
# [0.3, 0.04375, 0.25, 0.3, 0.0875, 0.25, 0.3, 0.65, 0.375, 0.125, 0.475, 0.4])
models = ['RS_pyr', 'RS_pyr_Kv', 'RS_inhib', 'RS_inhib_Kv', 'FS', 'FS_Kv',
'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Delta_Kv',
'STN', 'STN_Kv', 'STN_Delta_Kv']
col_names = ['I', 'I_inhib']
for mod in models: col_names.append(mod)
model_F_inf = pd.DataFrame(columns=col_names)
col_names = ['t']
for mod in models: col_names.append(mod)
spiking = pd.DataFrame(columns=col_names)
# index for example trace
spike_ind = {'RS_pyramidal': 60, 'RS_inhib':25, 'FS':50, 'RS_pyramidal_Kv':60,
'RS_inhib_Kv':50, 'FS_Kv':50, 'Cb_stellate':60, 'Cb_stellate_Kv':130,
'Cb_stellate_Kv_only':75, 'STN': 25, 'STN_Kv':95, 'STN_Kv_only':80}
for model_name in models:
folder = '../Neuron_models/{}'.format(model_name)
fname = os.path.join(folder, "{}.hdf5".format(model_name)) # RS_inhib
with h5py.File(fname, "r+") as f:
I_mag = np.arange(f['data'].attrs['I_low'], f['data'].attrs['I_high'],
(f['data'].attrs['I_high'] - f['data'].attrs['I_low']) / f['data'].attrs['stim_num']) * 1000
start = np.int(f['data'].attrs['initial_period'] * 1 / f['data'].attrs['dt'])
stim_len = np.int((f['data'].attrs['stim_time'] - start) * f['data'].attrs['dt'])
time = np.arange(0, stim_len, f['data'].attrs['dt'])
spiking[model_name] = f['data']['V_m'][spike_ind[model_name]][start:]
model_F_inf[model_name] = f['analysis']['F_inf'][:]
firing_values.loc['spike_ind', model_name] = I_mag[spike_ind[model_name]]
firing_values.loc['ramp_down', model_name] = f['analysis']['ramp_I_down'][()]
firing_values.loc['ramp_up', model_name] = f['analysis']['ramp_I_up'][()]
firing_values.to_csv('firing_values.csv')
spiking.to_csv('model_spiking.csv')
model_F_inf.to_csv('model_F_inf.csv')
# %% model_ramp.csv # DONE #########################################################################
# | (index) | t | models ....
import numpy as np
import pandas as pd
models = ['RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN',
'STN_Kv', 'STN_Kv_only']
model_names = ['RS pyramidal', 'RS inhibitory', 'FS', 'Cb stellate', 'Cb stellate +Kv1.1', 'Cb stellate $\Delta$Kv1.1',
'STN', 'STN +Kv1.1', 'STN $\Delta$Kv1.1']
col_names = ['t']
for mod in models: col_names.append(mod)
model_ramp = pd.DataFrame(columns=col_names)
sec = 4
dt = 0.01
ramp_len = int(sec * 1000 * 1 / dt)
t_ramp = np.arange(0, ramp_len) * dt
model_ramp.loc[:, 't'] = t_ramp
for model_name in models:
folder = '../Neuron_models/{}'.format(model_name)
fname = os.path.join(folder, "{}.hdf5".format(model_name)) # RS_inhib
with h5py.File(fname, "r+") as f:
model_ramp.loc[:, model_name] = f['analysis']['V_m_ramp'][()]
model_ramp.to_csv('model_ramp.csv')
#%% sim_mut_AUC.csv, sim_mut_rheo.csv # DONE #########################################################################
# generate mutation plot data
mutations = json.load(open("../mutations_effects_dict.json"))
keys_to_remove = ['V408L', 'T226R', 'R239S', 'R324T']
for key in keys_to_remove:
del mutations[key]
mutations_f = []
mutations_n = []
for mut in mutations:
mutations_n.append(mut)
mutations_f.append(mut.replace(" ", "_"))
models = ['RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN',
'STN_Kv', 'STN_Kv_only']
model_names = ['RS pyramidal', 'RS inhibitory', 'FS', 'Cb stellate', 'Cb stellate +Kv1.1', 'Cb stellate $\Delta$Kv1.1',
'STN', 'STN +Kv1.1', 'STN $\Delta$Kv1.1']
AUC = pd.DataFrame(columns=mutations_n)
rheobase = pd.DataFrame(columns=mutations_n)
save_folder = '../KCNA1_mutations'
if not os.path.isdir(save_folder):
os.makedirs(save_folder)
for model_name in models:
folder = '../KCNA1_mutations/{}'.format(model_name)
for mut in list(mutations_n):
fname = os.path.join(folder, "{}.hdf5".format(mut.replace(" ", "_")))
with h5py.File(fname, "r+") as f:
rheobase.loc[mut.replace(" ", "_"), model_name] = f['analysis']['rheobase'][()]
AUC.loc[mut.replace(" ", "_"), model_name] = f['analysis']['AUC'][()]
AUC.replace(0., np.NaN, inplace=True)
rheobase.replace(0., np.NaN, inplace=True)
rheobase = (rheobase - rheobase.loc['WT', :]) /rheobase.loc['WT', :]
AUC = (AUC - AUC.loc['WT', :]) /AUC.loc['WT', :]
AUC.to_csv(os.path.join(save_folder, 'sim_mut_AUC.csv'))
rheobase.to_csv(os.path.join(save_folder, 'sim_mut_rheobase.csv'))
#########################################################################################################################

View File

@ -0,0 +1,297 @@
import numpy as np
import h5py
import pandas as pd
import os
from ast import literal_eval
import json
import scipy.stats as stats
# folder
top_dir = '../Sensitivity_Analysis'
#%% create JSON files for each alt type
for dir_name in next(os.walk(top_dir))[1]:
folder = os.path.join(top_dir, dir_name)
print(folder)
# for each alt_type create pd df
shift_AUC = pd.DataFrame()
shift_rheo = pd.DataFrame()
shift_fI = pd.DataFrame(dtype=object)
shift_I_mag = pd.DataFrame(dtype=object)
slope_AUC = pd.DataFrame()
slope_rheo = pd.DataFrame()
slope_fI = pd.DataFrame(dtype=object)
slope_I_mag = pd.DataFrame(dtype=object)
g_AUC = pd.DataFrame()
g_rheo = pd.DataFrame()
g_fI = pd.DataFrame(dtype=object)
g_I_mag = pd.DataFrame(dtype=object)
for root, dirs, files in os.walk(folder):
for file in files:
if file.endswith('.hdf5'):
with h5py.File(os.path.join(folder, file), "r+") as f:
alt = f['data'].attrs['alteration']
test = f['data'].attrs['alteration_info'].replace(' ', ',')
alt_info = literal_eval(test)
var = alt_info[0]
alt_type = alt_info[1]
if alt_type == 'shift':
shift_AUC.loc[alt, var] = f['analysis']['AUC'][()]
try:
shift_rheo.loc[alt, var] = f['analysis']['rheobase'][()]
except:
print('shift', var, alt)
shift_fI.loc[alt, var] = 0
shift_fI = shift_fI.astype(object)
shift_fI.at[alt, var] = f['analysis']['F_inf'][:].tolist()
shift_I_mag.loc[alt, var] = 0
shift_I_mag = shift_I_mag.astype(object)
shift_I_mag.at[alt, var] = ((np.arange(f['data'].attrs['I_low'], f['data'].attrs['I_high'],
(f['data'].attrs['I_high'] - f['data'].attrs['I_low']) /
f['data'].attrs['stim_num'])) * 1000).tolist() #nA
elif alt_type == 'slope':
slope_AUC.loc[alt, var] = f['analysis']['AUC'][()]
try:
slope_rheo.loc[alt, var] = f['analysis']['rheobase'][()]
except:
print('slope', var, alt)
slope_fI.loc[alt, var] = 0
slope_fI = slope_fI.astype(object)
slope_fI.at[alt, var] = f['analysis']['F_inf'][:].tolist()
slope_I_mag.loc[alt, var] = 0
slope_I_mag = slope_I_mag.astype(object)
slope_I_mag.at[alt, var] = ((np.arange(f['data'].attrs['I_low'], f['data'].attrs['I_high'],
(f['data'].attrs['I_high'] - f['data'].attrs['I_low']) /
f['data'].attrs['stim_num'])) * 1000).tolist()
elif alt_type == 'g':
g_AUC.loc[alt, var] = f['analysis']['AUC'][()]
try:
g_rheo.loc[alt, var] = f['analysis']['rheobase'][()]
except:
print('g', var, alt)
g_fI.loc[alt, var] = 0
g_fI = g_fI.astype(object)
g_fI.at[alt, var] = f['analysis']['F_inf'][:].tolist()
g_I_mag.loc[alt, var] = 0
g_I_mag = g_I_mag.astype(object)
g_I_mag.at[alt, var] = ((np.arange(f['data'].attrs['I_low'], f['data'].attrs['I_high'],
(f['data'].attrs['I_high'] - f['data'].attrs['I_low']) /
f['data'].attrs['stim_num'])) * 1000).tolist()
else:
print(file, 'Unknown alteration type')
#save df with folder+alt_type
save_folder = os.path.join(top_dir, 'SA_summary_df')
if not os.path.isdir(save_folder):
os.makedirs(save_folder)
shift_AUC.to_json(os.path.join(save_folder, '{}_shift_AUC.json'.format(dir_name)))
shift_rheo.to_json(os.path.join(save_folder, '{}_shift_rheo.json'.format(dir_name)))
shift_fI.to_json(os.path.join(save_folder, '{}_shift_fI.json'.format(dir_name)))
shift_I_mag.to_json(os.path.join(save_folder, '{}_shift_I_mag.json'.format(dir_name)))
slope_AUC.to_json(os.path.join(save_folder, '{}_slope_AUC.json'.format(dir_name)))
slope_rheo.to_json(os.path.join(save_folder, '{}_slope_rheo.json'.format(dir_name)))
slope_fI.to_json(os.path.join(save_folder, '{}_slope_fI.json'.format(dir_name)))
slope_I_mag.to_json(os.path.join(save_folder, '{}_slope_I_mag.json'.format(dir_name)))
g_AUC.to_json(os.path.join(save_folder, '{}_g_AUC.json'.format(dir_name)))
g_rheo.to_json(os.path.join(save_folder, '{}_g_rheo.json'.format(dir_name)))
g_fI.to_json(os.path.join(save_folder, '{}_g_fI.json'.format(dir_name)))
g_I_mag.to_json(os.path.join(save_folder, '{}_g_I_mag.json'.format(dir_name)))
#%% AUC Correlation analysis
alt_dict = {}
alt_dict['m'] = 'Na activation'
alt_dict['h'] = 'Na inactivation'
alt_dict['n'] = 'K activation'
alt_dict['s'] = '$K_V1.1$ activation'
alt_dict['u'] = '$K_V1.1$inactivation'
alt_dict['a'] = 'A activation'
alt_dict['b'] = 'A inactivation'
alt_dict['n_A'] = 'A activation'
alt_dict['h_A'] = 'A inactivation'
alt_dict['Na'] = 'Na'
alt_dict['Kd'] = 'K'
alt_dict['Kv'] = '$K_V1.1$'
alt_dict['A'] = 'A'
alt_dict['Leak'] = 'Leak'
models =['RS_pyramidal', 'RS_inhib', 'FS', 'IB','Cb_stellate','Cb_stellate_Kv','Cb_stellate_Kv_only','STN','STN_Kv','STN_Kv_only']
model_names = ['RS pyramidal', 'RS inhibitory', 'FS', 'IB','Cb stellate','Cb stellate +$K_V1.1$','Cb stellate $\Delta$$K_V1.1$','STN','STN +$K_V1.1$','STN $\Delta$$K_V1.1$']
shift_df = pd.DataFrame(columns=['model', 'corr', 'p_value', 'local corr', 'local p_value', 'ratio', '$\Delta V_{1/2}$', 'color']) # for boxplots
for mod in range(len(models)):
with open('./SA_summary_df/{}_shift_AUC.json'.format(models[mod])) as json_file:
df = pd.read_json(json_file)
df.sort_index(inplace=True)
df.replace(0., np.NaN, inplace=True)
df = (df - df.loc[0, :]) / df.loc[0, :]
zero_ind = np.argwhere(df.index == 0)[0][0]
ind = [df.index[zero_ind - 1], df.index[zero_ind], df.index[zero_ind + 1]]
df2 = df.loc[ind, :]
for c in df.keys():
tau, p = stats.kendalltau(df.index, df[c], nan_policy='omit')
tau_l, p_l = stats.kendalltau(df2.index, df2[c], nan_policy='omit')
ratio_tau = tau_l / tau
shift_df = shift_df.append(pd.Series([model_names[mod], tau, p,tau_l, p_l, ratio_tau, alt_dict[c],clr_dict[models[mod]]], index=shift_df.columns), ignore_index=True)
models =['RS_pyramidal', 'RS_inhib', 'FS', 'IB','Cb_stellate','Cb_stellate_Kv','Cb_stellate_Kv_only','STN','STN_Kv','STN_Kv_only']
model_names = ['RS pyramidal', 'RS inhibitory', 'FS', 'IB','Cb stellate','Cb stellate +$K_V1.1$','Cb stellate $\Delta$$K_V1.1$','STN','STN +$K_V1.1$','STN $\Delta$$K_V1.1$']
slope_df = pd.DataFrame(columns=['model', 'corr', 'p_value','local corr', 'local p_value', 'ratio', 'Slope (k)', 'color']) # for boxplots
for mod in range(len(models)):
with open('./SA_summary_df/{}_slope_AUC.json'.format(models[mod])) as json_file:
df = pd.read_json(json_file, convert_dates=False, convert_axes=False)
df.index = df.index.map(float)
df.sort_index(inplace=True)
df.replace(0., np.NaN, inplace=True)
df = (df - df.loc[1.0, :]) / df.loc[1.0, :]
zero_ind = np.argwhere(df.index == 1)[0][0]
ind = [df.index[zero_ind - 1], df.index[zero_ind], df.index[zero_ind + 1]]
df2 = df.loc[ind, :]
for c in df.keys():
tau, p = stats.kendalltau(df.index, df[c], nan_policy='omit')
tau_l, p_l = stats.kendalltau(df2.index, df2[c], nan_policy='omit')
ratio_tau = tau_l/tau
slope_df = slope_df.append(pd.Series([model_names[mod], tau, p, tau_l, p_l, ratio_tau, alt_dict[c],clr_dict[models[mod]]], index=slope_df.columns), ignore_index=True)
models =['RS_pyramidal', 'RS_inhib', 'FS', 'IB','Cb_stellate','Cb_stellate_Kv','Cb_stellate_Kv_only','STN','STN_Kv','STN_Kv_only']
model_names = ['RS pyramidal', 'RS inhibitory', 'FS', 'IB','Cb stellate','Cb stellate +$K_V1.1$','Cb stellate $\Delta$$K_V1.1$','STN','STN +$K_V1.1$','STN $\Delta$$K_V1.1$']
g_df = pd.DataFrame(columns=['model', 'corr', 'p_value', 'local corr', 'local p_value', 'ratio', 'g', 'color']) # for boxplots
for mod in range(len(models)):
with open('./SA_summary_df/{}_g_AUC.json'.format(models[mod])) as json_file:
df = pd.read_json(json_file, convert_dates=False, convert_axes=False)
df.index = df.index.map(float)
df.sort_index(inplace=True)
df.replace(0., np.NaN, inplace=True)
df = (df - df.loc[1.0, :]) / df.loc[1.0, :]
zero_ind = np.argwhere(df.index == 1)[0][0]
ind = [df.index[zero_ind - 1], df.index[zero_ind], df.index[zero_ind + 1]]
df2 = df.loc[ind, :]
for c in df.keys():
tau, p = stats.kendalltau(df.index, df[c], nan_policy='omit')
tau_l, p_l = stats.kendalltau(df2.index, df2[c], nan_policy='omit')
ratio_tau = tau_l / tau
g_df = g_df.append(pd.Series([model_names[mod], tau, p,tau_l, p_l, ratio_tau, alt_dict[c],clr_dict[models[mod]]], index=g_df.columns), ignore_index=True)
shift_df.to_json('./Sensitivity_analysis/shift_box_kendall_corr.json')
slope_df.to_json('./Sensitivity_analysis/slope_box_kendall_corr.json')
g_df.to_json('./Sensitivity_analysis/g_box_kendall_corr.json')
#%% rheobase correlation analysis
models =['RS_pyramidal', 'RS_inhib', 'FS', 'IB','Cb_stellate','Cb_stellate_Kv','Cb_stellate_Kv_only','STN','STN_Kv','STN_Kv_only']
model_names = ['RS pyramidal', 'RS inhibitory', 'FS', 'IB','Cb stellate','Cb stellate +$K_V1.1$','Cb stellate $\Delta$$K_V1.1$','STN','STN +$K_V1.1$','STN $\Delta$$K_V1.1$']
shift_df = pd.DataFrame(columns=['model', 'corr', 'p_value', 'local corr', 'local p_value', 'ratio', '$\Delta V_{1/2}$', 'color']) # for boxplots
for mod in range(len(models)):
with open('./SA_summary_df/{}_shift_rheo.json'.format(models[mod])) as json_file:
df = pd.read_json(json_file)
df.sort_index(inplace=True)
df.replace(0., np.NaN, inplace=True)
df = (df - df.loc[0, :]) / df.loc[0, :]
zero_ind = np.argwhere(df.index == 0)[0][0]
ind = [df.index[zero_ind - 1], df.index[zero_ind], df.index[zero_ind + 1]]
df2 = df.loc[ind, :]
for c in df.keys():
tau, p = stats.kendalltau(df.index, df[c], nan_policy='omit')
tau_l, p_l = stats.kendalltau(df2.index, df2[c], nan_policy='omit')
ratio_tau = tau_l / tau
shift_df = shift_df.append(pd.Series([model_names[mod], tau, p,tau_l, p_l, ratio_tau, alt_dict[c],clr_dict[models[mod]]], index=shift_df.columns), ignore_index=True)
models =['RS_pyramidal', 'RS_inhib', 'FS', 'IB','Cb_stellate','Cb_stellate_Kv','Cb_stellate_Kv_only','STN','STN_Kv','STN_Kv_only']
model_names = ['RS pyramidal', 'RS inhibitory', 'FS', 'IB','Cb stellate','Cb stellate +$K_V1.1$','Cb stellate $\Delta$$K_V1.1$','STN','STN +$K_V1.1$','STN $\Delta$$K_V1.1$']
slope_df = pd.DataFrame(columns=['model', 'corr', 'p_value','local corr', 'local p_value', 'ratio', 'Slope (k)', 'color']) # for boxplots
for mod in range(len(models)):
with open('./SA_summary_df/{}_slope_rheo.json'.format(models[mod])) as json_file:
df = pd.read_json(json_file, convert_dates=False, convert_axes=False)
df.index = df.index.map(float)
df.sort_index(inplace=True)
df.replace(0., np.NaN, inplace=True)
df = (df - df.loc[1.0, :]) / df.loc[1.0, :]
zero_ind = np.argwhere(df.index == 1)[0][0]
ind = [df.index[zero_ind - 1], df.index[zero_ind], df.index[zero_ind + 1]]
df2 = df.loc[ind, :]
for c in df.keys():
tau, p = stats.kendalltau(df.index, df[c], nan_policy='omit')
tau_l, p_l = stats.kendalltau(df2.index, df2[c], nan_policy='omit')
ratio_tau = tau_l/tau
slope_df = slope_df.append(pd.Series([model_names[mod], tau, p, tau_l, p_l, ratio_tau, alt_dict[c],clr_dict[models[mod]]], index=slope_df.columns), ignore_index=True)
models =['RS_pyramidal', 'RS_inhib', 'FS', 'IB','Cb_stellate','Cb_stellate_Kv','Cb_stellate_Kv_only','STN','STN_Kv','STN_Kv_only']
model_names = ['RS pyramidal', 'RS inhibitory', 'FS', 'IB','Cb stellate','Cb stellate +$K_V1.1$','Cb stellate $\Delta$$K_V1.1$','STN','STN +$K_V1.1$','STN $\Delta$$K_V1.1$']
g_df = pd.DataFrame(columns=['model', 'corr', 'p_value', 'local corr', 'local p_value', 'ratio', 'g', 'color']) # for boxplots
for mod in range(len(models)):
with open('./SA_summary_df/{}_g_rheo.json'.format(models[mod])) as json_file:
df = pd.read_json(json_file, convert_dates=False, convert_axes=False)
df.index = df.index.map(float)
df.sort_index(inplace=True)
df.replace(0., np.NaN, inplace=True)
df = (df - df.loc[1.0, :]) / df.loc[1.0, :]
zero_ind = np.argwhere(df.index == 1)[0][0]
ind = [df.index[zero_ind - 1], df.index[zero_ind], df.index[zero_ind + 1]]
df2 = df.loc[ind, :]
for c in df.keys():
tau, p = stats.kendalltau(df.index, df[c], nan_policy='omit')
tau_l, p_l = stats.kendalltau(df2.index, df2[c], nan_policy='omit')
ratio_tau = tau_l / tau
g_df = g_df.append(pd.Series([model_names[mod], tau, p,tau_l, p_l, ratio_tau, alt_dict[c],clr_dict[models[mod]]], index=g_df.columns), ignore_index=True)
shift_df.to_json('./Sensitivity_analysis/rheo_shift_box_kendall_corr.json')
slope_df.to_json('./Sensitivity_analysis/rheo_slope_box_kendall_corr.json')
g_df.to_json('./Sensitivity_analysis/rheo_g_box_kendall_corr.json')
#%% todo: CREATE CSV FILES ###################################################################################################
# from ./Code/From_Neuronal_models/tau_analysis/AUC_corr_df_gen.py
AUC_shift_df = pd.read_json('./Sensitivity_analysis/shift_box_kendall_corr_rel.json', orient='records')
AUC_slope_df = pd.read_json('./Sensitivity_analysis/slope_box_kendall_corr_rel.json', orient='records') #, lines=True)
AUC_g_df = pd.read_json('./Sensitivity_analysis/g_box_kendall_corr_rel.json', orient='records')
# for i in np.array(['FS', 'IB', 'RS inhibitory', 'RS pyramidal']):
# AUC_shift_df.loc[AUC_shift_df['model'] == i, 'model'] = i + ' +$K_V1.1$' # ''+$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'
# AUC_slope_df.loc[AUC_slope_df['model'] == i, 'model'] = i + ' +$K_V1.1$' #' +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'
# AUC_g_df.loc[AUC_g_df['model'] == i, 'model'] = i + ' +$K_V1.1$' #' +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'
AUC_shift_df_posp = pd.read_json('./Sensitivity_analysis/shift_box_kendall_corr_rel_pospischil.json', orient='records')
AUC_slope_df_posp = pd.read_json('./Sensitivity_analysis/slope_box_kendall_corr_rel_pospischil.json', orient='records') #, lines=True)
AUC_g_df_posp = pd.read_json('./Sensitivity_analysis/g_box_kendall_corr_rel_pospischil.json', orient='records')
AUC_shift_df = AUC_shift_df.append(AUC_shift_df_posp)
AUC_slope_df = AUC_slope_df.append(AUC_slope_df_posp)
AUC_g_df = AUC_g_df.append(AUC_g_df_posp)
AUC_shift_df.to_csv('AUC_shift_corr.csv')
AUC_slope_df.to_csv('AUC_scale_corr.csv')
AUC_g_df.to_csv('AUC_g_corr.csv')
#% rheo
rheo_shift_df = pd.read_json('./Sensitivity_analysis/rheo_shift_box_kendall_corr.json', orient='records')
rheo_slope_df = pd.read_json('./Sensitivity_analysis/rheo_slope_box_kendall_corr.json', orient='records') #, lines=True)
rheo_g_df = pd.read_json('./Sensitivity_analysis/rheo_g_box_kendall_corr.json', orient='records')
for i in np.array(['FS', 'IB', 'RS inhibitory', 'RS pyramidal']):
rheo_shift_df.loc[rheo_shift_df['model'] == i, 'model'] = i + ' +$K_V1.1$' #' +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'
rheo_slope_df.loc[rheo_slope_df['model'] == i, 'model'] = i + ' +$K_V1.1$' #' +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'
rheo_g_df.loc[rheo_g_df['model'] == i, 'model'] = i + ' +$K_V1.1$' #' +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'
rheo_shift_df_posp = pd.read_json('./Sensitivity_analysis/rheo_shift_box_kendall_corr_pospischil.json', orient='records')
rheo_slope_df_posp = pd.read_json('./Sensitivity_analysis/rheo_slope_box_kendall_corr_pospischil.json', orient='records') #, lines=True)
rheo_g_df_posp = pd.read_json('./Sensitivity_analysis/rheo_g_box_kendall_corr_pospischil.json', orient='records')
rheo_shift_df = rheo_shift_df.append(rheo_shift_df_posp)
rheo_slope_df = rheo_slope_df.append(rheo_slope_df_posp)
rheo_g_df = rheo_g_df.append(rheo_g_df_posp)
rheo_shift_df.to_csv('rheo_shift_corr.csv')
rheo_slope_df.to_csv('rheo_scale_corr.csv')
rheo_g_df.to_csv('rheo_g_corr.csv')

View File

@ -161,9 +161,9 @@ Nils A. Koch\textsuperscript{1,2}, Lukas Sonnenberg\textsuperscript{1,2}, Ulrike
\section*{Abstract (250 Words Maximum - Currently 252)}
%\textit{It should provide a concise summary of the objectives, methodology (including the species and sex studied), key results, and major conclusions of the study.}
Clinically relevant mutations to voltage-gated ion channels, called channelopathies, result in altered ion channel function and ionic current properties.The effects of ion channel mutations on ionic current properties is routinely assessed and characterized as loss of function (LOF) or gain of function (GOF). Although personalized medicine approaches based on these assessments are emerging for channelopathy treatment, they are likely limited by the lack of detailed knowledge on the effects of channelopathies on firing across the brain. As experimental investigation of the effects of channelopathies on neuronal firing are difficult and impractical, direct translation of current level LOF/GOF to effects on neuronal firing level is tempting. Are these heuristic translation approaches sufficient given that cell-type specific effects of ion channel mutations have been reported? To investigate the impact of neuronal cell type on the firing outcome of ion channel mutations, computational modelling with a diverse collection of neuronal models is used here. In particular, systematic simulation and evaluation of the effects of changes in ion current properties on firing properties in different neuronal types as well as for mutations in the \textit{KCNA1} gene encoding the \Kv potassium channel subtype associated with episodic ataxia type~1 (EA1) revealed that the outcome of a given change in ion channel properties, such as by a mutation, on neuronal excitability is cell-type dependent. As a result, cell-type specific effects are vital to a full understanding of the effects of channelopathies on neuronal excitability and present an opportunity to further the efficacy and precision of personalized medicine approaches.
Clinically relevant mutations to voltage-gated ion channels, called channelopathies, alter ion channel function, properties of ionic current and neuronal firing. The effects of ion channel mutations are routinely assessed and characterized as loss of function (LOF) or gain of function (GOF) at the level of ionic currents. Emerging personalized medicine approaches based on LOF/GOF characterization have limited therapeutic success. Potential reasons are that the translation from this binary characterization to neuronal firing especially when considering different neuronal cell types is currently not well understood. Here we investigate the impact of neuronal cell type on the firing outcome of ion channel mutations with simulations of a diverse collection of neuron models. We systematically analyzed the effects of changes in ion current properties on firing in different neuronal types. Additionally, we simulated the effects of mutations in the \textit{KCNA1} gene encoding the \Kv potassium channel subtype associated with episodic ataxia type~1 (EA1). These simulations revealed that the outcome of a given change in ion channel properties on neuronal excitability is cell-type dependent. As a result, cell-type specific effects are vital to a full understanding of the effects of channelopathies on neuronal excitability and present an opportunity to further the efficacy and precision of personalized medicine approaches.
% Are these heuristic translation approaches sufficient given that cell-type specific effects of ion channel mutations have been reported?
@ -210,13 +210,13 @@ Although the genetic nature of ion channel mutations as well as their effects on
%Voltage-gated ion channels are vital in determining neuronal excitability, action potential generation and firing patterns \citep{bernard_channelopathies_2008, carbone_ion_2020}. In particular, the properties and combinations of ion channels and subunits and their resulting currents determine the firing properties of a neuron \citep{rutecki_neuronal_1992, pospischil_minimal_2008}. However, ion channel function can be disturbed, for instance through genetic alterations, resulting in altered ionic current properties and altered neuronal firing behavior \citep{carbone_ion_2020}.
The properties and combinations of voltage-gated ion channels are vital in determining action potential generation, neuronal firing properties and excitability \citep{bernard_channelopathies_2008, carbone_ion_2020, rutecki_neuronal_1992, pospischil_minimal_2008}. However, ion channel function can be disturbed, for instance through genetic alterations, resulting in altered neuronal firing behavior \citep{carbone_ion_2020}. In recent years, next generation sequencing has led to an increasing number of clinically relevant genetic mutations and has provided the basis for pathophysiological studies of genetic epilepsies, pain disorders, dyskinesias, intellectual disabilities, myotonias, and periodic paralyses \citep{bernard_channelopathies_2008, carbone_ion_2020}. Ongoing efforts of many research groups have contributed to the current understanding of underlying disease mechanism in channelopathies, however a complex pathophysiological landscape has emerged for many channelopathies and is likely a reason for limited therapeutic success with standard care.
\textcolor{red}{The properties and combinations of voltage-gated ion channels are vital in determining action potential generation, neuronal firing properties and excitability \citep{bernard_channelopathies_2008, carbone_ion_2020, rutecki_neuronal_1992, pospischil_minimal_2008}. However, ion channel function can be disturbed, for instance through genetic alterations, resulting in altered neuronal firing behavior \citep{carbone_ion_2020}.} In recent years, next generation sequencing has led to an increasing number of clinically relevant genetic mutations and has provided the basis for pathophysiological studies of genetic epilepsies, pain disorders, dyskinesias, intellectual disabilities, myotonias, and periodic paralyses \citep{bernard_channelopathies_2008, carbone_ion_2020}. Ongoing efforts of many research groups have contributed to the current understanding of underlying disease mechanism in channelopathies, however a complex pathophysiological landscape has emerged for many channelopathies and is likely a reason for limited therapeutic success with standard care.
% Ion channel mutations are the most common cause of such channelopathies and are often associated with hereditary clinical disorders including ataxias, epilepsies, pain disorders, dyskinesias, intellectual disabilities, myotonias, and periodic paralyses \citep{bernard_channelopathies_2008, carbone_ion_2020}.
The effects of mutations in ion channel genes on ionic current kinetics are frequently assessed using heterologous expression systems which do not express endogenous currents \citep{Balestrini1044, Noebels2017, Dunlop2008}. Ion channel variants are frequently classified as either a loss of function (LOF) or a gain of function (GOF) with respect to changes in gating of the altered ion channels \citep{Musto2020, Kullmann2002, Waxman2011, Kim2021}. This classification of the effects on ionic currents is often directly used to predict the effects on neuronal firing \citep{Niday2018, Wei2017, Wolff2017,Masnada2017}, which in turn is important for understanding the pathophysiology of these disorders and for identification of potential therapeutic targets \citep{Orsini2018, Yang2018, Colasante2020, Yu2006}. Genotype-phenotype relationships are complex and the understanding of the relationships between these is still evolving \citep{Wolff2017, johannesen_genotype-phenotype_2021}. Experimentally, the effects of channelopathies on neuronal firing can be assessed using primary neuronal cultures \citep{Scalmani2006, Smith2018, Liu2019} or \textit{in vitro} recordings from slices of transgenic mouse lines \citep{Mantegazza2019, Xie2010,Lory2020, Habib2015, Hedrich14874}.
\textcolor{orange}{The effects of mutations in ion channel genes on ionic current kinetics are frequently assessed using heterologous expression systems which do not express endogenous currents \citep{Balestrini1044, Noebels2017, Dunlop2008}. Ion channel variants are frequently classified as either a loss of function (LOF) or a gain of function (GOF) with respect to changes in gating of the altered ion channels \citep{Musto2020, Kullmann2002, Waxman2011, Kim2021}.} This classification of the effects on ionic currents is often directly used to predict the effects on neuronal firing \citep{Niday2018, Wei2017, Wolff2017,Masnada2017}, which in turn is important for understanding the pathophysiology of these disorders and for identification of potential therapeutic targets \citep{Orsini2018, Yang2018, Colasante2020, Yu2006}. Genotype-phenotype relationships are complex and the understanding of the relationships between these is still evolving \citep{Wolff2017, johannesen_genotype-phenotype_2021}. Experimentally, the effects of channelopathies on neuronal firing can be assessed using primary neuronal cultures \citep{Scalmani2006, Smith2018, Liu2019} or \textit{in vitro} recordings from slices of transgenic mouse lines \citep{Mantegazza2019, Xie2010,Lory2020, Habib2015, Hedrich14874}.
However, the effect of a given channelopathy on the firing behavior of different neuronal types across the brain is often unclear and not feasible to experimentally obtain. Different neuron types differ in their composition of ionic currents \citep{yao2021taxonomy, Cadwell2016, BICCN2021, Scala2021} and therefore likely respond differently to changes in the properties of a single ionic current. For example, the expression level of an affected gene can correlate with firing behavior in the simplest case \citep{Layer2021} and altering relative amplitudes of ionic currents can dramatically influence the firing behavior and dynamics of neurons \citep{rutecki_neuronal_1992, pospischil_minimal_2008,Kispersky2012, golowasch_failure_2002, barreiro_-current_2012}. Cell-type specific effects on firing have been experimentally observed. For example, the firing effects of the R1648H \textit{SCN1A} and R1627H \textit{SCN8A} mutations are different in interneurons and pyramidal neurons \citep{Hedrich14874, makinson_scn1a_2016}.
However, the effect of a given channelopathy on the firing behavior of different neuronal types across the brain is often unclear and not feasible to obtain experimentally. Different neuron types differ in their composition of ionic currents \citep{yao2021taxonomy, Cadwell2016, BICCN2021, Scala2021} and therefore likely respond differently to changes in the properties of a single ionic current. For example, the expression level of an affected gene can correlate with firing behavior in the simplest case \citep{Layer2021} and altering relative amplitudes of ionic currents can dramatically influence the firing behavior and dynamics of neurons \citep{rutecki_neuronal_1992, pospischil_minimal_2008,Kispersky2012, golowasch_failure_2002, barreiro_-current_2012}. Cell-type specific effects on firing have been experimentally observed. For example, the firing effects of the R1648H \textit{SCN1A} and R1627H \textit{SCN8A} mutations are different in interneurons and pyramidal neurons \citep{Hedrich14874, makinson_scn1a_2016}.
%However, if gating kinetics are affected this can have complex consequences on the firing behavior of a specific cell type and the network activity within the brain.
%Altering relative amplitudes of ionic currents can dramatically influence the firing behavior and dynamics of neurons \citep{rutecki_neuronal_1992, pospischil_minimal_2008,Kispersky2012, golowasch_failure_2002, barreiro_-current_2012}, however other properties of ionic currents impact neuronal firing as well.