Debian Codegraph @

examples/frompapers/Stimberg_et_al_2018/example_6_COBA_with_astro.py

raw
1 # coding=utf-8
2 """
3 Modeling neuron-glia interactions with the Brian 2 simulator
4 Marcel Stimberg, Dan F. M. Goodman, Romain Brette, Maurizio De Pittà
5 bioRxiv 198366; doi: https://doi.org/10.1101/198366
6
7 Figure 6: Recurrent neuron-glial network.
8
9 Randomly connected COBA network (see Brunel, 2000) with excitatory synapses modulated
10 by release-increasing gliotransmission from a randomly connected network of astrocytes.
11 """
12
13 from brian2 import *
14
15 import plot_utils as pu
16
17 set_device('cpp_standalone', directory=None) # Use fast "C++ standalone mode"
18 seed(28371) # to get identical figures for repeated runs
19
20 ################################################################################
21 # Model parameters
22 ################################################################################
23 ### General parameters
24 N_e = 3200 # Number of excitatory neurons
25 N_i = 800 # Number of inhibitory neurons
26 N_a = 3200 # Number of astrocytes
27
28 ## Some metrics parameters needed to establish proper connections
29 size = 3.75*mmeter # Length and width of the square lattice
30 distance = 50*umeter # Distance between neurons
31
32 ### Neuron parameters
33 E_l = -60*mV # Leak reversal potential
34 g_l = 9.99*nS # Leak conductance
35 E_e = 0*mV # Excitatory synaptic reversal potential
36 E_i = -80*mV # Inhibitory synaptic reversal potential
37 C_m = 198*pF # Membrane capacitance
38 tau_e = 5*ms # Excitatory synaptic time constant
39 tau_i = 10*ms # Inhibitory synaptic time constant
40 tau_r = 5*ms # Refractory period
41 I_ex = 100*pA # External current
42 V_th = -50*mV # Firing threshold
43 V_r = E_l # Reset potential
44
45 ### Synapse parameters
46 rho_c = 0.005 # Synaptic vesicle-to-extracellular space volume ratio
47 Y_T = 500.*mmolar # Total vesicular neurotransmitter concentration
48 Omega_c = 40/second # Neurotransmitter clearance rate
49 U_0__star = 0.6 # Resting synaptic release probability
50 Omega_f = 3.33/second # Synaptic facilitation rate
51 Omega_d = 2.0/second # Synaptic depression rate
52 w_e = 0.05*nS # Excitatory synaptic conductance
53 w_i = 1.0*nS # Inhibitory synaptic conductance
54 # --- Presynaptic receptors
55 O_G = 1.5/umolar/second # Agonist binding (activating) rate
56 Omega_G = 0.5/(60*second) # Agonist release (deactivating) rate
57
58 ### Astrocyte parameters
59 # --- Calcium fluxes
60 O_P = 0.9*umolar/second # Maximal Ca^2+ uptake rate by SERCAs
61 K_P = 0.05*umolar # Ca2+ affinity of SERCAs
62 C_T = 2*umolar # Total cell free Ca^2+ content
63 rho_A = 0.18 # ER-to-cytoplasm volume ratio
64 Omega_C = 6/second # Maximal rate of Ca^2+ release by IP_3Rs
65 Omega_L = 0.1/second # Maximal rate of Ca^2+ leak from the ER
66 # --- IP_3R kinectics
67 d_1 = 0.13*umolar # IP_3 binding affinity
68 d_2 = 1.05*umolar # Ca^2+ inactivation dissociation constant
69 O_2 = 0.2/umolar/second # IP_3R binding rate for Ca^2+ inhibition
70 d_3 = 0.9434*umolar # IP_3 dissociation constant
71 d_5 = 0.08*umolar # Ca^2+ activation dissociation constant
72 # --- IP_3 production
73 # --- Agonist-dependent IP_3 production
74 O_beta = 0.5*umolar/second # Maximal rate of IP_3 production by PLCbeta
75 O_N = 0.3/umolar/second # Agonist binding rate
76 Omega_N = 0.5/second # Maximal inactivation rate
77 K_KC = 0.5*umolar # Ca^2+ affinity of PKC
78 zeta = 10 # Maximal reduction of receptor affinity by PKC
79 # --- Endogenous IP3 production
80 O_delta = 1.2*umolar/second # Maximal rate of IP_3 production by PLCdelta
81 kappa_delta = 1.5*umolar # Inhibition constant of PLC_delta by IP_3
82 K_delta = 0.1*umolar # Ca^2+ affinity of PLCdelta
83 # --- IP_3 degradation
84 Omega_5P = 0.05/second # Maximal rate of IP_3 degradation by IP-5P
85 K_D = 0.7*umolar # Ca^2+ affinity of IP3-3K
86 K_3K = 1.0*umolar # IP_3 affinity of IP_3-3K
87 O_3K = 4.5*umolar/second # Maximal rate of IP_3 degradation by IP_3-3K
88 # --- IP_3 diffusion
89 F = 0.09*umolar/second # GJC IP_3 permeability
90 I_Theta = 0.3*umolar # Threshold gradient for IP_3 diffusion
91 omega_I = 0.05*umolar # Scaling factor of diffusion
92 # --- Gliotransmitter release and time course
93 C_Theta = 0.5*umolar # Ca^2+ threshold for exocytosis
94 Omega_A = 0.6/second # Gliotransmitter recycling rate
95 U_A = 0.6 # Gliotransmitter release probability
96 G_T = 200*mmolar # Total vesicular gliotransmitter concentration
97 rho_e = 6.5e-4 # Astrocytic vesicle-to-extracellular volume ratio
98 Omega_e = 60/second # Gliotransmitter clearance rate
99 alpha = 0.0 # Gliotransmission nature
100
101 ################################################################################
102 # Define HF stimulus
103 ################################################################################
104 stimulus = TimedArray([1.0, 1.2, 1.0, 1.0], dt=2*second)
105
106 ################################################################################
107 # Simulation time (based on the stimulus)
108 ################################################################################
109 duration = 8*second # Total simulation time
110
111 ################################################################################
112 # Model definition
113 ################################################################################
114 ### Neurons
115 neuron_eqs = '''
116 dv/dt = (g_l*(E_l-v) + g_e*(E_e-v) + g_i*(E_i-v) + I_ex*stimulus(t))/C_m : volt (unless refractory)
117 dg_e/dt = -g_e/tau_e : siemens # post-synaptic excitatory conductance
118 dg_i/dt = -g_i/tau_i : siemens # post-synaptic inhibitory conductance
119 # Neuron position in space
120 x : meter (constant)
121 y : meter (constant)
122 '''
123 neurons = NeuronGroup(N_e + N_i, model=neuron_eqs,
124 threshold='v>V_th', reset='v=V_r',
125 refractory='tau_r', method='euler')
126 exc_neurons = neurons[:N_e]
127 inh_neurons = neurons[N_e:]
128 # Arrange excitatory neurons in a grid
129 N_rows = int(sqrt(N_e))
130 N_cols = N_e//N_rows
131 grid_dist = (size / N_cols)
132 exc_neurons.x = '(i // N_rows)*grid_dist - N_rows/2.0*grid_dist'
133 exc_neurons.y = '(i % N_rows)*grid_dist - N_cols/2.0*grid_dist'
134 # Random initial membrane potential values and conductances
135 neurons.v = 'E_l + rand()*(V_th-E_l)'
136 neurons.g_e = 'rand()*w_e'
137 neurons.g_i = 'rand()*w_i'
138
139 ### Synapses
140 synapses_eqs = '''
141 # Neurotransmitter
142 dY_S/dt = -Omega_c * Y_S : mmolar (clock-driven)
143 # Fraction of activated presynaptic receptors
144 dGamma_S/dt = O_G * G_A * (1 - Gamma_S) - Omega_G * Gamma_S : 1 (clock-driven)
145 # Usage of releasable neurotransmitter per single action potential:
146 du_S/dt = -Omega_f * u_S : 1 (event-driven)
147 # Fraction of synaptic neurotransmitter resources available for release:
148 dx_S/dt = Omega_d *(1 - x_S) : 1 (event-driven)
149 U_0 : 1
150 # released synaptic neurotransmitter resources:
151 r_S : 1
152 # gliotransmitter concentration in the extracellular space:
153 G_A : mmolar
154 # which astrocyte covers this synapse ?
155 astrocyte_index : integer (constant)
156 '''
157 synapses_action = '''
158 U_0 = (1 - Gamma_S) * U_0__star + alpha * Gamma_S
159 u_S += U_0 * (1 - u_S)
160 r_S = u_S * x_S
161 x_S -= r_S
162 Y_S += rho_c * Y_T * r_S
163 '''
164 exc_syn = Synapses(exc_neurons, neurons, model=synapses_eqs,
165 on_pre=synapses_action+'g_e_post += w_e*r_S',
166 method='exact')
167 exc_syn.connect(True, p=0.05)
168 exc_syn.x_S = 1.0
169 inh_syn = Synapses(inh_neurons, neurons, model=synapses_eqs,
170 on_pre=synapses_action+'g_i_post += w_i*r_S',
171 method='exact')
172 inh_syn.connect(True, p=0.2)
173 inh_syn.x_S = 1.0
174 # Connect excitatory synapses to an astrocyte depending on the position of the
175 # post-synaptic neuron
176 N_rows_a = int(sqrt(N_a))
177 N_cols_a = N_a/N_rows_a
178 grid_dist = size / N_rows_a
179 exc_syn.astrocyte_index = ('int(x_post/grid_dist) + '
180 'N_cols_a*int(y_post/grid_dist)')
181 ### Astrocytes
182 # The astrocyte emits gliotransmitter when its Ca^2+ concentration crosses
183 # a threshold
184 astro_eqs = '''
185 # Fraction of activated astrocyte receptors:
186 dGamma_A/dt = O_N * Y_S * (1 - clip(Gamma_A,0,1)) -
187 Omega_N*(1 + zeta * C/(C + K_KC)) * clip(Gamma_A,0,1) : 1
188 # Intracellular IP_3
189 dI/dt = J_beta + J_delta - J_3K - J_5P + J_coupling : mmolar
190 J_beta = O_beta * Gamma_A : mmolar/second
191 J_delta = O_delta/(1 + I/kappa_delta) * C**2/(C**2 + K_delta**2) : mmolar/second
192 J_3K = O_3K * C**4/(C**4 + K_D**4) * I/(I + K_3K) : mmolar/second
193 J_5P = Omega_5P*I : mmolar/second
194 # Diffusion between astrocytes:
195 J_coupling : mmolar/second
196
197 # Ca^2+-induced Ca^2+ release:
198 dC/dt = J_r + J_l - J_p : mmolar
199 dh/dt = (h_inf - h)/tau_h : 1
200 J_r = (Omega_C * m_inf**3 * h**3) * (C_T - (1 + rho_A)*C) : mmolar/second
201 J_l = Omega_L * (C_T - (1 + rho_A)*C) : mmolar/second
202 J_p = O_P * C**2/(C**2 + K_P**2) : mmolar/second
203 m_inf = I/(I + d_1) * C/(C + d_5) : 1
204 h_inf = Q_2/(Q_2 + C) : 1
205 tau_h = 1/(O_2 * (Q_2 + C)) : second
206 Q_2 = d_2 * (I + d_1)/(I + d_3) : mmolar
207
208 # Fraction of gliotransmitter resources available for release:
209 dx_A/dt = Omega_A * (1 - x_A) : 1
210 # gliotransmitter concentration in the extracellular space:
211 dG_A/dt = -Omega_e*G_A : mmolar
212 # Neurotransmitter concentration in the extracellular space:
213 Y_S : mmolar
214 # The astrocyte position in space
215 x : meter (constant)
216 y : meter (constant)
217 '''
218 glio_release = '''
219 G_A += rho_e * G_T * U_A * x_A
220 x_A -= U_A * x_A
221 '''
222 astrocytes = NeuronGroup(N_a, astro_eqs,
223 # The following formulation makes sure that a "spike" is
224 # only triggered at the first threshold crossing
225 threshold='C>C_Theta',
226 refractory='C>C_Theta',
227 # The gliotransmitter release happens when the threshold
228 # is crossed, in Brian terms it can therefore be
229 # considered a "reset"
230 reset=glio_release,
231 method='rk4',
232 dt=1e-2*second)
233 # Arrange astrocytes in a grid
234 astrocytes.x = '(i // N_rows_a)*grid_dist - N_rows_a/2.0*grid_dist'
235 astrocytes.y = '(i % N_rows_a)*grid_dist - N_cols_a/2.0*grid_dist'
236 # Add random initialization
237 astrocytes.C = 0.01*umolar
238 astrocytes.h = 0.9
239 astrocytes.I = 0.01*umolar
240 astrocytes.x_A = 1.0
241
242 ecs_astro_to_syn = Synapses(astrocytes, exc_syn,
243 'G_A_post = G_A_pre : mmolar (summed)')
244 ecs_astro_to_syn.connect('i == astrocyte_index_post')
245 ecs_syn_to_astro = Synapses(exc_syn, astrocytes,
246 'Y_S_post = Y_S_pre/N_incoming : mmolar (summed)')
247 ecs_syn_to_astro.connect('astrocyte_index_pre == j')
248 # Diffusion between astrocytes
249 astro_to_astro_eqs = '''
250 delta_I = I_post - I_pre : mmolar
251 J_coupling_post = -(1 + tanh((abs(delta_I) - I_Theta)/omega_I))*
252 sign(delta_I)*F/2 : mmolar/second (summed)
253 '''
254 astro_to_astro = Synapses(astrocytes, astrocytes,
255 model=astro_to_astro_eqs)
256 # Connect to all astrocytes less than 75um away
257 # (about 4 connections per astrocyte)
258 astro_to_astro.connect('i != j and '
259 'sqrt((x_pre-x_post)**2 +'
260 ' (y_pre-y_post)**2) < 75*um')
261
262 ################################################################################
263 # Monitors
264 ################################################################################
265 # Note that we could use a single monitor for all neurons instead, but this
266 # way plotting is a bit easier in the end
267 exc_mon = SpikeMonitor(exc_neurons)
268 inh_mon = SpikeMonitor(inh_neurons)
269 ast_mon = SpikeMonitor(astrocytes)
270
271 ################################################################################
272 # Simulation run
273 ################################################################################
274 run(duration, report='text')
275
276 ################################################################################
277 # Plot of Spiking activity
278 ################################################################################
279 plt.style.use('figures.mplstyle')
280
281 fig, ax = plt.subplots(nrows=3, ncols=1, sharex=True, figsize=(6.26894, 6.26894*0.8),
282 gridspec_kw={'height_ratios': [1, 6, 2],
283 'left': 0.12, 'top': 0.97})
284 time_range = np.linspace(0, duration/second, int(duration/second*100))*second
285 ax[0].plot(time_range, I_ex*stimulus(time_range)/pA, 'k')
286 ax[0].set(xlim=(0, duration/second), ylim=(98, 122),
287 yticks=[100, 120], ylabel='$I_{ex}$ (pA)')
288 pu.adjust_spines(ax[0], ['left'])
289
290 ## We only plot a fraction of the spikes
291 fraction = 4
292 ax[1].plot(exc_mon.t[exc_mon.i <= N_e//fraction]/second,
293 exc_mon.i[exc_mon.i <= N_e//fraction], '|', color='C0')
294 ax[1].plot(inh_mon.t[inh_mon.i <= N_i//fraction]/second,
295 inh_mon.i[inh_mon.i <= N_i//fraction]+N_e//fraction, '|', color='C1')
296 ax[1].plot(ast_mon.t[ast_mon.i <= N_a//fraction]/second,
297 ast_mon.i[ast_mon.i <= N_a//fraction]+(N_e+N_i)//fraction,
298 '|', color='C2')
299 ax[1].set(xlim=(0, duration/second), ylim=[0, (N_e+N_i+N_a)//fraction],
300 yticks=np.arange(0, (N_e+N_i+N_a)//fraction+1, 250),
301 ylabel='cell index')
302 pu.adjust_spines(ax[1], ['left'])
303
304 # Generate frequencies
305 bin_size = 1*ms
306 spk_count, bin_edges = np.histogram(np.r_[exc_mon.t/second, inh_mon.t/second],
307 int(duration/bin_size))
308 rate = 1.0*spk_count/(N_e + N_i)/bin_size/Hz
309 rate[rate<0.001] = 0.001 # Fix 0 lower bound for log scale
310 ax[2].semilogy(bin_edges[:-1], rate, '-', color='k')
311 pu.adjust_spines(ax[2], ['left', 'bottom'])
312 ax[2].set(xlim=(0, duration/second), ylim=(0.1, 150),
313 xticks=np.arange(0, 9), yticks=[0.1, 1, 10, 100],
314 xlabel='time (s)', ylabel='rate (Hz)')
315 ax[2].get_yaxis().set_major_formatter(ScalarFormatter())
316
317 pu.adjust_ylabels(ax, x_offset=-0.11)
318
319 plt.show()