-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWDR_neuron.py
235 lines (209 loc) · 6.13 KB
/
WDR_neuron.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
from neuron import h, gui
import random
import random
class WDR_model(object):
'''
Interneuron class with parameters:
delay: bool
Does it have 5ht receptors?
-Yes: True
-No: False
soma: NEURON Section (creates by topol())
dend: NEURON Section (creates by topol())
axon: NEURON Section (creates by topol())
synlistinh: list (creates by synapses())
list of inhibitory synapses
synlistex: list (creates by synapses())
list of excitatory synapses
synlistees: list (creates by synapses())
list of excitatory synapses for connection with generators
x, y, z: int
3D coordinates (isn't used)
diffs: list
list of diffusion mechanisms (NEURON staff)
recs: list
list of receptors mechanisms (NEURON staff)
'''
def __init__(self):
self.diffs = []
self.recs = []
self.topol()
# self.subsets()
self.geom()
# self.geom_nseg()
self.biophys()
self.synlistinh = []
self.synliststpd = []
self.synapses()
self.x = self.y = self.z = 0.
def __del__(self):
#print 'delete ', self
pass
def topol(self):
'''
Creates sections soma, dend, axon and connects them
if it's delay creates section dend[]: array
'''
self.soma = h.Section(name='soma', cell=self)
self.axon = h.Section(name='axon', cell=self)
self.hillock = h.Section(name='hillock', cell= self)
self.dend = [h.Section(name='dend[%d]' % i) for i in range(random.randint(5,10))]
for sec in self.dend:
sec.connect(self.soma(0))
self.hillock.connect(self.soma(1))
self.axon.connect(self.hillock(1))
self.all_secs = h.SectionList()
# for sec in self.branch:
self.all_secs.append(sec=self.soma)
self.all_secs.append(sec=self.axon)
self.all_secs.append(sec=self.hillock)
for sec in self.dend:
self.all_secs.append(sec=sec)
def subsets(self):
'''
NEURON staff
adds sections in NEURON SectionList
'''
self.all = h.SectionList()
for sec in h.allsec():
self.all.append(sec=sec)
def geom(self):
'''
Adds length and diameter to sections
'''
self.soma.L = self.soma.diam = 20#random.randint(5, 15) # microns
self.soma.nseg = 3
self.hillock.L = 9 # microns
self.hillock.diam = 2 # microns
self.hillock.nseg = 3
self.axon.L = 1000 # microns
self.axon.diam = 1 # microns
self.axon.nseg = 5
for sec in self.dend:
sec.L = 150 # microns
sec.diam = 2.5
sec.nseg = 5#random.gauss(1, 0.1) # microns
# def geom_nseg(self):
# '''
# Calculates numder of segments in section
# '''
# for sec in self.all:
# sec.nseg = int((sec.L/(0.1*h.lambda_f(100)) + .9)/2.)*2 + 1
def biophys(self):
'''
Adds channels and their parameters
if delay is true, adds 5ht receptors
'''
# for sec in self.all:
# sec.cm = 1#random.gauss(1, 0.01) # cm uf/cm2 - membrane capacitance
# # sec.ena = 55
# # sec.ek = -70
# sec.Ra = 150
self.soma.insert('fastchannels')
self.soma.gnabar_fastchannels = 0.08
self.soma.gkbar_fastchannels = 0.02
self.soma.gl_fastchannels = 0.000042
self.soma.el_fastchannels = -60
self.soma.insert('iKCa')
self.soma.insert('iCaL')
self.soma.insert('iNaP')
self.soma.insert('Kv7M')
self.soma.Ra = 150
# self.soma.insert('iCaAN')
self.soma.insert('CaIntraCellDyn')
self.soma.gbar_iKCa = 0.0001
self.soma.depth_CaIntraCellDyn = 0.1
self.soma.cai_tau_CaIntraCellDyn = 1.0
self.soma.cai_inf_CaIntraCellDyn = 50.0e-6
self.soma.pcabar_iCaL = 0.0001
self.soma.gnabar_iNaP = 0.0001
self.soma.insert('extracellular') #adds extracellular mechanism for recording extracellular potential
for sec in self.dend:
sec.insert('pas')
sec.g_pas = 0.000042
sec.e_pas = -65
sec.insert('iKCa')
sec.insert('iCaL')
sec.insert('CaIntraCellDyn')
sec.insert('iCaAN')
sec.gbar_iKCa = 0.0001
sec.depth_CaIntraCellDyn = 0.1
sec.cai_tau_CaIntraCellDyn = 2.0
sec.cai_inf_CaIntraCellDyn = 50.0e-6
sec.pcabar_iCaL = 3e-5
sec.gbar_iCaAN = 0.00007
sec.Ra = 150
self.hillock.insert('fastchannels')
self.hillock.gnabar_fastchannels = 3.45
self.hillock.gkbar_fastchannels = 0.076
self.hillock.gl_fastchannels = 0.000042
self.hillock.el_fastchannels = -65
self.axon.insert('fastchannels')
self.axon.gnabar_fastchannels = 0.01
self.axon.gkbar_fastchannels = 0.04
self.axon.gl_fastchannels = 0.00001
self.axon.el_fastchannels = -65
# self.axon.Ra = 50
# self.axon.insert('hh')
def add_5HTreceptors(self, compartment, time, g):
'''
Adds 5HT receptors
Parameters
----------
compartment: section of NEURON cell
part of neuron
x: int
x - coordinate of serotonin application
time: int (ms)
time of serotonin application
g: float
receptor conductance
'''
diff = h.slow_5HT(compartment(0.5))
diff.h = random.uniform(10, 2500)
diff.tx1 = time + 0 + (diff.h/50)*10#00
diff.c0cleft = 3
diff.a = 0.1
rec = h.r5ht3a(compartment(0.5))
rec.gmax = g
h.setpointer(diff._ref_serotonin, 'serotonin', rec)
self.diffs.append(diff)
self.recs.append(rec)
def position(self, x, y, z):
'''
NEURON staff
Adds 3D position
'''
soma.push()
for i in range(h.n3d()):
h.pt3dchange(i, x-self.x+h.x3d(i), y-self.y+h.y3d(i), z-self.z+h.z3d(i), h.diam3d(i))
self.x = x; self.y = y; self.z = z
h.pop_section()
def connect2target(self, target):
'''
NEURON staff
Adds presynapses
Parameters
----------
target: NEURON cell
target neuron
Returns
-------
nc: NEURON NetCon
connection between neurons
'''
nc = h.NetCon(self.soma(1)._ref_v, target, sec = self.soma)
nc.threshold = 0
return nc
def synapses(self):
'''
Adds synapses
'''
for i in range(30):
s = h.GABAa_DynSyn(self.soma(0.5)) # Inhibitory
self.synlistinh.append(s)
for section in self.dend:
s = h.StdwaSA(section(0.5))
self.synliststpd.append(s)
def is_art(self):
return 0