-
Notifications
You must be signed in to change notification settings - Fork 1
/
syn.hoc
403 lines (319 loc) · 7.65 KB
/
syn.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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
nsyn=0
forsec "sph" {nsyn=nsyn+1}
stim.amp=0
stim.dur=0
objref syn[nsyn],r[nsyn]
use_mcell_ran4(1)
proc syn_set_col4(){ local k
k=0
forsec "sph"{
syn[k]=new expsyn2c_col4(0.5)
syn[k].tot_num=$1 //total stimulation number
syn[k].num=$2 //number of stimulation in each group
syn[k].ampar_tot=$3
syn[k].nmdar_tot=$4
syn[k].del=10
syn[k].interval_s=$5 //short interval
syn[k].interval_l=$6 //long interval
r[k]=new Random(k*10+11)
r[k].uniform(0,1)
syn[k].setRandObjRef(r[k])
k=k+1
}
print "stim_num: ", $1, " in_grp_stim: ", $2, " ampar: ", $3, " nmdar: ", $4, " int_s:", $5, " int_l:", $6
}
actk= 1 //.75
actna=1 //.75
actca= 1 //.19
nai0_na_ion=10*actna
nao0_na_ion=145*actna
ki0_k_ion=140*actk
ko0_k_ion=2.5*actk
cai0_ca_ion=5e-5*actca
cao0_ca_ion=2*actca
forall insert kext
forall insert kextna1
forall{
fhspace_kext=500
kbath_kext=ko0_k_ion
}
forsec "sp" {
uninsert kext
uninsert kextna1
}
forsec "axon_iseg" {
insert kext
insert epasn
insert kextna1
}
forsec "axon_iseg" {
insert kext
insert epasn
insert kextna1
}
axon_hill {
insert kext
insert epasn
insert kextna1
}
soma {
insert kext
insert epasn
insert kextna1
}
forsec "dend" {
insert kext
insert epasn
insert kextna1
}
proc para_save(){local k localobj file, pvec
pvec=new Vector(61)
file=new File()
//Naf_i0
pvec.x[0]=vhalf_n_Naf_i0
pvec.x[1]=slope_n_Naf_i0
pvec.x[2]=tauA_n_Naf_i0
pvec.x[3]=tauG_n_Naf_i0
pvec.x[4]=vhalf_h_Naf_i0
pvec.x[5]=slope_h_Naf_i0
pvec.x[6]=tauA_h_Naf_i0
pvec.x[7]=tauG_h_Naf_i0
//Naf_i1
pvec.x[8]=vhalf_n_Naf_i1
pvec.x[9]=slope_n_Naf_i1
pvec.x[10]=tauA_n_Naf_i1
pvec.x[11]=tauG_n_Naf_i1
pvec.x[12]=vhalf_h_Naf_i1
pvec.x[13]=slope_h_Naf_i1
pvec.x[14]=tauA_h_Naf_i1
pvec.x[15]=tauG_h_Naf_i1
//KDR_i1
pvec.x[16]=vhalf_n_KDR_i1
pvec.x[17]=slope_n_KDR_i1
pvec.x[18]=tauA_n_KDR_i1
pvec.x[19]=tauG_n_KDR_i1
pvec.x[20]=vhalf_h_KDR_i1
pvec.x[21]=slope_h_KDR_i1
pvec.x[22]=tauA_h_KDR_i1
pvec.x[23]=tauG_h_KDR_i1
//KA_i1
pvec.x[24]=vhalf_n_KA_i1
pvec.x[25]=slope_n_KA_i1
pvec.x[26]=tauA_n_KA_i1
pvec.x[27]=tauG_n_KA_i1
pvec.x[28]=vhalfD_h_KA_i1
pvec.x[29]=slope_h_KA_i1
pvec.x[30]=tauA_h_KA_i1
pvec.x[31]=tauG_h_KA_i1
pvec.x[32]=tauA_n_KS1
pvec.x[33]=tauA_n_KS2
pvec.x[34]=vhalf_n_KS1
pvec.x[35]=vhalf_n_KS2
pvec.x[36]=slope_n_KS1
pvec.x[37]=slope_n_KS2
//Gbar
pvec.x[38]=Gbar_KS1
pvec.x[39]=Gbar_KS2
pvec.x[40]=Gbar_Naf
pvec.x[41]=s0_Gbar_Naf
pvec.x[42]=aXh_Gbar_Naf
pvec.x[43]=aXi0_Gbar_Naf
pvec.x[44]=aXi1_Gbar_Naf
pvec.x[45]=Gbar_KDR
pvec.x[46]=s0_Gbar_KDR
pvec.x[47]=aXh_Gbar_KDR
pvec.x[48]=aXi0_Gbar_KDR
pvec.x[49]=aXi1_Gbar_KDR
pvec.x[50]=Gbar_KA
pvec.x[51]=Gbar_KDM
pvec.x[52] = G_Rm
pvec.x[53] = G_Ra
pvec.x[54] = G_cm
pvec.x[55] = Gbar_h
pvec.x[56] = syn[0].ampar_tot
pvec.x[57] = syn[0].nmdar_tot
file.wopen($s1)
//pvec.fwrite(file
for k=0,pvec.size()-1{
file.printf("%f\n", pvec.x[k])
}
file.close()
print "done file writing"
}
proc para_read(){local k localobj pvec, file
pvec=new Vector(61)
file=new File()
file.ropen($s1)
for k=0, pvec.size()-1{
pvec.x[k]=file.scanvar()
}
//Naf_i0
vhalf_n_Naf_i0=pvec.x[0]
slope_n_Naf_i0=pvec.x[1]
tauA_n_Naf_i0=pvec.x[2]
tauG_n_Naf_i0=pvec.x[3]
vhalf_h_Naf_i0=pvec.x[4]
slope_h_Naf_i0=pvec.x[5]
tauA_h_Naf_i0=pvec.x[6]
tauG_h_Naf_i0=pvec.x[7]
//Naf_i1
vhalf_n_Naf_i1=pvec.x[8]
slope_n_Naf_i1=pvec.x[9]
tauA_n_Naf_i1=pvec.x[10]
tauG_n_Naf_i1=pvec.x[11]
vhalf_h_Naf_i1=pvec.x[12]
slope_h_Naf_i1=pvec.x[13]
tauA_h_Naf_i1=pvec.x[14]
tauG_h_Naf_i1=pvec.x[15]
//KDR_i1
vhalf_n_KDR_i1=pvec.x[16]
slope_n_KDR_i1=pvec.x[17]
tauA_n_KDR_i1=pvec.x[18]
tauG_n_KDR_i1=pvec.x[19]
vhalf_h_KDR_i1=pvec.x[20]
slope_h_KDR_i1=pvec.x[21]
tauA_h_KDR_i1=pvec.x[22]
tauG_h_KDR_i1=pvec.x[23]
//KA_i1
vhalf_n_KA_i1=pvec.x[24]
slope_n_KA_i1=pvec.x[25]
tauA_n_KA_i1=pvec.x[26]
tauG_n_KA_i1=pvec.x[27]
vhalf_h_KA_i1=pvec.x[28]
slope_h_KA_i1=pvec.x[29]
tauA_h_KA_i1=pvec.x[30]
tauG_h_KA_i1=pvec.x[31]
tauA_n_KS1=pvec.x[32]
tauA_n_KS2=pvec.x[33]
vhalf_n_KS1=pvec.x[34]
vhalf_n_KS2=pvec.x[35]
slope_n_KS1=pvec.x[36]
slope_n_KS2=pvec.x[37]
//Gbar
Gbar_KS1=pvec.x[38]
Gbar_KS2=pvec.x[39]
Gbar_Naf=pvec.x[40]
s0_Gbar_Naf=pvec.x[41]
aXh_Gbar_Naf=pvec.x[42]
aXi0_Gbar_Naf=pvec.x[43]
aXi1_Gbar_Naf=pvec.x[44]
Gbar_KDR=pvec.x[45]
s0_Gbar_KDR=pvec.x[46]
aXh_Gbar_KDR=pvec.x[47]
aXi0_Gbar_KDR=pvec.x[48]
aXi1_Gbar_KDR=pvec.x[49]
Gbar_KA=pvec.x[50]
Gbar_KDM=pvec.x[51]
G_Rm = pvec.x[52]
G_Ra = pvec.x[53]
G_cm = pvec.x[54]
Gbar_h = pvec.x[55]
file.close()
}
//para_read("para.txt")
objref soma_cai, soma_ica, soma_v, inmdar_ca_syn[8], v_syn[8], timevec
soma_cai=new Vector()
soma_ica=new Vector()
soma_v=new Vector()
for k=0,7 {
inmdar_ca_syn[k]=new Vector()
v_syn[k]=new Vector()
}
timevec=new Vector()
count=0
forsec "soma" {count=count+1}
objref soma_cainfl[count]
/*
para_read("para.txt")
syn_set_col4()
data_record()
chdir(" ")
data_save()
*/
proc data_record(){local k
soma_cai.record(&soma.cai(0.5))
soma_ica.record(&soma.ica(0.5))
soma_v.record(&soma.v(0.5))
k=0
forsec "soma" {
soma_cainfl[k]=new Vector()
soma_cainfl[k].record(&cai(0.5))
k=k+1
}
inmdar_ca_syn[0].record(&syn[3].inmdar_ca)
v_syn[0].record(&sph_y106_L169_T4_d14_R153_B154_Adend_apical.v(0.5))
inmdar_ca_syn[1].record(&syn[23].inmdar_ca)
v_syn[1].record(&sph_y148_L390_T4_d4_R240_B241_Adend_apical.v(0.5))
inmdar_ca_syn[2].record(&syn[41].inmdar_ca)
v_syn[2].record(&sph_y293_L487_T4_d20_R302_B303_Adend_apical.v(0.5))
inmdar_ca_syn[3].record(&syn[44].inmdar_ca)
v_syn[3].record(&sph_y353_L550_T4_d20_R310_B311_Adend_apical.v(0.5))
inmdar_ca_syn[4].record(&syn[79].inmdar_ca)
v_syn[4].record(&sph_y389_L618_T4_d4_R1761_B1762_Adend_apical.v(0.5))
inmdar_ca_syn[5].record(&syn[150].inmdar_ca)
v_syn[5].record(&sph_y282_L567_T4_d4_R2065_B2066_Adend_apical.v(0.5))
inmdar_ca_syn[6].record(&syn[158].inmdar_ca)
v_syn[6].record(&sph_y172_L335_T4_d4_R2092_B2093_Adend_apical.v(0.5))
inmdar_ca_syn[7].record(&syn[159].inmdar_ca)
v_syn[7].record(&sph_y138_L376_T4_d4_R2100_B2101_Adend_apical.v(0.5))
timevec.record(&t)
}
proc vecsave() {local k localobj vec, file
vec=$o1
file=new File()
file.wopen($s2)
file.printf("label: %s\n", $s2)
file.printf("%d\n", vec.size())
for k=0,vec.size()-1{
file.printf("%f\t %f\n", timevec.x[k], vec.x[k])
}
file.close()
}
strdef filename
proc data_save(){
vecsave(soma_cai, "soma_cai.dat")
vecsave(soma_ica, "soma_ica.dat")
vecsave(soma_v, "soma_v.dat")
for k=0,7{
sprint(filename, "inmdar_ca_syn[%d].dat", k)
vecsave(inmdar_ca_syn[k], filename)
}
for k=0,7{
sprint(filename, "v_syn[%d].dat", k)
vecsave(v_syn[k], filename)
}
}
obfunc accu_ca(){local k localobj vec, vec_acc
vec=$o1
vec_acc=new Vector(vec.size())
vec_acc.x[0]=vec.x[0]
for k=1, vec.size()-1{
vec_acc.x[k]=vec.x[k]+vec_acc.x[k-1]
}
return vec_acc
}
objref syn_list
syn_list=new SectionList()
//forsec "sph" { syn_list.append() }
//PlotShape[0].color_list(syn_list,2)
sph_y389_L618_T4_d4_R1761_B1762_Adend_apical { syn_list.append() }
sph_y353_L550_T4_d20_R310_B311_Adend_apical { syn_list.append() }
sph_y293_L487_T4_d20_R302_B303_Adend_apical { syn_list.append() }
sph_y282_L567_T4_d4_R2065_B2066_Adend_apical { syn_list.append() }
sph_y172_L335_T4_d4_R2092_B2093_Adend_apical { syn_list.append() }
sph_y138_L376_T4_d4_R2100_B2101_Adend_apical { syn_list.append() }
sph_y148_L390_T4_d4_R240_B241_Adend_apical { syn_list.append() }
sph_y106_L169_T4_d14_R153_B154_Adend_apical { syn_list.append() }
sec=0
strdef secname1
forsec"sph" {
secname1=secname()
forsec syn_list {
if(issection(secname1)){
print sec, secname()
}
}
sec=sec+1
}
//syn_set_col4(25,5,200,10,10,150)
//K_c_cal0=0.002