-
Notifications
You must be signed in to change notification settings - Fork 3
/
ModelTypeC.hoc
237 lines (190 loc) · 5.72 KB
/
ModelTypeC.hoc
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
236
237
/*******************************************************************
Load a cell's morphology file and then load Typc C biophysical model
2/18/2005
*******************************************************************/
/*--------------------playing random seed----------------*/
use_mcell_ran4(1)
lowindex = 1001
mcell_ran4_init(lowindex)
highindex = 1
print "------------------------------Type C Model-----------------------"
//flag for wether or not to use NMDA-R: 0 for without NMDA-R, 1 for with NMDA-R
//this flag will be used in subsequent hoc files: NregNsyn.hoc, Nregsyn.hoc etc
NMDAFLAG = 0
if (NMDAFLAG == 0) { //only AMPA-R
wtAmpa = 1
wtNmda = 0
} else { //NMDAFLAG = 1, with both AMPA-R, NMDA-R
wtAmpa = 0.8
wtNmda = 0.2
}
xopen("./c20466.hoc") // geometry file
soma area(0.5) //make sure diam reflects 3d points
//USER5MAX, APIDENDMAX, BASDENDMAX are set in cell's hoc file
TOTALDEND = USER5MAX + APIDENDMAX + BASDENDMAX + 3 //"3": counting start at 0
objref dend[TOTALDEND]
/****************************************************************************
Grouping dendritic sections together in an array dend, later for being used to
randomly put synapses on the proximal apical, distal apical and basal dendrite
*****************************************************************************/
index = 0
forsec "dendrite" { //this will includes both dendrites and apical-dendrites
dend[index] = new SectionRef()
index += 1
}
forsec "user5" {
dend[index] = new SectionRef()
index += 1
} //now index = USER5MAX + 1
//quadratic function fitting result A and B are set in cell's hoc file
A = A1
B = B1
//synapse rise and decay time constants
TAU1=0.2 //ms
TAU2=10 //ms
//cvode_active(1)
dist=1
rel=0.1
Rm = 28000 //unit: ohm-cm^2
RmDend = Rm/1
RmSoma = Rm
RmAx = Rm
Cm = 1
CmSoma= Cm
CmAx = Cm
CmDend = Cm*1
RaAll= 50
RaSoma=50
RaAx = 50
Vrest = -65
gna = .02
AXONM = 2
gkdr = 0.01
celsius = 35.0
KMULT = 0.025
KMULTP = 0.025
gcan=0.0//005
gcal=0.0//005
gcat=0.0//005
ghd=0.00005
nash=0
forsec "axon" {insert pas e_pas=Vrest g_pas = 1/RmAx Ra=RaAx cm=CmAx}
forsec "soma" {insert pas e_pas=Vrest g_pas = 1/RmSoma Ra=RaSoma cm=CmSoma}
forsec "dendrite"{insert pas e_pas=Vrest g_pas = 1/RmDend Ra=RaAll cm=CmDend}
forsec "user5" {insert pas e_pas=Vrest g_pas = 1/RmDend Ra=RaAll cm=CmDend}
access soma
freq=50
load_file("fixnseg.hoc")
geom_nseg()
tot=0
forall {tot=tot+nseg}
distance()
maxdist=0
forsec "user5" for(x) {if (distance(x)>maxdist) {maxdist=distance(x)}}
print "total # of segments (50Hz): ",tot, " max path distance: ", maxdist
objref sref, blist[USER5MAX+1], aplist
strdef dend2, trunk
for i=0, USER5MAX {
blist[i] = new Vector()
}
aplist = new Vector(APIDENDMAX+1)
//*********mapping bifurcations******************
for i=0, APIDENDMAX apical_dendrite[i] {
while (!issection("user5.*")) {
// print "before ", i, secname()
sref = new SectionRef()
access sref.parent
sprint(dend2, secname())
}
// print "apical ",i," ",dend2
for k=0, USER5MAX user5[k] {
sprint(trunk,secname())
x=strcmp(dend2, trunk)
if (x==0) {blist[k].append(i) aplist.x[i]=k}
}
}
//************************************************
forsec "axon" {
insert nax gbar_nax=gna * AXONM sh_nax=nash
insert kdr gkdrbar_kdr=gkdr
insert kap gkabar_kap = KMULTP*0.2
}
forsec "soma" {
insert hd ghdbar_hd=ghd vhalfl_hd=-73
insert na3 ar_na3=1 sh_na3=nash gbar_na3=gna
insert kdr gkdrbar_kdr=gkdr
insert kap gkabar_kap = KMULTP
}
forsec "dendrite" {
if(!issection("apical_dendrite.*")) {
insert hd ghdbar_hd=ghd vhalfl_hd=-73
insert na3 ar_na3=1 sh_na3=nash gbar_na3=gna
insert kdr gkdrbar_kdr=gkdr
insert kap gkabar_kap = KMULTP
}
}
forsec "user5" {
insert ds
insert hd ghdbar_hd=ghd
insert na3 ar_na3=1 gbar_na3=gna sh_na3=nash
insert kdr gkdrbar_kdr=gkdr
insert kap gkabar_kap=0
insert kad gkabar_kad=0
for (x) if (x>0 && x<1) {
xdist = distance(x)
if (xdist>350) {xdist=350}
ghdbar_hd(x) = ghd*(1+3*xdist/100)
if (xdist > 100){
vhalfl_hd=-81
gkabar_kad(x) = KMULT*(1+xdist/100)
} else {
vhalfl_hd=-73
gkabar_kap(x) = KMULTP*(1+xdist/100)
}
// print secname()," ",x, gkabar_kap(x), gkabar_kad(x)
}
}
for i=0, APIDENDMAX apical_dendrite[i] {
insert ds
insert hd
insert na3 ar_na3=1 gbar_na3=gna sh_na3=nash
insert kdr gkdrbar_kdr=gkdr
insert kap
insert kad
gkabar_kad = user5[aplist.x[i]].gkabar_kad(1)
gkabar_kap = user5[aplist.x[i]].gkabar_kap(1)
vhalfl_hd = user5[aplist.x[i]].vhalfl_hd
ghdbar_hd = user5[aplist.x[i]].ghdbar_hd(1)
// print secname()," ", gkabar_kap, gkabar_kad, ghdbar_hd
}
//correct the default section name
access soma
proc init() {
t=0
forall {
v=Vrest
if (ismembrane("nax") || ismembrane("na3")) {ena=55}
if (ismembrane("kdr") || ismembrane("kap") || ismembrane("kad")) {ek=-90}
if (ismembrane("hd") ) {ehd_hd=-30}
}
finitialize(Vrest)
fcurrent()
forall {
for (x) {
if (ismembrane("na3")||ismembrane("nax")){e_pas(x)=v(x)+(ina(x)+ik(x))/g_pas(x)}
if (ismembrane("hd")) {e_pas(x)=e_pas(x)+i_hd(x)/g_pas(x)}
}
}
cvode.re_init()
cvode.event(tstop)
access soma
// g.begin()
}
proc advance() {
fadvance()
// g.plot(t)
// g.flush()
// p.flush()
// doNotify()
}
init()