Functions and plotting scripts for each model, sensitivity analysis in each model and KCNA1 mutations in each model

This commit is contained in:
nkoch1
2022-08-28 15:57:33 -04:00
parent 64e663d857
commit 47f5c1db02
42 changed files with 8963 additions and 11 deletions

View File

@@ -0,0 +1,88 @@
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 18 10:47:40 2021
@author: nils
"""
import numpy as np
import os
from Utility import capacitance, stimulus_init, init_dict
from Code.Functions.Cb_stellate_fxns_Kv import Cb_stellate_Kv_mut
# model parameters
dt = 0.01
sec = 2
low = 0
high = 0.0015
number_steps = 200
initial_period = 1000
num_gating = 11
num_current = 7
C, surf_area = capacitance(61.4, 1.50148)
variable = np.array(['m', 'h', 'n', 'n_A', 'h_A', 'm_T', 'h_T', 's', 'u', 's_mut', 'u_mut'])
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', 'n_A', 'h_A', 'm_T', 'h_T', 's', 'u', 's_mut', 'u_mut']))
V_init = -70
# initialize arrays
current = np.zeros((num_current, stim_num))
gating = np.zeros((num_gating, stim_num))
# gating parameters
b_param['m'][:] = np.array([-37., -3, 1])
b_param['h'] = np.zeros(4)
b_param['h'][:] = np.array([-40., 4., 1., 0])
b_param['n'][:] = np.array([-23, -5, 1])
b_param['n_A'][:] = np.array([-27, -13.2, 1.])
b_param['h_A'][:] = np.array([-80., 6.5, 1.])
b_param['m_T'][:] = np.array([-50., -3, 1.])
b_param['h_T'][:] = np.array([-68., 3.75, 1.])
b_param['s'][:] = np.array([-14.16, -10.15, 1.])
b_param['u'] = np.zeros(4)
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.zeros(4)
b_param['u_mut'][:] = np.array([-31., 5.256, 1., 0.245])
# reversal potentials
E["Na"] = 55.
E["K"] = -80.
E["Ca"] = 22.
E["Leak"] = -70. # as per Molineux et al 2005 and NOT the -38 in Alexander et al 2019
# model currents
currents_included["Na"] = True
currents_included["Kd"] = True
currents_included["Kv"] = True
currents_included["Kv_mut"] = True
currents_included["A"] = False
currents_included["T"] = True
currents_included["Leak"] = True
# model conductances
g["Na"] = 34 * surf_area
g["Kd"] = 9.0556 * surf_area
if currents_included["Kv_mut"] == True:
g["Kv"] = 1.50159 / 2 * surf_area
else:
g["Kv"] = 1.50159 / 2 * surf_area * 2
g["Kv_mut"] = 1.50159 / 2 * surf_area
g["A"] = 0 * surf_area
g["T"] = 0.45045 * surf_area
g["Leak"] = 0.07407 * surf_area
prominence = 50
min_spike_height = 0
desired_AUC_width = high/5
folder = '../Neuron_models'
mut = 'Cb_stellate_Delta_Kv'
mutations = {mut:{'g_ratio': 1, 'activation_Vhalf_diff': 0, 'activation_k_ratio':0}}
if not os.path.isdir(folder):
os.makedirs(folder)
Cb_stellate_Kv_mut(V_init, g, E, I_in, dt, currents_included, stim_time, stim_num, C, shift, scale, b_param, slope_shift,
gating, current, prominence, desired_AUC_width, mutations, mut, folder, high, low, number_steps,
initial_period, sec)

View File

@@ -0,0 +1,87 @@
# -*- coding: utf-8 -*-
"""
Created on Sat May 8 16:20:11 2021
@author: nils
"""
import numpy as np
import os
from Utility import capacitance, stimulus_init, init_dict
from Code.Functions.Cb_stellate_fxns_Kv import Cb_stellate_Kv_mut
# model parameters
dt = 0.01
sec = 2
low = 0
high = 0.0015
number_steps = 200
initial_period = 1000
num_gating = 11
num_current = 7
C, surf_area = capacitance(61.4, 1.50148)
variable = np.array(['m', 'h', 'n', 'n_A', 'h_A', 'm_T', 'h_T', 's', 'u', 's_mut', 'u_mut'])
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', 'n_A', 'h_A', 'm_T', 'h_T', 's', 'u', 's_mut', 'u_mut']))
V_init = -70
# initialize arrays
current = np.zeros((num_current, stim_num))
gating = np.zeros((num_gating, stim_num))
# gating parameters
b_param['m'][:] = np.array([-37., -3, 1])
b_param['h'] = np.zeros(4)
b_param['h'][:] = np.array([-40., 4., 1., 0])
b_param['n'][:] = np.array([-23, -5, 1])
b_param['n_A'][:] = np.array([-27, -13.2, 1.])
b_param['h_A'][:] = np.array([-80., 6.5, 1.])
b_param['m_T'][:] = np.array([-50., -3, 1.])
b_param['h_T'][:] = np.array([-68., 3.75, 1.])
b_param['s'][:] = np.array([-14.16, -10.15, 1.])
b_param['u'] = np.zeros(4)
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.zeros(4)
b_param['u_mut'][:] = np.array([-31., 5.256, 1., 0.245])
# reversal potentials
E["Na"] = 55.
E["K"] = -80.
E["Ca"] = 22.
E["Leak"] = -70. # as per Molineux et al 2005 and NOT the -38 in Alexander et al 2019
# model currents
currents_included["Na"] = True
currents_included["Kd"] = True
currents_included["Kv"] = True
currents_included["Kv_mut"] = True
currents_included["A"] = True
currents_included["T"] = True
currents_included["Leak"] = True
# model conductances
Kv_ratio = 0.1
g["Na"] = 3.4 * surf_area
g["Kd"] = 9.0556 * (1-Kv_ratio) * surf_area
g["Kv"] = 6. * Kv_ratio/2 * surf_area * (2 * int(currents_included["Kv_mut"] == False))
g["Kv_mut"] = 6. * Kv_ratio/2 * surf_area
g["A"] = 15.0159 * surf_area
g["T"] = 0.45045 * surf_area
g["Leak"] = 0.07407 * surf_area
prominence = 50
min_spike_height = 0
desired_AUC_width = high/5
folder = '../Neuron_models'
mut = 'Cb_stellate_Kv'
mutations = {mut:{'g_ratio': 1, 'activation_Vhalf_diff': 0, 'activation_k_ratio':0}}
if not os.path.isdir(folder):
os.makedirs(folder)
Cb_stellate_Kv_mut(V_init, g, E, I_in, dt, currents_included, stim_time, stim_num, C, shift, scale, b_param, slope_shift,
gating, current, prominence, desired_AUC_width, mutations, mut, folder, high, low, number_steps,
initial_period, sec)

View File

@@ -0,0 +1,73 @@
import numpy as np
import os
from Code.Functions.Utility import capacitance, stimulus_init, init_dict
from Code.Functions.Cb_stellate_fxns import Cb_stellate_mut
# model parameters
dt = 0.01
sec = 2
low = 0
high = 0.0015
number_steps = 200
initial_period = 1000
num_gating = 9
num_current = 6
C, surf_area = capacitance(61.4, 1.50148)
variable = np.array(['m', 'h', 'n', 'n_A', 'h_A', 'n_A_mut', 'h_A_mut', 'm_T', 'h_T'])
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', 'n_A', 'h_A','n_A_mut', 'h_A_mut', 'm_T', 'h_T']))
V_init = -70
# initialize arrays
current = np.zeros((num_current, stim_num))
gating = np.zeros((num_gating, stim_num))
# gating parameters
b_param['m'][:] = np.array([-37., -3, 1])
b_param['h'] = np.zeros(4)
b_param['h'][:] = np.array([-40., 4., 1., 0])
b_param['n'][:] = np.array([-23, -5, 1])
b_param['n_A'][:] = np.array([-27, -13.2, 1.])
b_param['h_A'][:] = np.array([-80., 6.5, 1.])
b_param['n_A_mut'][:] = np.array([-27, -13.2, 1.])
b_param['h_A_mut'][:] = np.array([-80., 6.5, 1.])
b_param['m_T'][:] = np.array([-50., -3, 1.])
b_param['h_T'][:] = np.array([-68., 3.75, 1.])
# reversal potentials
E["Na"] = 55.
E["K"] = -80.
E["Ca"] = 22.
E["Leak"] = -70. # as per Molineux et al 2005 and NOT the -38 in Alexander et al 2019
# model currents
currents_included["Na"] = True
currents_included["Kd"] = True
currents_included["A_mut"] = True
currents_included["A"] = True
currents_included["T"] = True
currents_included["Leak"] = True
# model conductances
g["Na"] = 3.4 * surf_area
g["Kd"] = 9.0556 * surf_area
g["A_mut"] = 15.0159 * surf_area * 0.5
g["A"] = 15.0159 * surf_area* 0.5
g["T"] = 0.45045 * surf_area
g["Leak"] = 0.07407 * surf_area
prominence = 50
min_spike_height = 0
desired_AUC_width = high/5
folder = '../Neuron_models'
mut = 'Cb_stellate'
mutations = {mut:{'g_ratio': 1, 'activation_Vhalf_diff': 0, 'activation_k_ratio':0}}
if not os.path.isdir(folder):
os.makedirs(folder)
Cb_stellate_mut(V_init, g, E, I_in, dt, currents_included, stim_time, stim_num, C, shift, scale, b_param, slope_shift,
gating, current, prominence, desired_AUC_width, mutations, mut, folder, high, low, number_steps,
initial_period, sec)

View File

@@ -0,0 +1,100 @@
# -*- coding: utf-8 -*-
"""
Created on Fri May 7 23:37:22 2021
@author: nils
"""
import numpy as np
from numba import types
from numba.typed import Dict
import os
from Code.Functions.Utility import capacitance, stimulus_init, init_dict
from Code.Functions.Pospischil_fxns import Pospischil_mut
# 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']))
# initialize arrays
current = np.zeros((num_current, stim_num))
gating = np.zeros((num_gating, stim_num))
# initialize dictionary
ind_dict = Dict.empty(key_type=types.unicode_type, value_type=types.int64, )
i = 0
for var in np.array(['m', 'h', 'n', 'q', 'r', 'p', 's', 'u', 's_mut', 'u_mut']):
ind_dict[var] = i
i += 1
i = 0
for var in np.array(['Na', 'Kd', 'M', 'Kv', 'Kv_mut', 'L', 'Leak']):
ind_dict[var] = i
i += 1
# gating parameters
b_param['m'][:] = np.array([-34.33054521, -8.21450277, 1.42295686])
b_param['h'] = np.zeros(4)
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.zeros(4)
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.zeros(4)
b_param['u_mut'][:] = np.array([-31., 5.256, 1., 0.245])
# reversal potentials
E["Na"] = 50.
E["K"] = -90.
E["Ca"] = 120.
E["Leak"] = -70.4
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
Kv_ratio = 0.10
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
tau_max_p = 502
V_init = -70
V_T = -57.9
prominence = 50
min_spike_height = 0
desired_AUC_width = high/5
folder = '../Neuron_models'
if not os.path.isdir(folder):
os.makedirs(folder)
mut = 'FS_Kv'
mutations = {mut:{'g_ratio': 1, 'activation_Vhalf_diff': 0, 'activation_k_ratio':0}}
Pospischil_mut(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, current, prominence, desired_AUC_width, mutations, mut, folder,
high, low, number_steps, initial_period, sec)

View File

@@ -0,0 +1,101 @@
# -*- coding: utf-8 -*-
"""
Created on Fri May 7 23:37:22 2021
@author: nils
Original Pospischil FS (no Kv1.1)
"""
# Todo: error when run
import numpy as np
from numba import types
from numba.typed import Dict
import os
from Code.Functions.Utility import capacitance, stimulus_init, init_dict
from Code.Functions.Pospischil_fxns import Pospischil_mut
# 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']))
# initialize arrays
current = np.zeros((num_current, stim_num))
gating = np.zeros((num_gating, stim_num))
# initialize dictionary
ind_dict = Dict.empty(key_type=types.unicode_type, value_type=types.int64, )
i = 0
for var in np.array(['m', 'h', 'n', 'q', 'r', 'p', 's', 'u', 's_mut', 'u_mut']):
ind_dict[var] = i
i += 1
i = 0
for var in np.array(['Na', 'Kd', 'M', 'Kv', 'Kv_mut', 'L', 'Leak']):
ind_dict[var] = i
i += 1
# gating parameters
b_param['m'][:] = np.array([-34.33054521, -8.21450277, 1.42295686])
b_param['h'] = np.zeros(4)
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.zeros(4)
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.zeros(4)
b_param['u_mut'][:] = np.array([-31., 5.256, 1., 0.245])
# reversal potentials
E["Na"] = 50.
E["K"] = -90.
E["Ca"] = 120.
E["Leak"] = -70.4
# currents in model
currents_included["Na"] = True
currents_included["Kd"] = True
currents_included["Kv"] = False
currents_included["Kv_mut"] = False
currents_included["L"] = False
currents_included["M"] = True
currents_included["Leak"] = True
# model conductances
g["Na"] = 58. * surf_area
g["Kd"] = 3.9 * surf_area
g["M"] = 0.075 * surf_area
g["Kv"] = 0.
g["Kv_mut"] = 0.
g["L"] = 0.
g["Leak"] = 0.038 * surf_area
tau_max_p = 502
V_init = -70
V_T = -57.9
prominence = 50
min_spike_height = 0
desired_AUC_width = high/5
folder = '../Neuron_models'
if not os.path.isdir(folder):
os.makedirs(folder)
mut = 'FS'
mutations = {mut:{'g_ratio': 1, 'activation_Vhalf_diff': 0, 'activation_k_ratio':0}}
Pospischil_mut(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, current, prominence, desired_AUC_width, mutations, mut, folder,
high, low, number_steps, initial_period, sec)

View File

@@ -0,0 +1,114 @@
# -*- coding: utf-8 -*-
"""
Created on Fri May 7 23:37:22 2021
@author: nils
"""
import numpy as np
from numba import types
from numba.typed import Dict
import os
from Code.Functions.Utility import capacitance, stimulus_init, init_dict
from Code.Functions.Pospischil_fxns import Pospischil_mut
# model parameters
dt = 0.01
sec = 2
low = 0
high = 0.00035
number_steps = 200
initial_period = 1000
num_gating = 10
num_current = 7
C, surf_area = capacitance(61.8, 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 = 934
V_init = -70
V_T = -67.9
# initialize arrays
current = np.zeros((num_current, stim_num))
gating = np.zeros((num_gating, stim_num))
# initialize dictionary
ind_dict = Dict.empty(key_type=types.unicode_type, value_type=types.int64, )
i = 0
for var in np.array(['m', 'h', 'n', 'q', 'r', 'p', 's', 'u', 's_mut', 'u_mut']):
ind_dict[var] = i
i += 1
i = 0
for var in np.array(['Na', 'Kd', 'M', 'Kv', 'Kv_mut', 'L', 'Leak']):
ind_dict[var] = i
i += 1
# gating parameters
b_param['m'][:] = np.array([-34.33054521, -8.21450277, 1.42295686])
b_param['h'] = np.zeros(4)
b_param['h'][:] = np.array([-34.51951036, 4.04059373, 1., 0.05])
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.zeros(4)
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.zeros(4)
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"] = -56.2
# 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"] = 10. * surf_area
g["Kd"] = 2.1 * (1 - Kv_ratio) * surf_area
g["M"] = 0.0098 * surf_area
if currents_included["Kv_mut"] == True:
g["Kv"] = 2.1 * Kv_ratio / 2 * surf_area
else:
g["Kv"] = 2.1 * Kv_ratio / 2 * surf_area * 2
g["Kv_mut"] = 2.1 * Kv_ratio / 2 * surf_area
g["L"] = 0. * surf_area
g["Leak"] = 0.0205 * surf_area
prominence = 50
min_spike_height = 0
desired_AUC_width = high/5 #0.0005
folder = '../Neuron_models'
if not os.path.isdir(folder):
os.makedirs(folder)
mut = 'RS_inhib_Kv'
mutations = {mut:{'g_ratio': 1, 'activation_Vhalf_diff': 0, 'activation_k_ratio':0}}
Pospischil_mut(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, current, prominence, desired_AUC_width, mutations, mut, folder,
high, low, number_steps, initial_period, sec)

View File

@@ -0,0 +1,102 @@
# -*- coding: utf-8 -*-
"""
Created on Fri May 7 23:37:22 2021
@author: nils
Original Pospischil RS inhibitory (no Kv1.1)
"""
import numpy as np
from numba import types
from numba.typed import Dict
import os
from Code.Functions.Utility import capacitance, stimulus_init, init_dict
from Code.Functions.Pospischil_fxns import Pospischil_mut
# model parameters
dt = 0.01
sec = 2
low = 0
high = 0.00035
number_steps = 200
initial_period = 1000
num_gating = 10
num_current = 7
C, surf_area = capacitance(61.8, 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 = 934
V_init = -70
V_T = -67.9
# initialize arrays
current = np.zeros((num_current, stim_num))
gating = np.zeros((num_gating, stim_num))
# initialize dictionary
ind_dict = Dict.empty(key_type=types.unicode_type, value_type=types.int64, )
i = 0
for var in np.array(['m', 'h', 'n', 'q', 'r', 'p', 's', 'u', 's_mut', 'u_mut']):
ind_dict[var] = i
i += 1
i = 0
for var in np.array(['Na', 'Kd', 'M', 'Kv', 'Kv_mut', 'L', 'Leak']):
ind_dict[var] = i
i += 1
# gating parameters
b_param['m'][:] = np.array([-34.33054521, -8.21450277, 1.42295686])
b_param['h'] = np.zeros(4)
b_param['h'][:] = np.array([-34.51951036, 4.04059373, 1., 0.05])
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.zeros(4)
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.zeros(4)
b_param['u_mut'][:] = np.array([-31., 5.256, 1., 0.245])
# reversal potential
E["Na"] = 50.
E["K"] = -90.
E["Ca"] = 120.
E["Leak"] = -56.2
# model currents
currents_included["Na"] = True
currents_included["Kd"] = True
currents_included["Kv"] = False
currents_included["Kv_mut"] = False
currents_included["L"] = False
currents_included["M"] = True
currents_included["Leak"] = True
g["Na"] = 10. * surf_area
g["Kd"] = 2.1 * surf_area
g["M"] = 0.0098 * surf_area
g["Kv"] = 0.
g["Kv_mut"] = 0.
g["L"] = 0.
g["Leak"] = 0.0205 * surf_area
prominence = 50
min_spike_height = 0
desired_AUC_width = high/5
folder = '../Neuron_models'
if not os.path.isdir(folder):
os.makedirs(folder)
mut = 'RS_inhib'
mutations = {mut:{'g_ratio': 1, 'activation_Vhalf_diff': 0, 'activation_k_ratio':0}}
Pospischil_mut(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, current, prominence, desired_AUC_width, mutations, mut, folder,
high, low, number_steps, initial_period, sec)

View File

@@ -0,0 +1,117 @@
# -*- coding: utf-8 -*-
"""
Created on Fri May 7 23:37:22 2021
@author: nils
"""
import numpy as np
from numba import types
from numba.typed import Dict
import os
from Code.Functions.Utility import capacitance, stimulus_init, init_dict
from Code.Functions.Pospischil_fxns import Pospischil_mut
# model parameters
tau_max_p = 608
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(61.4, 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']))
V_init = -70
V_T = -56.2
# initialize arrays
current = np.zeros((num_current, stim_num))
gating = np.zeros((num_gating, stim_num))
# initialize dictionary
ind_dict = Dict.empty(key_type=types.unicode_type, value_type=types.int64, )
i = 0
for var in np.array(['m', 'h', 'n', 'q', 'r', 'p', 's', 'u', 's_mut', 'u_mut']):
ind_dict[var] = i
i += 1
i = 0
for var in np.array(['Na', 'Kd', 'M', 'Kv', 'Kv_mut', 'L', 'Leak']):
ind_dict[var] = i
i += 1
# gating parameters
b_param['m'][:] = np.array([-34.33054521, -8.21450277, 1.42295686])
b_param['h'] = np.zeros(4)
b_param['h'][:] = np.array([-34.51951036, 4.04059373, 1., 0.05])
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.zeros(4)
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.zeros(4)
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.3
# model currents
currents_included["Na"] = True
currents_included["Kd"] = True
currents_included["Kv"] = True
currents_included["Kv_mut"] = False
currents_included["L"] = False
currents_included["M"] = False
currents_included["Leak"] = True
# model conductances
Kv_ratio = 0.1
g["Na"] = 56. * surf_area
g["Kd"] = 6. * (1 - Kv_ratio) * surf_area
g["M"] = 0.075 * surf_area
if currents_included["Kv_mut"] == True:
g["Kv"] = 6. * Kv_ratio / 2 * surf_area
else:
g["Kv"] = 6. * Kv_ratio / 2 * surf_area * 2
g["Kv_mut"] = 6. * Kv_ratio / 2 * surf_area
g["L"] = 0. * surf_area
g["Leak"] = 0.0205 * surf_area
prominence = 50
min_spike_height = 0
desired_AUC_width = high/5
folder = '../Neuron_models'
if not os.path.isdir(folder):
os.makedirs(folder)
mut = 'RS_pyramidal_Kv'
mutations = {mut:{'g_ratio': 1, 'activation_Vhalf_diff': 0, 'activation_k_ratio':0}}
Pospischil_mut(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, current, prominence, desired_AUC_width, mutations, mut, folder,
high, low, number_steps, initial_period, sec)

View File

@@ -0,0 +1,99 @@
# -*- coding: utf-8 -*-
"""
Created on Fri May 7 23:37:22 2021
@author: nils
"""
import numpy as np
from numba import types
from numba.typed import Dict
import os
from Code.Functions.Utility import capacitance, stimulus_init, init_dict
from Code.Functions.Pospischil_fxns import Pospischil_mut
# model parameters
tau_max_p = 608
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(61.4, 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']))
V_init = -70
V_T = -56.2
# initialize parameters
current = np.zeros((num_current, stim_num))
gating = np.zeros((num_gating, stim_num))
# initialize dictionary
ind_dict = Dict.empty(key_type=types.unicode_type, value_type=types.int64, )
i = 0
for var in np.array(['m', 'h', 'n', 'q', 'r', 'p', 's', 'u', 's_mut', 'u_mut']):
ind_dict[var] = i
i += 1
i = 0
for var in np.array(['Na', 'Kd', 'M', 'Kv', 'Kv_mut', 'L', 'Leak']):
ind_dict[var] = i
i += 1
# gating parameters
b_param['m'][:] = np.array([-34.33054521, -8.21450277, 1.42295686])
b_param['h'] = np.zeros(4)
b_param['h'][:] = np.array([-34.51951036, 4.04059373, 1., 0.05])
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.]) # -45 with 10 mV shift so that it contributes to resting potential
b_param['s'][:] = np.array([-14.16, -10.15, 1.])
b_param['u'] = np.zeros(4)
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.zeros(4)
b_param['u_mut'][:] = np.array([-31., 5.256, 1., 0.245])
# reversal potentials
E["Na"] = 50.
E["K"] = -90.
E["Ca"] = 120.
E["Leak"] = -70.3
# model currents
currents_included["Na"] = True
currents_included["Kd"] = True
currents_included["Kv"] = False
currents_included["Kv_mut"] = False
currents_included["L"] = False
currents_included["M"] = True
currents_included["Leak"] = True
# model conductances
g["Na"] = 56. * surf_area
g["Kd"] = 6. * surf_area
g["M"] = 0.075 * surf_area
g["Kv"] = 0.
g["Kv_mut"] = 0.
g["L"] = 0.
g["Leak"] = 0.0205 * surf_area
prominence = 50
min_spike_height = 0
desired_AUC_width = high / 5
folder = '../Neuron_models'
if not os.path.isdir(folder):
os.makedirs(folder)
mut = 'RS_pyramidal'
mutations = {mut:{'g_ratio': 1, 'activation_Vhalf_diff': 0, 'activation_k_ratio':0}}
Pospischil_mut(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, current, prominence, desired_AUC_width, mutations, mut, folder,
high, low, number_steps, initial_period, sec)

View File

@@ -0,0 +1,111 @@
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 18 10:53:45 2021
@author: nils
"""
import numpy as np
import os
from Code.Functions.Utility import capacitance, stimulus_init, init_dict
from Code.Functions.STN_fxns_Kv import STN_Kv_mut
# model parameters
dt = 0.01
sec = 2
low = 0
high = 0.005
number_steps = 100
initial_period = 1000
num_gating = 17
num_current = 9
d = 61.4
r = d/2 * 10**-6 # radius in meters
vol = np.pi * r**3 # volume in liters
C, surf_area = capacitance(d, 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', 'a', 'b', 'c', 'd1', 'd2', 'p', 'q', 'r', 's', 'u', 's_mut', 'u_mut','Ca_conc', 'E_Ca']))
V_init = -70
# initialize arrays
current = np.zeros((num_current, stim_num))
gating = np.zeros((num_gating, stim_num))
# initialize dictionary
ind_dict = {}
i = 0
for var in np.array(['m', 'h', 'n', 'a', 'b', 'c', 'd1', 'd2', 'p', 'q', 'r', 's', 'u', 's_mut', 'u_mut', 'Ca_conc','E_Ca']):
ind_dict[var] = i
i += 1
i = 0
for var in np.array(['Na', 'Kd', 'A', 'L', 'Kv', 'Kv_mut', 'T', 'Leak', 'Ca_K']):
ind_dict[var] = i
i += 1
# gating parameters
b_param['m'] = np.array([-40., -1. , 1.])
b_param['h'] = np.zeros(4)
b_param['h'] = np.array([-45.5, 1. , 1., 0.05])
b_param['n'] = np.array([-41., -1., 1.])
b_param['p'] = np.array([-56., -1., 1.])
b_param['q'] = np.array([-85., 1., 1.])
b_param['r'] = np.array([0.17, -0.08, 1.])
b_param['a'] = np.array([-45., -14.7, 1.])
b_param['b'] = np.array([-90., 7.5, 1.])
b_param['c'] = np.array([-30.6, -5., 1.])
b_param['d1'] = np.array([-60, 7.5, 1.])
b_param['d2'] = np.array([0.1, 0.02, 1.])
b_param['s'] = np.array([-14.16, -10.15, 1.])
b_param['u'] = np.zeros(4)
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.zeros(4)
b_param['u_mut'] = np.array([-31., 5.256, 1., 0.245])
# reversal potentials
E["Na"] = 60.
E["K"] = -90.
E["Leak"] = -60.
# model currents
currents_included["Na"] = True
currents_included["Kd"] =True
currents_included["Kv"] = True
currents_included["Kv_mut"] = True
currents_included["L"] = True
currents_included["T"] = True
currents_included["Ca_K"] = True
currents_included["A"] =True
currents_included["Leak"] = True
# model conductances
Kv_ratio = 0.1
g["Na"] = 49. * surf_area
g["Kd"] = 27. * (1-Kv_ratio)* surf_area
if currents_included["Kv_mut"]==True:
g["Kv"] = 27. * Kv_ratio/2 * surf_area
else:
g["Kv"] = 27. * Kv_ratio/2 * surf_area * 2
g["Kv_mut"] = 27. * Kv_ratio/2 * surf_area
g["A"] = 5. * surf_area
g["L"] = 5. * surf_area
g["T"] = 5. * surf_area
g["Ca_K"] = 1 * surf_area
g["Leak"] = 0.035 * surf_area
prominence = 50
min_spike_height = 0
desired_AUC_width = high/5
folder = '../Neuron_models'
mut = 'STN_Delta_Kv'
mutations = {mut:{'g_ratio': 1, 'activation_Vhalf_diff': 0, 'activation_k_ratio':0}}
if not os.path.isdir(folder):
os.makedirs(folder)
STN_Kv_mut(V_init, g, E, I_in, dt, currents_included, stim_time, stim_num, C, shift, scale, b_param, slope_shift,
gating, current, prominence, desired_AUC_width, mutations, mut, folder, high, low, number_steps,
initial_period, sec, vol)

View File

@@ -0,0 +1,105 @@
import numpy as np
import os
from Code.Functions.Utility import capacitance, stimulus_init, init_dict
from Code.Functions.STN_fxns_Kv import STN_Kv_mut
# model parameters
dt = 0.01
sec = 2
low = 0
high = 0.005
number_steps = 100
initial_period = 1000
num_gating = 17
num_current = 9
d = 61.4
r = d/2 * 10**-6 # radius in meters
vol = np.pi * r**3 # volume in liters
C, surf_area = capacitance(d, 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', 'a', 'b', 'c', 'd1', 'd2', 'p', 'q', 'r', 's', 'u', 's_mut', 'u_mut','Ca_conc', 'E_Ca']))
V_init = -70
# initialize arrays
current = np.zeros((num_current, stim_num))
gating = np.zeros((num_gating, stim_num))
# initialize dictionary
ind_dict = {}
i = 0
for var in np.array(['m', 'h', 'n', 'a', 'b', 'c', 'd1', 'd2', 'p', 'q', 'r', 's', 'u', 's_mut', 'u_mut', 'Ca_conc','E_Ca']):
ind_dict[var] = i
i += 1
i = 0
for var in np.array(['Na', 'Kd', 'A', 'L', 'Kv', 'Kv_mut', 'T', 'Leak', 'Ca_K']):
ind_dict[var] = i
i += 1
# gating parameters
b_param['m'] = np.array([-40., -1., 1.])
b_param['h'] = np.zeros(4)
b_param['h'] = np.array([-45.5, 1., 1., 0.05])
b_param['n'] = np.array([-41., -1., 1.])
b_param['p'] = np.array([-56., -1., 1.])
b_param['q'] = np.array([-85., 1., 1.])
b_param['r'] = np.array([0.17, -0.08, 1.])
b_param['a'] = np.array([-45., -14.7, 1.])
b_param['b'] = np.array([-90., 7.5, 1.])
b_param['c'] = np.array([-30.6, -5., 1.])
b_param['d1'] = np.array([-60, 7.5, 1.])
b_param['d2'] = np.array([0.1, 0.02, 1.])
b_param['s'] = np.array([-14.16, -10.15, 1.])
b_param['u'] = np.zeros(4)
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.zeros(4)
b_param['u_mut'] = np.array([-31., 5.256, 1., 0.245])
# reversal potentials
E["Na"] = 60.
E["K"] = -90.
E["Leak"] = -60.
# model currents
currents_included["Na"] = True
currents_included["Kd"] =True
currents_included["Kv"] = True
currents_included["Kv_mut"] = True
currents_included["L"] = True
currents_included["T"] = True
currents_included["Ca_K"] = True
currents_included["A"] =True
currents_included["Leak"] = True
# model conductances
Kv_ratio = 0.1
g["Na"] = 49. * surf_area
g["Kd"] = 27. * (1-Kv_ratio)* surf_area
if currents_included["Kv_mut"]==True:
g["Kv"] = 27. * Kv_ratio/2 * surf_area
else:
g["Kv"] = 27. * Kv_ratio/2 * surf_area * 2
g["Kv_mut"] = 27. * Kv_ratio/2 * surf_area
g["A"] = 5. * surf_area
g["L"] = 5. * surf_area
g["T"] = 5. * surf_area
g["Ca_K"] = 1 * surf_area
g["Leak"] = 0.035 * surf_area
prominence = 50
min_spike_height = 0
desired_AUC_width = high/5
folder = '../Neuron_models'
mut = 'STN_Kv'
mutations = {mut:{'g_ratio': 1, 'activation_Vhalf_diff': 0, 'activation_k_ratio':0}}
if not os.path.isdir(folder):
os.makedirs(folder)
STN_Kv_mut(V_init, g, E, I_in, dt, currents_included, stim_time, stim_num, C, shift, scale, b_param, slope_shift,
gating, current, prominence, desired_AUC_width, mutations, mut, folder, high, low, number_steps,
initial_period, sec, vol)

View File

@@ -0,0 +1,94 @@
import numpy as np
import os
from Code.Functions.Utility import capacitance, stimulus_init, init_dict
from Code.Functions.STN_fxns import STN_mut
# model parameters
dt = 0.01
sec = 2
low = 0
high = 0.005
number_steps = 100
initial_period = 1000
num_gating = 15
num_current = 8
d = 61.4
r = d/2 * 10**-6 # radius in meters
vol = np.pi * r**3 # volume in liters
C, surf_area = capacitance(d, 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', 'a', 'b', 'a_mut', 'b_mut', 'c', 'd1', 'd2', 'p', 'q', 'r', 'Ca_conc', 'E_Ca']))
# initialize arrays
current = np.zeros((num_current, stim_num))
gating = np.zeros((num_gating, stim_num))
# initialize dictionary
ind_dict = {}
i = 0
for var in np.array(['m', 'h', 'n', 'a', 'b', 'a_mut', 'b_mut', 'c', 'd1', 'd2', 'p', 'q', 'r', 'Ca_conc','E_Ca']):
ind_dict[var] = i
i += 1
i = 0
for var in np.array(['Na', 'Kd', 'A', 'L', 'A_mut', 'T', 'Leak', 'Ca_K']):
ind_dict[var] = i
i += 1
# gating parameters
b_param['m'] = np.array([-40., -1. , 1.])
b_param['h'] = np.zeros(4)
b_param['h'] = np.array([-45.5, 1. , 1., 0.05])
b_param['n'] = np.array([-41., -1., 1.])
b_param['p'] = np.array([-56., -1., 1.])
b_param['q'] = np.array([-85., 1., 1.])
b_param['r'] = np.array([0.17, -0.08, 1.])
b_param['a'] = np.array([-45., -14.7, 1.])
b_param['b'] = np.array([-90., 7.5, 1.])
b_param['a_mut'] = np.array([-45., -14.7, 1.])
b_param['b_mut'] = np.array([-90., 7.5, 1.])
b_param['c'] = np.array([-30.6, -5., 1.])
b_param['d1'] = np.array([-60, 7.5, 1.])
b_param['d2'] = np.array([0.1, 0.02, 1.])
# reversal potentials
E["Na"] = 60.
E["K"] = -90.
E["Leak"] = -60.
# model currents
currents_included["Na"] = True
currents_included["Kd"] =True
currents_included["L"] = True
currents_included["T"] = True
currents_included["Ca_K"] = True
currents_included["A"] =True
currents_included["A_mut"] =True
currents_included["Leak"] = True
# model conductances
Kv_ratio = 0.1
g["Na"] = 49. * surf_area
g["Kd"] = 27. * (1-Kv_ratio)* surf_area
g["A"] = 5. * surf_area *0.5
g["A_mut"] = 5. * surf_area *0.5
g["L"] = 5. * surf_area
g["T"] = 5. * surf_area
g["Ca_K"] = 1 * surf_area
g["Leak"] = 0.035 * surf_area
V_init = -70
prominence = 50
min_spike_height = 0
desired_AUC_width = high/5
folder = '../Neuron_models'
mut = 'STN'
mutations = {mut:{'g_ratio': 1, 'activation_Vhalf_diff': 0, 'activation_k_ratio':0}}
if not os.path.isdir(folder):
os.makedirs(folder)
STN_mut(V_init, g, E, I_in, dt, currents_included, stim_time, stim_num, C, shift, scale, b_param, slope_shift,
gating, current, prominence, desired_AUC_width, mutations, mut, folder, high, low, number_steps,
initial_period, sec, vol)