Update: code cleaned up
This commit is contained in:
parent
ce46f8859a
commit
9037e1a016
@ -1,3 +1,13 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
Functions for Cb Stellate model
|
||||||
|
|
||||||
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
import h5py
|
import h5py
|
||||||
import gc
|
import gc
|
||||||
import scipy
|
import scipy
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
"""
|
||||||
|
Functions for Cb Stellate with Kv1.1 model
|
||||||
|
|
||||||
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
|
"""
|
||||||
|
|
||||||
import h5py
|
import h5py
|
||||||
import scipy
|
import scipy
|
||||||
import json
|
import json
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
"""
|
||||||
|
Functions for model from Pospischil et al. 2008 - RS Pyramidal, RS inhibitory, and FS
|
||||||
|
|
||||||
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
|
"""
|
||||||
|
|
||||||
import gc
|
import gc
|
||||||
import h5py
|
import h5py
|
||||||
import scipy
|
import scipy
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
"""
|
||||||
|
Functions for STN model
|
||||||
|
|
||||||
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
|
"""
|
||||||
|
|
||||||
import scipy
|
import scipy
|
||||||
import json
|
import json
|
||||||
import copy
|
import copy
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
"""
|
||||||
|
Functions for STN model with Kv1.1
|
||||||
|
|
||||||
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
|
"""
|
||||||
|
|
||||||
import scipy
|
import scipy
|
||||||
import json
|
import json
|
||||||
import copy
|
import copy
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
"""
|
||||||
|
General functions used throughout simulation scripts
|
||||||
|
|
||||||
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from numba import njit
|
from numba import njit
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Sat May 8 16:20:11 2021
|
Script to simulate all KCNA1 mutations in Cb Stellate model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Fri Jun 18 10:47:40 2021
|
Script to simulate all KCNA1 mutations in Cb Stellate \Delta Kv1.1 model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Sat May 8 16:20:11 2021
|
Script to simulate all KCNA1 mutations in Cb Stellate +Kv1.1 model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from joblib import Parallel, delayed
|
from joblib import Parallel, delayed
|
||||||
import json
|
import json
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Sat May 29 21:10:20 2021
|
Script to simulate all KCNA1 mutations in FS +Kv1.1 model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Sat May 29 21:10:48 2021
|
Script to simulate all KCNA1 mutations in RS Inhibitory +Kv1.1 model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from joblib import Parallel, delayed
|
from joblib import Parallel, delayed
|
||||||
import os
|
import os
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Sat May 8 16:20:11 2021
|
Script to simulate all KCNA1 mutations in RS Pyramidal +Kv1.1 model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Sat May 8 16:20:11 2021
|
Script to simulate all KCNA1 mutations in STN model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from joblib import Parallel, delayed
|
from joblib import Parallel, delayed
|
||||||
import json
|
import json
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Fri Jun 18 10:53:45 2021
|
Script to simulate all KCNA1 mutations in STN \Delta Kv1.1 model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from joblib import Parallel, delayed
|
from joblib import Parallel, delayed
|
||||||
import json
|
import json
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Sat May 8 16:20:11 2021
|
Script to simulate all KCNA1 mutations in STN +Kv1.1 model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from joblib import Parallel, delayed
|
from joblib import Parallel, delayed
|
||||||
import json
|
import json
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Fri Jun 18 10:47:40 2021
|
Script to run Cb Stellate \Delta Kv1.1 model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Sat May 8 16:20:11 2021
|
Script to run Cb Stellate +Kv1.1 model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
Script to run Cb Stellate model
|
||||||
|
|
||||||
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
|
"""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import os
|
import os
|
||||||
from Code.Functions.Utility_fxns import capacitance, stimulus_init, init_dict
|
from Code.Functions.Utility_fxns import capacitance, stimulus_init, init_dict
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Fri May 7 23:37:22 2021
|
Script to run FS +Kv1.1 model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Fri May 7 23:37:22 2021
|
Script to run FS model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
Original Pospischil FS (no Kv1.1)
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Fri May 7 23:37:22 2021
|
Script to run RS Inhibitory +Kv1.1 model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Fri May 7 23:37:22 2021
|
Script to run RS Inhibitory model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
Original Pospischil RS inhibitory (no Kv1.1)
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from numba import types
|
from numba import types
|
||||||
from numba.typed import Dict
|
from numba.typed import Dict
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Fri May 7 23:37:22 2021
|
Script to run RS Pyramidal +Kv1.1 model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Fri May 7 23:37:22 2021
|
Script to run RS Pyramidal model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Fri Jun 18 10:53:45 2021
|
Script to run STN \Delta Kv1.1 model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import os
|
import os
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
Script to run STN +Kv1.1 model
|
||||||
|
|
||||||
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
|
"""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import os
|
import os
|
||||||
from Code.Functions.Utility_fxns import capacitance, stimulus_init, init_dict
|
from Code.Functions.Utility_fxns import capacitance, stimulus_init, init_dict
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
Script to run STN model
|
||||||
|
|
||||||
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
|
"""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import os
|
import os
|
||||||
from Code.Functions.Utility_fxns import capacitance, stimulus_init, init_dict
|
from Code.Functions.Utility_fxns import capacitance, stimulus_init, init_dict
|
||||||
|
@ -1,661 +0,0 @@
|
|||||||
import pandas as pd
|
|
||||||
import numpy as np
|
|
||||||
import h5py
|
|
||||||
import os
|
|
||||||
from ast import literal_eval
|
|
||||||
|
|
||||||
#%% 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)
|
|
||||||
|
|
||||||
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_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$']
|
|
||||||
|
|
||||||
var_dict = {}
|
|
||||||
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']
|
|
||||||
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 = './Sensitivity_Analysis/corr_df'
|
|
||||||
if not os.path.isdir(folder):
|
|
||||||
os.makedirs(folder)
|
|
||||||
|
|
||||||
# % rheo
|
|
||||||
# % shift
|
|
||||||
shift_m = pd.DataFrame()
|
|
||||||
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:
|
|
||||||
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.to_json(os.path.join(folder, 'shift_m_rheo.json'))
|
|
||||||
|
|
||||||
shift_h = pd.DataFrame()
|
|
||||||
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:
|
|
||||||
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.to_json(os.path.join(folder, 'shift_h_rheo.json'))
|
|
||||||
|
|
||||||
shift_n = pd.DataFrame()
|
|
||||||
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:
|
|
||||||
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.to_json(os.path.join(folder, 'shift_n_rheo.json'))
|
|
||||||
|
|
||||||
shift_s = pd.DataFrame()
|
|
||||||
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:
|
|
||||||
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.to_json(os.path.join(folder, 'shift_s_rheo.json'))
|
|
||||||
|
|
||||||
shift_u = pd.DataFrame()
|
|
||||||
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:
|
|
||||||
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.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:
|
|
||||||
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:
|
|
||||||
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.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:
|
|
||||||
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:
|
|
||||||
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.to_json(os.path.join(folder, 'shift_b_rheo.json'))
|
|
||||||
|
|
||||||
# % slope
|
|
||||||
slope_m = pd.DataFrame()
|
|
||||||
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:
|
|
||||||
slope_m[mod] = pd.read_json(json_file, convert_axes=False, convert_dates=False)['m'].sort_index()
|
|
||||||
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.to_json(os.path.join(folder, 'slope_m_rheo.json'))
|
|
||||||
|
|
||||||
slope_h = pd.DataFrame()
|
|
||||||
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:
|
|
||||||
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.to_json(os.path.join(folder, 'slope_h_rheo.json'))
|
|
||||||
|
|
||||||
slope_n = pd.DataFrame()
|
|
||||||
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:
|
|
||||||
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.to_json(os.path.join(folder, 'slope_n_rheo.json'))
|
|
||||||
|
|
||||||
slope_s = pd.DataFrame()
|
|
||||||
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:
|
|
||||||
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.to_json(os.path.join(folder, 'slope_s_rheo.json'))
|
|
||||||
|
|
||||||
slope_u = pd.DataFrame()
|
|
||||||
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:
|
|
||||||
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.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:
|
|
||||||
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:
|
|
||||||
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.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:
|
|
||||||
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:
|
|
||||||
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.to_json(os.path.join(folder, 'slope_b_rheo.json'))
|
|
||||||
|
|
||||||
# % g
|
|
||||||
g_Na = pd.DataFrame()
|
|
||||||
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:
|
|
||||||
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.to_json(os.path.join(folder, 'g_Na_rheo.json'))
|
|
||||||
|
|
||||||
g_Kd = pd.DataFrame()
|
|
||||||
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:
|
|
||||||
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.to_json(os.path.join(folder, 'g_Kd_rheo.json'))
|
|
||||||
|
|
||||||
g_Kv = pd.DataFrame()
|
|
||||||
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:
|
|
||||||
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.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:
|
|
||||||
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.to_json(os.path.join(folder, 'g_A_rheo.json'))
|
|
||||||
|
|
||||||
g_Leak = pd.DataFrame()
|
|
||||||
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:
|
|
||||||
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.to_json(os.path.join(folder, 'g_Leak_rheo.json'))
|
|
||||||
|
|
||||||
# % AUC
|
|
||||||
# % shift
|
|
||||||
shift_m = pd.DataFrame()
|
|
||||||
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.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.json'))
|
|
||||||
|
|
||||||
shift_h = pd.DataFrame()
|
|
||||||
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.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.json'))
|
|
||||||
|
|
||||||
shift_n = pd.DataFrame()
|
|
||||||
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.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.json'))
|
|
||||||
|
|
||||||
shift_s = pd.DataFrame()
|
|
||||||
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.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.json'))
|
|
||||||
|
|
||||||
shift_u = pd.DataFrame()
|
|
||||||
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.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.json'))
|
|
||||||
|
|
||||||
shift_a = pd.DataFrame()
|
|
||||||
models = ['Cb_stellate', 'Cb_stellate_Kv']
|
|
||||||
for mod in models:
|
|
||||||
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.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.json'))
|
|
||||||
|
|
||||||
shift_b = pd.DataFrame()
|
|
||||||
models = ['Cb_stellate', 'Cb_stellate_Kv']
|
|
||||||
for mod in models:
|
|
||||||
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.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.json'))
|
|
||||||
|
|
||||||
# % slope
|
|
||||||
slope_m = pd.DataFrame()
|
|
||||||
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.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.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.json'))
|
|
||||||
|
|
||||||
slope_h = pd.DataFrame()
|
|
||||||
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.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.json'))
|
|
||||||
|
|
||||||
slope_n = pd.DataFrame()
|
|
||||||
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.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.json'))
|
|
||||||
|
|
||||||
slope_s = pd.DataFrame()
|
|
||||||
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.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.json'))
|
|
||||||
|
|
||||||
slope_u = pd.DataFrame()
|
|
||||||
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.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.json'))
|
|
||||||
|
|
||||||
slope_a = pd.DataFrame()
|
|
||||||
models = ['Cb_stellate', 'Cb_stellate_Kv']
|
|
||||||
for mod in models:
|
|
||||||
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.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.json'))
|
|
||||||
|
|
||||||
slope_b = pd.DataFrame()
|
|
||||||
models = ['Cb_stellate', 'Cb_stellate_Kv']
|
|
||||||
for mod in models:
|
|
||||||
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.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.json'))
|
|
||||||
|
|
||||||
# % g
|
|
||||||
g_Na = pd.DataFrame()
|
|
||||||
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.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.json'))
|
|
||||||
|
|
||||||
g_Kd = pd.DataFrame()
|
|
||||||
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.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.json'))
|
|
||||||
|
|
||||||
g_Kv = pd.DataFrame()
|
|
||||||
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.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.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.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.json'))
|
|
||||||
|
|
||||||
g_Leak = pd.DataFrame()
|
|
||||||
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.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.json'))
|
|
||||||
|
|
||||||
|
|
||||||
#%% todo: 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}$'
|
|
||||||
|
|
||||||
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')
|
|
@ -1,134 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
"""
|
|
||||||
Created on Sat May 29 21:10:20 2021
|
|
||||||
|
|
||||||
@author: nils
|
|
||||||
"""
|
|
||||||
|
|
||||||
import numpy as np
|
|
||||||
import os
|
|
||||||
import h5py
|
|
||||||
import json
|
|
||||||
from Utility import capacitance, stimulus_init, init_dict, NumpyEncoder
|
|
||||||
|
|
||||||
# model parameters
|
|
||||||
dt = 0.01
|
|
||||||
sec = 2
|
|
||||||
low = 0
|
|
||||||
high = 0.001
|
|
||||||
number_steps = 200
|
|
||||||
initial_period = 1000
|
|
||||||
num_gating = 10
|
|
||||||
num_current = 7
|
|
||||||
C, surf_area = capacitance(56.9, 1)
|
|
||||||
stim_time, I_in, stim_num, V_m = stimulus_init(low, high, number_steps, initial_period, dt, sec)
|
|
||||||
shift, scale, slope_shift, E, currents_included, b_param, g = init_dict(
|
|
||||||
np.array(['m', 'h', 'n', 'q', 'r', 'p', 's', 'u', 's_mut', 'u_mut']))
|
|
||||||
tau_max_p = 502
|
|
||||||
V_init = -70
|
|
||||||
V_T = -57.9
|
|
||||||
|
|
||||||
# initialize arrays
|
|
||||||
current = np.zeros((num_current, stim_num))
|
|
||||||
gating_out = np.zeros((num_gating, stim_num))
|
|
||||||
|
|
||||||
# gating parameters
|
|
||||||
b_param = {}
|
|
||||||
b_param['m'] = np.array([-34.33054521, -8.21450277, 1.42295686])
|
|
||||||
b_param['h'] = np.array([-34.51951036, 4.04059373, 1., 0.])
|
|
||||||
b_param['n'] = np.array([-63.76096946, -13.83488194, 7.35347425])
|
|
||||||
b_param['q'] = np.array([-39.03684525, -5.57756176, 2.25190197])
|
|
||||||
b_param['r'] = np.array([-57.37, 20.98, 1.])
|
|
||||||
b_param['p'] = np.array([-45., -9.9998807337, 1.])
|
|
||||||
b_param['s'] = np.array([-14.16, -10.15, 1.])
|
|
||||||
b_param['u'] = np.array([-31., 5.256, 1., 0.245])
|
|
||||||
b_param['s_mut'] = np.array([-14.16, -10.15, 1.])
|
|
||||||
b_param['u_mut'] = np.array([-31., 5.256, 1., 0.245])
|
|
||||||
|
|
||||||
mut_act_Vhalf_wt = -30.01851851851851
|
|
||||||
mut_act_k_wt = -7.7333333333333325
|
|
||||||
s_diff_Vhalf = mut_act_Vhalf_wt - b_param['s'][0]
|
|
||||||
s_diff_k = mut_act_k_wt - b_param['s'][1]
|
|
||||||
b_param['s'][1] = b_param['s'][1] + s_diff_k
|
|
||||||
b_param['u'][1] = b_param['u'][1] + s_diff_k
|
|
||||||
b_param['s'][0] = b_param['s'][0] + s_diff_Vhalf
|
|
||||||
b_param['u'][0] = b_param['u'][0] + s_diff_Vhalf
|
|
||||||
b_param['s_mut'][1] = b_param['s_mut'][1] + s_diff_k
|
|
||||||
b_param['u_mut'][1] = b_param['u_mut'][1] + s_diff_k
|
|
||||||
b_param['s_mut'][0] = b_param['s_mut'][0] + s_diff_Vhalf
|
|
||||||
b_param['u_mut'][0] = b_param['u_mut'][0] + s_diff_Vhalf
|
|
||||||
|
|
||||||
# reversal potentials
|
|
||||||
E["Na"] = 50.
|
|
||||||
E["K"] = -90.
|
|
||||||
E["Ca"] = 120.
|
|
||||||
E["Leak"] = -70.4
|
|
||||||
|
|
||||||
# model currents
|
|
||||||
currents_included["Na"] = True
|
|
||||||
currents_included["Kd"] = True
|
|
||||||
currents_included["Kv"] = True
|
|
||||||
currents_included["Kv_mut"] = True
|
|
||||||
currents_included["L"] = False
|
|
||||||
currents_included["M"] = True
|
|
||||||
currents_included["Leak"] = True
|
|
||||||
|
|
||||||
# model conductances
|
|
||||||
Kv_ratio = 0.1
|
|
||||||
g["Na"] = 58. * surf_area
|
|
||||||
g["Kd"] = 3.9 * (1 - Kv_ratio) * surf_area
|
|
||||||
g["M"] = 0.075 * surf_area
|
|
||||||
if currents_included["Kv_mut"] == True:
|
|
||||||
g["Kv"] = 3.9 * Kv_ratio / 2 * surf_area
|
|
||||||
else:
|
|
||||||
g["Kv"] = 3.9 * Kv_ratio / 2 * surf_area * 2
|
|
||||||
g["Kv_mut"] = 3.9 * Kv_ratio / 2 * surf_area
|
|
||||||
g["L"] = 0. * surf_area
|
|
||||||
g["Leak"] = 0.038 * surf_area
|
|
||||||
|
|
||||||
# save folder
|
|
||||||
folder = './KCNA1_mutations/FS'
|
|
||||||
if not os.path.isdir(folder):
|
|
||||||
os.makedirs(folder)
|
|
||||||
|
|
||||||
# mutation properties
|
|
||||||
mutations = json.load(open("../KCNA1_mutations/mutations_effects_dict.json"))
|
|
||||||
|
|
||||||
|
|
||||||
# prominence = 50
|
|
||||||
# # min_spike_height = 0
|
|
||||||
# desired_AUC_width = high/5
|
|
||||||
#
|
|
||||||
# Parallel(n_jobs=8, verbose=9)(
|
|
||||||
# delayed(Pospischil_multi)(V_init, V_T, g, E, I_in, dt, currents_included, stim_time, stim_num, C, tau_max_p,
|
|
||||||
# shift, scale, b_param, slope_shift, gating_out, current, prominence,
|
|
||||||
# desired_AUC_width, mutations, mut, folder, high,low, number_steps, initial_period, sec, save_gating=True)
|
|
||||||
# for mut in list(mutations.keys()))
|
|
||||||
|
|
||||||
#%% Get pd Dataframes for certain variables
|
|
||||||
import pandas as pd
|
|
||||||
AUC = pd.DataFrame(columns=mutations.keys())
|
|
||||||
AUC_rel = pd.DataFrame(columns=mutations.keys())
|
|
||||||
rheobase = pd.DataFrame(columns=mutations.keys())
|
|
||||||
rheobase_fit = pd.DataFrame(columns=mutations.keys())
|
|
||||||
rheobase_null_fit = pd.DataFrame(columns=mutations.keys())
|
|
||||||
|
|
||||||
for mut in list(mutations.keys()):
|
|
||||||
fname = os.path.join(folder, "{}.hdf5".format(mut.replace(" ", "_")))
|
|
||||||
f = h5py.File(fname, "r")
|
|
||||||
AUC['{}'.format(mut.replace(" ", "_"))] = f['analysis']['AUC']
|
|
||||||
AUC_rel['{}'.format(mut.replace(" ", "_"))] = f['analysis']['AUC_rel']
|
|
||||||
rheobase['{}'.format(mut.replace(" ", "_"))] = f['analysis']['rheobase']
|
|
||||||
rheobase_fit['{}'.format(mut.replace(" ", "_"))] = f['analysis']['rheobase_fit']
|
|
||||||
rheobase_null_fit['{}'.format(mut.replace(" ", "_"))] = f['analysis']['rheobase_null_fit']
|
|
||||||
|
|
||||||
top_dir = '../KCNA1_mut'
|
|
||||||
model_name = 'FS'
|
|
||||||
save_folder = os.path.join(top_dir, 'mut_summary_df')
|
|
||||||
if not os.path.isdir(save_folder):
|
|
||||||
os.makedirs(save_folder)
|
|
||||||
AUC.to_json(os.path.join(save_folder, '{}_AUC.json'.format(model_name)))
|
|
||||||
AUC_rel.to_json(os.path.join(save_folder, '{}_AUC_rel.json'.format(model_name)))
|
|
||||||
rheobase.to_json(os.path.join(save_folder, '{}_rheobase.json'.format(model_name)))
|
|
||||||
rheobase_fit.to_json(os.path.join(save_folder, '{}_rheobase_fit.json'.format(model_name)))
|
|
||||||
rheobase_null_fit.to_json(os.path.join(save_folder, '{}_rheobase_null_fit.json'.format(model_name)))
|
|
@ -1,227 +0,0 @@
|
|||||||
import h5py
|
|
||||||
import numpy as np
|
|
||||||
import os
|
|
||||||
import pandas as pd
|
|
||||||
|
|
||||||
|
|
||||||
spiking = pd.DataFrame(columns=['t', 'RS Pyramidal','RS Inhibitory','FS','IB',
|
|
||||||
'RS Pyramidal +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
|
||||||
'RS Inhibitory +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
|
||||||
'FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
|
||||||
'IB +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
|
||||||
'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}$'])
|
|
||||||
values = pd.DataFrame(index = ['spike_ind', 'ramp_up','ramp_down'], columns=['RS Pyramidal','RS Inhibitory','FS','IB',
|
|
||||||
'RS Pyramidal +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
|
||||||
'RS Inhibitory +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
|
||||||
'FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
|
||||||
'IB +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$','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}$'])
|
|
||||||
F = pd.DataFrame(columns=['I','I_inhib', 'RS Pyramidal','RS Inhibitory','FS','IB',
|
|
||||||
'RS Pyramidal +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
|
||||||
'RS Inhibitory +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
|
||||||
'FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
|
||||||
'IB +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$','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}$'])
|
|
||||||
|
|
||||||
|
|
||||||
# RS Pyramidal #########################################################################################################
|
|
||||||
script_dir = os.path.dirname(os.path.realpath("__file__"))
|
|
||||||
fname = os.path.join(script_dir, '../Neuron_models/RS_pyramidal.hdf5')
|
|
||||||
f = h5py.File(fname, "r")
|
|
||||||
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'])
|
|
||||||
ind = 60
|
|
||||||
spiking['RS Pyramidal'] = f['data']['V_m'][ind][start:]
|
|
||||||
spiking['t'] = time
|
|
||||||
F['I'] = I_mag
|
|
||||||
F['RS Pyramidal'] = f['analysis']['F_inf'][:]
|
|
||||||
values.loc['spike_ind', 'RS Pyramidal'] = I_mag[ind]
|
|
||||||
values.loc['ramp_up', 'RS Pyramidal'] = f['analysis']['ramp_I_up'][()]
|
|
||||||
values.loc['ramp_down', 'RS Pyramidal'] = f['analysis']['ramp_I_down'][()]
|
|
||||||
|
|
||||||
# RS Inhibitory #########################################################################################################
|
|
||||||
script_dir = os.path.dirname(os.path.realpath("__file__"))
|
|
||||||
fname = os.path.join(script_dir, '../Neuron_models/RS_inhib.hdf5')
|
|
||||||
f = h5py.File(fname, "r")
|
|
||||||
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'])
|
|
||||||
ind = 25
|
|
||||||
spiking['RS Inhibitory'] = f['data']['V_m'][ind][start:]
|
|
||||||
F['I_inhib'] = I_mag
|
|
||||||
F['RS Inhibitory'] = f['analysis']['F_inf'][:]
|
|
||||||
values.loc['spike_ind', 'RS Inhibitory'] = I_mag[ind]
|
|
||||||
values.loc['ramp_up', 'RS Inhibitory'] = f['analysis']['ramp_I_up'][()]
|
|
||||||
values.loc['ramp_down', 'RS Inhibitory'] = f['analysis']['ramp_I_down'][()]
|
|
||||||
|
|
||||||
|
|
||||||
# FS#####################################################################################################################
|
|
||||||
script_dir = os.path.dirname(os.path.realpath("__file__"))
|
|
||||||
fname = os.path.join(script_dir, '../Neuron_models/FS.hdf5')
|
|
||||||
f = h5py.File(fname, "r")
|
|
||||||
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'])
|
|
||||||
ind = 50
|
|
||||||
spiking['FS'] = f['data']['V_m'][ind][start:]
|
|
||||||
F['FS'] = f['analysis']['F_inf'][:]
|
|
||||||
values.loc['spike_ind', 'FS'] = I_mag[ind]
|
|
||||||
values.loc['ramp_up', 'FS'] = f['analysis']['ramp_I_up'][()]
|
|
||||||
values.loc['ramp_down', 'FS'] = f['analysis']['ramp_I_down'][()]
|
|
||||||
|
|
||||||
# RS Pyramidal Kv #########################################################################################################
|
|
||||||
script_dir = os.path.dirname(os.path.realpath("__file__"))
|
|
||||||
fname = os.path.join(script_dir, '../Neuron_models/RS_pyramidal_Kv.hdf5')
|
|
||||||
f = h5py.File(fname, "r")
|
|
||||||
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'])
|
|
||||||
ind = 60
|
|
||||||
spiking['RS Pyramidal +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['data']['V_m'][ind][start:]
|
|
||||||
spiking['t'] = time
|
|
||||||
F['I'] = I_mag
|
|
||||||
F['RS Pyramidal +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['F_inf'][:]
|
|
||||||
values.loc['spike_ind', 'RS Pyramidal +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = I_mag[ind]
|
|
||||||
values.loc['ramp_up', 'RS Pyramidal +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['ramp_I_up'][()]
|
|
||||||
values.loc['ramp_down', 'RS Pyramidal +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['ramp_I_down'][()]
|
|
||||||
|
|
||||||
# RS Inhibitory #########################################################################################################
|
|
||||||
script_dir = os.path.dirname(os.path.realpath("__file__"))
|
|
||||||
fname = os.path.join(script_dir, '../Neuron_models/RS_inhib_Kv.hdf5')
|
|
||||||
f = h5py.File(fname, "r")
|
|
||||||
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'])
|
|
||||||
ind = 50
|
|
||||||
spiking['RS Inhibitory +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['data']['V_m'][ind][start:]
|
|
||||||
F['I_inhib'] = I_mag
|
|
||||||
F['RS Inhibitory +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['F_inf'][:]
|
|
||||||
values.loc['spike_ind', 'RS Inhibitory +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = I_mag[ind]
|
|
||||||
values.loc['ramp_up', 'RS Inhibitory +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['ramp_I_up'][()]
|
|
||||||
values.loc['ramp_down', 'RS Inhibitory +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['ramp_I_down'][()]
|
|
||||||
|
|
||||||
|
|
||||||
# FS#####################################################################################################################
|
|
||||||
script_dir = os.path.dirname(os.path.realpath("__file__"))
|
|
||||||
fname = os.path.join(script_dir, '../Neuron_models/FS_Kv.hdf5')
|
|
||||||
f = h5py.File(fname, "r")
|
|
||||||
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'])
|
|
||||||
ind = 50
|
|
||||||
spiking['FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['data']['V_m'][ind][start:]
|
|
||||||
F['FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['F_inf'][:]
|
|
||||||
values.loc['spike_ind', 'FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = I_mag[ind]
|
|
||||||
values.loc['ramp_up', 'FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['ramp_I_up'][()]
|
|
||||||
values.loc['ramp_down', 'FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['ramp_I_down'][()]
|
|
||||||
|
|
||||||
# Cb Stellate cell ######################################################################################################
|
|
||||||
script_dir = os.path.dirname(os.path.realpath("__file__"))
|
|
||||||
fname = os.path.join(script_dir, '../Neuron_models/Cb_stellate.hdf5')
|
|
||||||
f = h5py.File(fname, "r")
|
|
||||||
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'])
|
|
||||||
ind = 60
|
|
||||||
spiking['Cb stellate'] = f['data']['V_m'][ind][start:]
|
|
||||||
F['Cb stellate'] = f['analysis']['F_inf'][:]
|
|
||||||
values.loc['spike_ind', 'Cb stellate'] = I_mag[ind]
|
|
||||||
values.loc['ramp_up', 'Cb stellate'] = f['analysis']['ramp_I_up'][()]
|
|
||||||
values.loc['ramp_down', 'Cb stellate'] = f['analysis']['ramp_I_down'][()]
|
|
||||||
|
|
||||||
|
|
||||||
# 'Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'
|
|
||||||
# Cb stellate Kv #############################################################################################
|
|
||||||
script_dir = os.path.dirname(os.path.realpath("__file__"))
|
|
||||||
fname = os.path.join(script_dir, '../Neuron_models/Cb_stellate_Kv.hdf5')
|
|
||||||
f = h5py.File(fname, "r")
|
|
||||||
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'])
|
|
||||||
ind = 130
|
|
||||||
spiking['Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['data']['V_m'][ind][start:]
|
|
||||||
F['Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['F_inf'][:]
|
|
||||||
values.loc['spike_ind', 'Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = I_mag[ind]
|
|
||||||
values.loc['ramp_up', 'Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['ramp_I_up'][()]
|
|
||||||
values.loc['ramp_down', 'Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['ramp_I_down'][()]
|
|
||||||
|
|
||||||
# 'Cb stellate $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'
|
|
||||||
# Cb stellate Kv only ####################################################################################
|
|
||||||
script_dir = os.path.dirname(os.path.realpath("__file__"))
|
|
||||||
fname = os.path.join(script_dir, '../Neuron_models/Cb_stellate_Delta_Kv.hdf5.hdf5')
|
|
||||||
f = h5py.File(fname, "r")
|
|
||||||
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'])
|
|
||||||
ind = 75
|
|
||||||
spiking['Cb stellate $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['data']['V_m'][ind][start:]
|
|
||||||
F['Cb stellate $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['F_inf'][:]
|
|
||||||
values.loc['spike_ind', 'Cb stellate $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = I_mag[ind]
|
|
||||||
values.loc['ramp_up', 'Cb stellate $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['ramp_I_up'][()]
|
|
||||||
values.loc['ramp_down', 'Cb stellate $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['ramp_I_down'][()]
|
|
||||||
|
|
||||||
# STN ###################################################################################################################
|
|
||||||
script_dir = os.path.dirname(os.path.realpath("__file__"))
|
|
||||||
fname = os.path.join(script_dir, '../Neuron_models/STN.hdf5')
|
|
||||||
f = h5py.File(fname, "r")
|
|
||||||
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'])
|
|
||||||
ind = 25
|
|
||||||
spiking['STN'] = f['data']['V_m'][ind][start:]
|
|
||||||
F['STN'] = f['analysis']['F_inf'][:]
|
|
||||||
values.loc['spike_ind', 'STN'] = I_mag[ind]
|
|
||||||
values.loc['ramp_up', 'STN'] = f['analysis']['ramp_I_up'][()]
|
|
||||||
values.loc['ramp_down', 'STN'] = f['analysis']['ramp_I_down'][()]
|
|
||||||
|
|
||||||
# 'STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
|
||||||
# STN Kv ##################################################################################################
|
|
||||||
script_dir = os.path.dirname(os.path.realpath("__file__"))
|
|
||||||
fname = os.path.join(script_dir, '../Neuron_models/STN_Kv.hdf5')
|
|
||||||
f = h5py.File(fname, "r")
|
|
||||||
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'])
|
|
||||||
ind = 95
|
|
||||||
spiking['STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['data']['V_m'][ind][start:]
|
|
||||||
F['STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['F_inf'][:]
|
|
||||||
values.loc['spike_ind', 'STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = I_mag[ind]
|
|
||||||
values.loc['ramp_up', 'STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['ramp_I_up'][()]
|
|
||||||
values.loc['ramp_down', 'STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['ramp_I_down'][()]
|
|
||||||
|
|
||||||
# 'STN $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'
|
|
||||||
# STN Kv only #############################################################################################3
|
|
||||||
script_dir = os.path.dirname(os.path.realpath("__file__"))
|
|
||||||
fname = os.path.join(script_dir, '../Neuron_models/STN_Delta_Kv.hdf5')
|
|
||||||
f = h5py.File(fname, "r")
|
|
||||||
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'])
|
|
||||||
ind = 80
|
|
||||||
spiking['STN $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['data']['V_m'][ind][start:]
|
|
||||||
F['STN $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['F_inf'][:]
|
|
||||||
values.loc['spike_ind', 'STN $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = I_mag[ind]
|
|
||||||
values.loc['ramp_up', 'STN $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['ramp_I_up'][()]
|
|
||||||
values.loc['ramp_down', 'STN $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'] = f['analysis']['ramp_I_down'][()]
|
|
||||||
|
|
||||||
#%%
|
|
||||||
spiking.to_csv('model_spiking.csv')
|
|
||||||
values.to_csv('firing_values.csv')
|
|
||||||
F.to_csv('model_F_inf.csv')
|
|
@ -1,18 +0,0 @@
|
|||||||
### Python code repository for Koch et al. 2022
|
|
||||||
Modelling on the effects of ion current property changes on firing behaviour in diverse neuronal models and in with Kv1.1 mutations that cause episodic ataxia type 1.
|
|
||||||
|
|
||||||
## ./Functions
|
|
||||||
- Python function files for models
|
|
||||||
- RS pyramidal, RS inhibitory and FS from Pospischil et al. (2008)
|
|
||||||
- Cb stellate from Alexander et al. (2019) with and without added Kv1.1
|
|
||||||
- STN from Otsuka et al. (2004) with and without added Kv1.1
|
|
||||||
- Utility_fxns.py for common useful functions
|
|
||||||
|
|
||||||
## ./Neuron_models
|
|
||||||
- Scripts for simulation of each model to current steps and ramp currents
|
|
||||||
|
|
||||||
## ./Sensitivity_Analysis
|
|
||||||
- Scripts for sensitivity analysis in each model
|
|
||||||
|
|
||||||
## ./KCNA1_mutations
|
|
||||||
- Scripts for simulation of KCNA1 mutations described in Lauxmann et al. (2021)
|
|
@ -1,8 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Fri Jun 4 08:24:33 2021
|
Script to run sensitivity analysis for Cb Stellate model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Fri Jun 4 08:24:33 2021
|
Script to run sensitivity analysis for Cb Stellate \Delta Kv1.1 model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Fri Jun 4 08:24:33 2021
|
Script to run sensitivity analysis for Cb Stellate +Kv1.1 model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Sat Jun 5 18:14:31 2021
|
Script to run sensitivity analysis for FS model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
Original Pospischil FS Sensitivity analysis (no Kv1.1)
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Sat Jun 5 18:14:31 2021
|
Script to run sensitivity analysis for FS +Kv model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from numba import types
|
from numba import types
|
||||||
from numba.typed import Dict
|
from numba.typed import Dict
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Sat Jun 5 18:14:31 2021
|
Script to run sensitivity analysis for RS Inhibitory model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Sat Jun 5 18:14:31 2021
|
Script to run sensitivity analysis for RS Inhibitory +Kv1.1 model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Fri Jun 4 08:24:33 2021
|
Script to run sensitivity analysis for RS Pyramidal model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Fri Jun 4 08:24:33 2021
|
Script to run sensitivity analysis for RS Pyramidal +Kv1.1 model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Sat Jun 5 19:44:04 2021
|
Script to run sensitivity analysis for STN model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
original STN model SA
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Sat Jun 5 19:44:04 2021
|
Script to run sensitivity analysis for STN \Delta Kv1.1 model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Created on Sat Jun 5 19:44:04 2021
|
Script to run sensitivity analysis for STN +Kv1.1 model
|
||||||
|
|
||||||
@author: nils
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from numba import types
|
from numba import types
|
||||||
from numba.typed import Dict
|
from numba.typed import Dict
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
"""
|
||||||
|
Script to analyse and collect data from simulations
|
||||||
|
|
||||||
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
|
"""
|
||||||
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import h5py
|
import h5py
|
||||||
import json
|
import json
|
||||||
@ -6,8 +14,7 @@ import numpy as np
|
|||||||
from ast import literal_eval
|
from ast import literal_eval
|
||||||
import string
|
import string
|
||||||
import matplotlib.cm as cm
|
import matplotlib.cm as cm
|
||||||
# import Code.csv_generation.SA_collection
|
|
||||||
# todo: run some and test
|
|
||||||
# %% rheo_{}_ex.csv, AUC_{}_ex.csv
|
# %% rheo_{}_ex.csv, AUC_{}_ex.csv
|
||||||
|
|
||||||
## AUC ###################
|
## AUC ###################
|
||||||
@ -147,7 +154,7 @@ rheo_slope.to_csv('rheo_slope_ex.csv')
|
|||||||
rheo_g.to_csv('rheo_g_ex.csv')
|
rheo_g.to_csv('rheo_g_ex.csv')
|
||||||
|
|
||||||
|
|
||||||
# %% todo: Model fI
|
# %% Model fI
|
||||||
# for each model
|
# for each model
|
||||||
# | (index) | mag | alt | type | F | I |
|
# | (index) | mag | alt | type | F | I |
|
||||||
# | 0 | -10 | m | shift | array | array |
|
# | 0 | -10 | m | shift | array | array |
|
||||||
@ -221,19 +228,9 @@ for m in models:
|
|||||||
os.makedirs(folder)
|
os.makedirs(folder)
|
||||||
df.to_csv(os.path.join(folder, '{}_fI.csv'.format(model_save_name[m])))
|
df.to_csv(os.path.join(folder, '{}_fI.csv'.format(model_save_name[m])))
|
||||||
|
|
||||||
# #%% todo: rheo/AUC_{}_corr - done in SA_collection.py
|
|
||||||
# # | (index) | model | corr | p_value | g | color
|
|
||||||
#
|
# %% firing_values.csv, model_spiking.csv, model_F_inf.csv
|
||||||
# # in rheo_[]_corr.csv and AUC_[]_corr.csv
|
|
||||||
# # columns=['model', 'corr', 'p_value', 'local corr', 'local p_value', 'ratio', '$\Delta V_{1/2}$', '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
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
"""
|
||||||
|
Script to analyse and collect data from sensitivity analysis simulations
|
||||||
|
|
||||||
|
__author__ = Nils A. Koch
|
||||||
|
__copyright__ = Copyright 2022, Nils A. Koch
|
||||||
|
__license__ = MIT
|
||||||
|
"""
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import h5py
|
import h5py
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
@ -13,7 +21,7 @@ top_dir = '../Sensitivity_Analysis/Data'
|
|||||||
for dir_name in next(os.walk(top_dir))[1]: # for each folder in top_file_dir (each model)
|
for dir_name in next(os.walk(top_dir))[1]: # for each folder in top_file_dir (each model)
|
||||||
folder = os.path.join(top_dir, dir_name)
|
folder = os.path.join(top_dir, dir_name)
|
||||||
print(folder)
|
print(folder)
|
||||||
# for each alt_type create pd df
|
# for each alt_type create pandas dataframe
|
||||||
shift_AUC = pd.DataFrame()
|
shift_AUC = pd.DataFrame()
|
||||||
shift_rheo = pd.DataFrame()
|
shift_rheo = pd.DataFrame()
|
||||||
shift_fI = pd.DataFrame(dtype=object)
|
shift_fI = pd.DataFrame(dtype=object)
|
||||||
@ -277,9 +285,8 @@ 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
|
||||||
#%% todo: CREATE CSV FILES ###################################################################################################
|
# | (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')
|
||||||
AUC_slope_json = pd.read_json('./Sensitivity_analysis/slope_kendall_corr_rel.json', orient='records') #, lines=True)
|
AUC_slope_json = pd.read_json('./Sensitivity_analysis/slope_kendall_corr_rel.json', orient='records') #, lines=True)
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
# Bash shell script to run all simulations and analysis
|
||||||
|
|
||||||
# Individual Neuronal models
|
# Individual Neuronal models
|
||||||
python ./Neuron_models/RS_pyramidal_model.py
|
python ./Neuron_models/RS_pyramidal_model.py
|
||||||
|
Loading…
Reference in New Issue
Block a user