Added a few more comments to code
This commit is contained in:
parent
9037e1a016
commit
93ab5c1792
@ -15,8 +15,8 @@ from ast import literal_eval
|
|||||||
import string
|
import string
|
||||||
import matplotlib.cm as cm
|
import matplotlib.cm as cm
|
||||||
|
|
||||||
# %% rheo_{}_ex.csv, AUC_{}_ex.csv
|
# %% rheo_{}_ex.csv, AUC_{}_ex.csv #####################################################################################
|
||||||
|
# Collect examples of effects of a shift, a slope change and a change in g on AUC and rheobase
|
||||||
## AUC ###################
|
## AUC ###################
|
||||||
AUC_shift = pd.DataFrame(columns=['alteration', 'RS Pyramidal', 'RS Inhibitory', 'FS', 'IB',
|
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$','Cb stellate',
|
'RS Pyramidal +$K_V1.1$','RS Inhibitory +$K_V1.1$', 'FS +$K_V1.1$','Cb stellate',
|
||||||
@ -35,16 +35,12 @@ AUC_g = pd.DataFrame(columns=['alteration', 'RS Pyramidal', 'RS Inhibitory', 'FS
|
|||||||
|
|
||||||
script_dir = os.path.dirname(os.path.realpath("__file__"))
|
script_dir = os.path.dirname(os.path.realpath("__file__"))
|
||||||
fname = os.path.join(script_dir, )
|
fname = os.path.join(script_dir, )
|
||||||
# f = h5py.File(fname, "r")
|
|
||||||
|
|
||||||
models = ['RS_pyramidal', 'RS_inhib', 'FS','RS_pyramidal_Kv', 'RS_inhib_Kv', 'FS_Kv', 'Cb_stellate','Cb_stellate_Kv',
|
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']
|
'Cb_stellate_Kv_only','STN','STN_Kv', 'STN_Kv_only']
|
||||||
model_labels = ['RS Pyramidal','RS Inhibitory', 'FS','RS Pyramidal +$K_V1.1$','RS Inhibitory +$K_V1.1$',
|
model_labels = ['RS Pyramidal','RS Inhibitory', 'FS','RS Pyramidal +$K_V1.1$','RS Inhibitory +$K_V1.1$',
|
||||||
'FS +$K_V1.1$','Cb stellate','Cb stellate +$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$']
|
'Cb stellate $\Delta$$K_V1.1$','STN','STN +$K_V1.1$', 'STN $\Delta$$K_V1.1$']
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
shift_interest = 'n'
|
shift_interest = 'n'
|
||||||
for i in range(len(models)):
|
for i in range(len(models)):
|
||||||
with open('../Sensitivity_Analysis/Data/SA_summary_df/{}_shift_AUC.json'.format(models[i])) as json_file:
|
with open('../Sensitivity_Analysis/Data/SA_summary_df/{}_shift_AUC.json'.format(models[i])) as json_file:
|
||||||
@ -56,7 +52,6 @@ for i in range(len(models)):
|
|||||||
AUC_shift['alteration'] = AUC_shift.index
|
AUC_shift['alteration'] = AUC_shift.index
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
slope_interest = 's'
|
slope_interest = 's'
|
||||||
for i in range(len(models)):
|
for i in range(len(models)):
|
||||||
with open('../Sensitivity_Analysis/Data/SA_summary_df/{}_slope_AUC.json'.format(models[i])) as json_file:
|
with open('../Sensitivity_Analysis/Data/SA_summary_df/{}_slope_AUC.json'.format(models[i])) as json_file:
|
||||||
@ -70,6 +65,7 @@ for i in range(len(models)):
|
|||||||
pass
|
pass
|
||||||
AUC_slope['alteration'] = AUC_slope.index
|
AUC_slope['alteration'] = AUC_slope.index
|
||||||
|
|
||||||
|
|
||||||
g_interest = 'Kd'
|
g_interest = 'Kd'
|
||||||
for i in range(len(models)):
|
for i in range(len(models)):
|
||||||
with open('../Sensitivity_Analysis/Data/SA_summary_df/{}_g_AUC.json'.format(models[i])) as json_file:
|
with open('../Sensitivity_Analysis/Data/SA_summary_df/{}_g_AUC.json'.format(models[i])) as json_file:
|
||||||
@ -86,7 +82,6 @@ AUC_g.to_csv('AUC_g_ex.csv')
|
|||||||
|
|
||||||
|
|
||||||
## rheobase ###################
|
## rheobase ###################
|
||||||
|
|
||||||
rheo_shift = pd.DataFrame(columns=['alteration', 'RS Pyramidal', 'RS Inhibitory', 'FS', 'IB',
|
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$','Cb stellate',
|
'RS Pyramidal +$K_V1.1$','RS Inhibitory +$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$',
|
'Cb stellate +$K_V1.1$', 'Cb stellate $\Delta$$K_V1.1$', 'STN', 'STN +$K_V1.1$',
|
||||||
@ -148,14 +143,13 @@ for i in range(len(models)):
|
|||||||
rheo_g[model_labels[i]] = data[g_interest]
|
rheo_g[model_labels[i]] = data[g_interest]
|
||||||
rheo_g['alteration'] = rheo_g.index
|
rheo_g['alteration'] = rheo_g.index
|
||||||
|
|
||||||
|
|
||||||
rheo_shift.to_csv('rheo_shift_ex.csv')
|
rheo_shift.to_csv('rheo_shift_ex.csv')
|
||||||
rheo_slope.to_csv('rheo_slope_ex.csv')
|
rheo_slope.to_csv('rheo_slope_ex.csv')
|
||||||
rheo_g.to_csv('rheo_g_ex.csv')
|
rheo_g.to_csv('rheo_g_ex.csv')
|
||||||
|
|
||||||
|
|
||||||
# %% Model fI
|
# %% Model fI ##########################################################################################################
|
||||||
# for each model
|
# for each model generate summary csv of sensitivity analysis results on AUC and rheobase
|
||||||
# | (index) | mag | alt | type | F | I |
|
# | (index) | mag | alt | type | F | I |
|
||||||
# | 0 | -10 | m | shift | array | array |
|
# | 0 | -10 | m | shift | array | array |
|
||||||
|
|
||||||
@ -230,7 +224,10 @@ for m in models:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
# %% firing_values.csv, model_spiking.csv, model_F_inf.csv
|
# %% firing_values.csv, model_spiking.csv, model_F_inf.csv #############################################################
|
||||||
|
# generate firing_values.csv with values for hysteresis from ramp current input
|
||||||
|
# generate model_spiking.csv with example model response to step current
|
||||||
|
# generate model_F_inf.csv with model fI curve data
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
@ -272,7 +269,8 @@ for model_name in models:
|
|||||||
firing_values.to_csv('firing_values.csv')
|
firing_values.to_csv('firing_values.csv')
|
||||||
spiking.to_csv('model_spiking.csv')
|
spiking.to_csv('model_spiking.csv')
|
||||||
model_F_inf.to_csv('model_F_inf.csv')
|
model_F_inf.to_csv('model_F_inf.csv')
|
||||||
# %% model_ramp.csv
|
# %% model_ramp.csv ####################################################################################################
|
||||||
|
# generate model_ramp.csv with model responses to ramp input
|
||||||
# | (index) | t | models ....
|
# | (index) | t | models ....
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
@ -298,8 +296,9 @@ for model_name in models:
|
|||||||
|
|
||||||
model_ramp.to_csv('model_ramp.csv')
|
model_ramp.to_csv('model_ramp.csv')
|
||||||
|
|
||||||
#%% sim_mut_AUC.csv, sim_mut_rheo.csv #
|
#%% sim_mut_AUC.csv, sim_mut_rheo.csv ##################################################################################
|
||||||
# generate mutation plot data
|
# generate mutation plot data in sim_mut_AUC.csv and sim_mut_rheo.csv for the AUC and rheobase effects respectively for
|
||||||
|
# each mutation in each model
|
||||||
mutations = json.load(open("../KCNA1_mutations/mutations_effects_dict.json"))
|
mutations = json.load(open("../KCNA1_mutations/mutations_effects_dict.json"))
|
||||||
keys_to_remove = ['V408L', 'T226R', 'R239S', 'R324T']
|
keys_to_remove = ['V408L', 'T226R', 'R239S', 'R324T']
|
||||||
for key in keys_to_remove:
|
for key in keys_to_remove:
|
||||||
|
@ -285,7 +285,7 @@ shift_df.to_json('./Sensitivity_analysis/rheo_shift_box_kendall_corr.json')
|
|||||||
slope_df.to_json('./Sensitivity_analysis/rheo_slope_box_kendall_corr.json')
|
slope_df.to_json('./Sensitivity_analysis/rheo_slope_box_kendall_corr.json')
|
||||||
g_df.to_json('./Sensitivity_analysis/rheo_g_kendall_corr.json')
|
g_df.to_json('./Sensitivity_analysis/rheo_g_kendall_corr.json')
|
||||||
|
|
||||||
#%% create csv file
|
#%% create csv files for plotting
|
||||||
# | (index) | model | corr | p_value | g | color
|
# | (index) | model | corr | p_value | g | color
|
||||||
#% AUC
|
#% AUC
|
||||||
AUC_shift_json = pd.read_json('./Sensitivity_analysis/shift_kendall_corr_rel.json', orient='records')
|
AUC_shift_json = pd.read_json('./Sensitivity_analysis/shift_kendall_corr_rel.json', orient='records')
|
||||||
|
Loading…
Reference in New Issue
Block a user