-
Notifications
You must be signed in to change notification settings - Fork 1
/
DG500_M7.hoc
731 lines (635 loc) · 23.6 KB
/
DG500_M7.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
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
// This is a fully wired network that functions with 500 Granule Cells, 15 Mossy cells, 6 Basket cells and 6 HIPP Cells
//Model is based on Santhakumar et al., 2005 Fig7. The output data replicates panels A2 and B2
//Network activity is initiated by a single artificial stimulation of the Perforant Path (PP) input to 100GCs and some MC and BCs
//NOTE: Simulations include only AMPA and GABA synapses
//NOTE: single cell templates are based on physiological data obtained in synaptic blockers
//Cells are arranged in a RING and connections are made with TOPOGRAPHIC constraints
//NOTE: This simulation includes SPROUTED connections between GC axons on to GC dendrites - not present in the normal dentate
secondorder=2
tstep=0
period=2
dt=0.1
tstop=300 //1500
// define network size
ngcell = 500
nbcell = 6
nmcell = 15
nhcell = 6
npp = 1
print "Granule Cell #s range from:", 0, " to ", ngcell - 1
print "Basket Cell #s range from:", ngcell, " to ", ngcell + nbcell - 1
print "Mossy Cell #s range from:", ngcell + nbcell, " to ", ngcell + nbcell + nmcell - 1
print "Granule Cell #s range from:", ngcell + nbcell + nmcell, " to ", ngcell + nbcell + nmcell + nhcell - 1
print "Stimulating cell # should be: ", ngcell + nbcell + nmcell + nhcell
// read in the cell definitions
xopen("cells.hoc")
//###############################################################################################################
//############## CONNECTING THE CELLS #############################
// NETWORK SPECIFICATION INTERFACE
for i=0, ngcell-1 {Gcell[i] = new GranuleCell(i)}
for i=0, nbcell-1 {Bcell[i] = new BasketCell(i)}
for i=0, nmcell-1 {Mcell[i] = new MossyCell(i)}
for i=0, nhcell-1 {Hcell[i] = new HIPPCell(i)}
for i =0, npp-1 {PPSt[i] = new PPstim(i)}
objref nclist, netcon, cells, net_c, net_d, net_gr, net_bc, net_mc, net_hc, vbc2gc, vmc2gc, vhc2gc
{ cells = new List()
nclist = new List()
}
// Include all cells in cells
func cell_append() {cells.append($o1)
return cells.count -1}
func nc_append() {
if ($3 >= 0 ) {
cells.object($1).connect_pre(cells.object($2).pre_list.object($3),netcon)
netcon.weight = $4 netcon.delay = $5 netcon.threshold = $6
}
nclist.append(netcon)
return nclist.count-1
}
// To check for preexisting connections between randomly selected cells
//to avoid multiple contacts between same 2 cells
func is_connected() {local i, c
c=0
for i=0, nclist.count-1 {
net_c= nclist.object(i)
if (($o1 == net_c.postcell()) && ($o2 == net_c.precell())) {c=1}
}
return c
}
objref vbc2gc, vmc2gc, vhc2gc, vgc2bc, vbc2bc, vmc2bc, vhc2bc, vgc2mc, vbc2mc, vmc2mc, vhc2mc, vgc2hc, vmc2hc,vgc2gc
//To delete certain randomly selected cells from net - in this case 8 of 15 MCs
objref killMC
{
vgc2bc = new Vector(nbcell, 0) //defines vectors for each "pre2post" pair, vector length is same as number of post cells fills with 0
vbc2bc = new Vector(nbcell, 0)
vmc2bc = new Vector(nbcell, 0)
vhc2bc = new Vector(nbcell, 0)
//To delete certain randomly selected cells from net - in this case 8 of 15 MCs
killMC = new Vector(8, 0)
vgc2mc = new Vector(nmcell, 0)
vbc2mc = new Vector(nmcell, 0)
vmc2mc = new Vector(nmcell, 0)
vhc2mc = new Vector(nmcell, 0)
vgc2hc = new Vector(nhcell, 0)
vmc2hc = new Vector(nhcell, 0)
vbc2gc = new Vector(ngcell, 0)
vmc2gc = new Vector(ngcell, 0)
vhc2gc = new Vector(ngcell, 0)
vgc2gc = new Vector(ngcell, 0)
}
//initiating randm number generator for each pre2post pair
//also randomly select MC to kill "deadMC"
objref rdsynb, rdsyna, rdgc2hc, rdgc2bc, rdgc2mc, rdbc2gc, rdbc2bc, rdbc2mc, deadMC
objref rdmc2gc1, rdmc2gc2, rdmc2bc, rdmc2mc, rdmc2mc1, rdmc2hc, rdhc2gc, rdhc2bc, rdhc2mc, rdgc2gc
//ropen("/proc/uptime") // get a seed that is changing based on the processing time
// {
// rseed = fscan() // so simulation will not start with the same seed
// ropen()
// }
rseed = 7890
//************************************ GC ***********************************************
rdgc2bc = new Random(rseed) // use for syn.connections
proc new_rdgc2bc() {rdgc2bc.discunif(-1,1)} // range is based on spread of connections on either side of RING- precell loc =0
new_rdgc2bc()
rdgc2mc = new Random(rseed) // use for syn.connections
proc new_rdgc2mc() {rdgc2mc.discunif(0,2)}
new_rdgc2mc()
rdgc2hc = new Random(rseed) // use for syn.connections
proc new_rdgc2hc() {rdgc2hc.discunif(-2 , 2)}
new_rdgc2hc()
rdgc2gc = new Random(rseed) // use for syn.connections
proc new_rdgc2gc() {rdgc2gc.discunif(-50, 50)}
new_rdgc2gc()
//************************************ BC ***********************************************
rdbc2gc = new Random(rseed) // use for syn.connections
proc new_rdbc2gc() {rdbc2gc.discunif(-70, 70)} // range is based on spread of connections on either side of RING- precell loc =0
new_rdbc2gc()
rdbc2bc = new Random(rseed) // use for syn.connections
proc new_rdbc2bc() {rdbc2bc.discunif(-1, 1)}
new_rdbc2bc()
rdbc2mc = new Random(rseed) // use for syn.connections
proc new_rdbc2mc() {rdbc2mc.discunif(-3, 3)}
new_rdbc2mc()
//************************************* MC ********************************************
//deadMC = new Random(rseed) //randomly select MC to kill "deadMC"
//proc new_deadMC() {deadMC.discunif(ngcell+nbcell, ngcell+nbcell+nmcell-1)}
//new_deadMC()
// Check to see if 8 different cells are killed
//for i= 0, 7 {
//MC = deadMC.repick()
//if (killMC.contains(MC) == 0) {
//killMC.x[i] = MC
//} else {i -=1}
//}
rdmc2gc1 = new Random(rseed) // use for syn.connections
proc new_rdmc2gc1() {rdmc2gc1.discunif(25, 175)} // range is based on spread of connections on either side of RING- precell loc =0
new_rdmc2gc1()
rdmc2gc2 = new Random(rseed) // use for syn.connections
proc new_rdmc2gc2() {rdmc2gc2.discunif(-175, -25)}
new_rdmc2gc2()
rdmc2bc = new Random(rseed) // use for syn.connections
proc new_rdmc2bc() {rdmc2bc.discunif(-3,3)}
new_rdmc2bc()
rdmc2mc = new Random(rseed) // use for syn.connections
proc new_rdmc2mc() {rdmc2mc.discunif(ngcell+nbcell, ngcell+nbcell+nmcell-1)}
new_rdmc2mc()
rdmc2mc1 = new Random(rseed) // use for syn.connections
proc new_rdmc2mc1() {rdmc2mc1.discunif(-3, 3)}
new_rdmc2mc1()
rdmc2hc = new Random(rseed) // use for syn.connections
proc new_rdmc2hc() {rdmc2hc.discunif(-2, 2)}
new_rdmc2hc()
//************************************* HC ********************************************
rdhc2gc = new Random(rseed) // use for syn.connections
proc new_rdhc2gc() {rdhc2gc.discunif(-130, 130)}
new_rdhc2gc()
rdhc2bc = new Random(rseed) // use for syn.connections
proc new_rdhc2bc() {rdhc2bc.discunif(-2, 2)}
new_rdhc2bc()
rdhc2mc = new Random(rseed) // use for syn.connections
proc new_rdhc2mc() {rdhc2mc.discunif(-2, 2)}
new_rdhc2mc()
//**************** randomizer for the dendritic location of synapse **************************************
rdsyna = new Random(rseed) // initialize random distr.
proc new_rdsyna() {rdsyna.discunif(0, 1)} // randomize among 2 dendrites
new_rdsyna()
rdsynb = new Random(rseed) // initialize random distr.
proc new_rdsynb() {rdsynb.discunif(0, 3)} // randomize among 4 dendrites
new_rdsynb()
// NETWORK INITIATION
for i = 0, ngcell-1 {cell_append(Gcell[i])} // cells 0-499 GCs
for i = 0, nbcell-1 {cell_append(Bcell[i])} // cells 500-505 BC
for i = 0, nmcell-1 {cell_append(Mcell[i])} // cells 506-520 MC
for i = 0, nhcell-1 {cell_append(Hcell[i])} // cells 521-526 HC
for i = 0, npp-1 {cell_append(PPSt[i])} // 527 PP artificial cell
//**************Preforant Path synaptic connections ******************************
proc initNet() { local i,j
for i=0, npp-1 {
for j=0, 100 { // to 101 granule cells
nc_append(i+ngcell+nbcell+nmcell+nhcell, j, 0, 2e-2, 3, 10) // connect PP to GC[j],syn[0],wt,del,threshold
nc_append(i+ngcell+nbcell+nmcell+nhcell, j, 1, 2e-2, 3, 1) // connect PP to GC[j],syn[1],wt,del,threshold
}
for j= ngcell, ngcell+1 { //to 2 BCs
nc_append(ngcell+nbcell+nmcell+nhcell, j, 0, 1e-2, 3, 10) // Gcell[3] to Bcell[1]
nc_append(ngcell+nbcell+nmcell+nhcell, j, 1, 1e-2, 3, 10) // Gcell[3] to Bcell[1]
}
// for j=0, 1 { // 15% of MCs have OML dendrites so 2 of 15 MCs could get PP input
// npost = rdmc2mc.repick() //pick MC at random
// dbr = rdsynb.repick()
// if the MC is not already connected to PP and the randomly picked MC is proximal to the stimulated GCs
// if ((is_connected(MossyCell[npost-ngcell-nbcell], PPstim[0]) == 0) && (npost < ngcell+nbcell+3) && (killMC.contains(npost) == 0)) {
//connect PP syn to the selected mossy
// nc_append(ngcell+nbcell+nmcell+nhcell, npost, dbr, 0.5e-2, 3, 10) // Gcell[3] to Bcell[1]
// print npost, dbr
// } else { j -= 1 print "pp2mc"}
// if (killMC.contains(npost) == 1) {j +=1}
// }
}
//******************************************************************************************
//**************Granule Cell post synaptic connections ******************************
for i=0, ngcell-1 {
for j=0, 0 {
// Based on the lamellar distribution of the GCs to BCs - 500 GCs were divided into 6 groups proximal to each of the 6 BCs
if (i < 84) { a=0}
if ((i > 83) && (i < 166)) { a=1}
if ((i > 165) && (i < 252)) { a=2}
if ((i > 251) && (i < 336)) { a=3}
if ((i > 335) && (i < 420)) { a=4}
if ((i > 419) && (i < 500)) { a=5}
Gauz3 = rdgc2bc.repick() // randomly pick location of post synaptic Bcell
if (a+Gauz3 > 5) {npost = a+Gauz3-6 } //determine appropriate post syn BC
if (a+Gauz3 < 0) {npost = a+Gauz3+6}
if ((a+Gauz3 > -1) && (a+Gauz3 < 6)) {npost = a+Gauz3}
dbr = rdsynb.repick() // randomly pick the dendrite to connect to
print npost, a
if (vgc2bc.x[npost] < 90) { //check to make sure that post syn BC does not get more than 90 GC synapses
nc_append(i, ngcell+npost, dbr+2, 4.7e-3, .8, 10) // connect GC[i] to BC[j],syn[2]+dendritic_var,wt,del,threshold
print i, npost, dbr+2
vgc2bc.x[npost] +=1 //increment the no of synapses to the post cell
} else {j -= 1 print "nogc2bc"} // for connection that is not made reconnect axon to another cell
}
// Based on the lamellar distribution of the GCs to MCs - 500 GCs were divided into 5 groups, 3 MCs were distributed in each lamella
for j=0, 0 {
if (i < 100) { a=0}
if ((i > 99) && (i < 200)) { a=1}
if ((i > 199) && (i < 300)) { a=2}
if ((i > 299) && (i < 400)) { a=3}
if ((i > 399) && (i < 500)) { a=4}
b=a*3
npost = rdgc2mc.repick()
dbr = rdsynb.repick()
// print npost, b
// if ((vgc2mc.x[npost+b] < 38) && (killMC.contains(ngcell+nbcell+npost+b) == 0)){ // use if killing MC
if (vgc2mc.x[npost+b] < 38){
nc_append(i, ngcell+nbcell+npost+b, dbr+4, 0.2e-3, 1.5, 10) // Gcell[3] to Bcell[1]
// print npost+b, dbr+4
vgc2mc.x[npost+b] +=1
} else { j -= 1 print "nogc2mc"}
// if (killMC.contains(ngcell+nbcell+npost+b) == 1) {j +=1 print "dead MC"} // use if killing MC
}
for j=0, 2 {
if (i < 84) { a=0}
if ((i > 83) && (i < 166)) { a=1}
if ((i > 165) && (i < 252)) { a=2}
if ((i > 251) && (i < 336)) { a=3}
if ((i > 335) && (i < 420)) { a=4}
if ((i > 419) && (i < 500)) { a=5}
Gauz3 = rdgc2hc.repick()
if (a+Gauz3 > 5) {npost = a+Gauz3-6 }
if (a+Gauz3 < 0) {npost = a+Gauz3+6}
if ((a+Gauz3 > -1) && (a+Gauz3 < 6)) {npost = a+Gauz3}
dbr = rdsynb.repick()
if ((is_connected(HIPPCell[npost], GranuleCell[i]) == 0) && (vgc2hc.x[npost] < 275)) {
nc_append(i, ngcell+nbcell+nmcell+npost, dbr, 0.5e-3, 1.5, 10) // Gcell[3] to Bcell[1]
// print npost, dbr
vgc2hc.x[npost] +=1
} else {j -= 1 print "hhhh"}
}
// NOTE: THIS IS FOR SPROUTED SYNAPSES
for j=0, 9 {
Gauz3 = rdgc2gc.repick()
//print Gauz3
if (i+Gauz3 > 499) {npost = i+Gauz3-500 }
if (i+Gauz3 < 0) {npost = i+Gauz3+500}
if ((i+Gauz3 > -1) && (i+Gauz3 < 500)) {npost = i+Gauz3}
//print npost
dbr = rdsyna.repick()
if ((is_connected(GranuleCell[npost], GranuleCell[i]) == 0) && (vgc2gc.x[npost] < 15)) {
nc_append(i, npost, dbr+7, 2e-3, .8, 10) // Gcell[3] to Bcell[1]
// print npost, dbr+8
vgc2gc.x[npost] +=1
} else {j -= 1 print "gc2gc"}
}
}
//******************************************************************************************
//**************Basket Cell post synaptic connections ******************************
for i=0, nbcell-1 {
for j=0, 99 {
Gauz3 = rdbc2gc.repick()
print Gauz3
if (i*83+41+Gauz3 > 499) {npost = i*83+41+Gauz3-500 }
if (i*83+41+Gauz3 < 0) {npost = i*83+41+Gauz3+500}
if ((i*83+41+Gauz3 > -1) && (i*83+41+Gauz3 < 500)) {npost = i*83+41+Gauz3}
print i, npost
if ((is_connected(GranuleCell[npost], BasketCell[i]) == 0) && (vbc2gc.x[npost] < 2)) {
nc_append(i+ngcell, npost, 6, 1.6e-3, .85, -10) // Gcell[3] to Bcell[1]
vbc2gc.x[npost] +=1
print i, npost, 6
} else {j -= 1 print "BC2GC"}
}
for j=0, 1 {
Gauz3 = rdbc2bc.repick()
//print Gauz3
if (i+Gauz3 > 5) {npost = i+Gauz3-6 }
if (i+Gauz3 < 0) {npost = i+Gauz3+6}
if ((i+Gauz3 >-1) && (i+Gauz3 < 6)) {npost = i+Gauz3}
dbr = rdsyna.repick()
if ((is_connected(BasketCell[npost], BasketCell[i]) == 0) && (vbc2bc.x[npost] < 3)) {
nc_append(i+ngcell, npost+ngcell, dbr+8, 7.6e-3, .8, -10) // Gcell[3] to Bcell[1]
print npost, dbr+8
vbc2bc.x[npost] +=1
} else {j -= 1 print "bc2bc"}
}
for j=0, 2 {
Gauz3 = rdbc2mc.repick()
//print Gauz3
if (i*2+2+Gauz3 > 14) {npost = i*2+2+Gauz3-15 }
if (i*2+2+Gauz3 < 0) {npost = i*2+2+Gauz3+15}
if ((i*2+2+Gauz3 >-1) && (i*2+2+Gauz3 < 15)) {npost = i*2+2+Gauz3}
//print npost
// if ((is_connected(MossyCell[npost], BasketCell[i]) == 0) && (vbc2mc.x[npost] < 3) && (killMC.contains(ngcell+nbcell+npost) == 0)) { // use if killing MC
if ((is_connected(MossyCell[npost], BasketCell[i]) == 0) && (vbc2mc.x[npost] < 3)) {
nc_append(i+ngcell, npost+ngcell+nbcell, 12, 1.5e-3, 1.5, -10) // Gcell[3] to Bcell[1]
print npost, 12
vbc2mc.x[npost] +=1
} else { j -= 1 print "bc2mc"}
// if (killMC.contains(ngcell+nbcell+npost) == 1) {j +=1 print "dead MC"} // use if killing MC
}
}
//******************************************************************************************
//**************Mossy Cell post synaptic connections ******************************
for i=0, nmcell-1 {
//if (killMC.contains(ngcell+nbcell+i) == 0){ // use if killing MC
if (i < 3) { y=0}
if ((i > 2) && (i < 6)) { y=1}
if ((i > 5) && (i < 9)) { y=2}
if ((i > 8) && (i < 12)) { y=3}
if ((i > 11) && (i < 15)) { y=4}
for j=0, 99 {
Gauz1 = rdmc2gc1.repick()
print Gauz1
if (i*33+17+Gauz1 > 499) {
npost1 = i*33+17+Gauz1-500
} else {npost1 =i*33+17+Gauz1}
print npost1
dbr = rdsyna.repick()
if ((is_connected(GranuleCell[npost1], MossyCell[i]) == 0) && (vmc2gc.x[npost1] < 7)) {
nc_append(i+ngcell+nbcell, npost1, dbr+2, 0.3e-3, 3, 10) // Gcell[3] to Bcell[1]
vmc2gc.x[npost1] +=1
print i, npost1, dbr+2
} else {j -= 1 print "MC2GC1"}
}
for j=0, 99 {
Gauz2 = rdmc2gc2.repick()
//print Gauz2
if (i*33+17+Gauz2 < 0) {
npost2 =i*33+17+Gauz2+500
} else {npost2 =i*33+17+Gauz2}
//print npost2
dbr = rdsyna.repick()
if ((is_connected(GranuleCell[npost2], MossyCell[i]) == 0) && (vmc2gc.x[npost2] < 7)) {
nc_append(i+ngcell+nbcell, npost2, dbr+2, 0.3e-3, 3, 10) // Gcell[3] to Bcell[1]
vmc2gc.x[npost2] +=1
// print i, npost2, dbr+2
} else {j -= 1 print "MC2GC2"}
}
for j=0, 0 {
Gauz3 = rdmc2bc.repick()
if (y+Gauz3 > 5) {npost = y+Gauz3-6}
if (y+Gauz3 < 0) {npost = y+Gauz3+6}
if ((y+Gauz3 > -1) && (y+Gauz3 < 6)) {npost = y+Gauz3}
dbr = rdsyna.repick()
if ((vmc2bc.x[npost] < 4) && (Gauz3 !=0)) {
nc_append(i+ngcell+nbcell, ngcell+npost, dbr+6, 0.3e-3, 3, 10) // Gcell[3] to Bcell[1]
// print npost, dbr+6
vmc2bc.x[npost] += 1
} else {j -= 1 print "mc2bc"}
}
for j=0, 2 {
Gauz3 = rdmc2mc1.repick()
//print Gauz3
if (i+Gauz3 > 14) {npost = i+Gauz3-15 }
if (i+Gauz3 < 0) {npost = i+Gauz3+15}
if ((i+Gauz3 >-1) && (i+Gauz3 < 15)) {npost = i+Gauz3}
//print npost
dbr = rdsynb.repick()
// if ((is_connected(MossyCell[npost], MossyCell[i]) == 0) && (vmc2mc.x[npost] < 4) && (Gauz3 != 0) && (killMC.contains(ngcell+nbcell+npost) == 0)) { // use if killing MC
if ((is_connected(MossyCell[npost], MossyCell[i]) == 0) && (vmc2mc.x[npost] < 4) && (Gauz3 != 0)) {
nc_append(i+ngcell+nbcell, npost+ngcell+nbcell, dbr+8, 0.5e-3, 2, 10) // Gcell[3] to Bcell[1]
// print npost, dbr+8
vmc2mc.x[npost] +=1
} else { j -= 1 print "mc2mc"}
// if (killMC.contains(ngcell+nbcell+npost) == 1){ j += 1 print "dead MC"} // use if killing MC
}
for j=0, 1 {
Gauz3 = rdmc2hc.repick()
if (y+Gauz3 > 5) {npost = y+Gauz3-6}
if (y+Gauz3 < 0) {npost = y+Gauz3+6}
if ((y+Gauz3 > -1) && (y+Gauz3 < 6)) {npost = y+Gauz3}
dbr = rdsynb.repick()
if ((is_connected(HIPPCell[npost], MossyCell[i]) == 0) && (vmc2hc.x[npost] < 7) && (Gauz3 != 0)) {
nc_append(i+ngcell+nbcell, ngcell+nbcell+nmcell+npost, dbr+4, 0.2e-3, 3, 10) // Gcell[3] to Bcell[1]
// print npost, dbr+4
vmc2hc.x[npost] +=1
} else { j -= 1 print y, Gauz3, "mc2hc"}
}
//}
}
//******************************************************************************************
//**************HIPP Cell post synaptic connections ******************************
for i=0, nhcell-1 {
for j=0, 159 {
Gauz3 = rdhc2gc.repick()
//print Gauz3
if (i*83+41+Gauz3 > 499) {npost = i*83+41+Gauz3-500 }
if (i*83+41+Gauz3 < 0) {npost = i*83+41+Gauz3+500}
if ((i*83+41+Gauz3 > -1) && (i*83+41+Gauz3 < 500)) {npost = i*83+41+Gauz3}
//print npost
dbr = rdsyna.repick()
if ((is_connected(GranuleCell[npost], HIPPCell[i]) == 0) && (vhc2gc.x[npost] < 3)) {
nc_append(i+ngcell+nbcell+nmcell, npost, dbr+4, 0.5e-3, 1.6, 10) // Gcell[3] to Bcell[1]
vhc2gc.x[npost] +=1
print i, npost, dbr+4
} else {j -= 1 print "HC2GC"}
}
for j=0, 3 {
Gauz3 = rdhc2bc.repick()
if (i+Gauz3 > 5) {npost = i+Gauz3-6}
if (i+Gauz3 < 0) {npost = i+Gauz3+6}
if ((i+Gauz3 > -1) && (i+Gauz3 < 6)) {npost = i+Gauz3}
dbr = rdsyna.repick()
if ((is_connected(BasketCell[npost], HIPPCell[i]) == 0) && (vhc2bc.x[npost] < 5)) {
nc_append(i+ngcell+nbcell+nmcell, npost+ngcell, dbr+10, 0.5e-3, 1.6, 10) // Gcell[3] to Bcell[1]
print npost, dbr+10
vhc2bc.x[npost] += 1
} else {j -= 1 print "hc2bc"}
}
for j=0, 3 {
Gauz3 = rdhc2mc.repick()
//print Gauz3
if (i*2+2+Gauz3 > 14) {npost = i*2+2+Gauz3-15 }
if (i*2+2+Gauz3 < 0) {npost = i*2+2+Gauz3+15}
if ((i*2+2+Gauz3 >-1) && (i*2+2+Gauz3 < 15)) {npost = i*2+2+Gauz3}
//print npost
dbr = rdsynb.repick()
// if ((is_connected(MossyCell[npost], HIPPCell[i]) == 0) && (vhc2mc.x[npost] < 2) && (killMC.contains(ngcell+nbcell+npost) == 0)) { //use if killing MC
if ((is_connected(MossyCell[npost], HIPPCell[i]) == 0) && (vhc2mc.x[npost] < 2)) {
nc_append(i+ngcell+nbcell+nmcell, npost+ngcell+nbcell, dbr+13, 1.5e-3, 1, 10) // Gcell[3] to Bcell[1]
print npost, dbr+13
vhc2mc.x[npost] += 1
} else { j -= 1 print "hc2mc"}
// if (killMC.contains(ngcell+nbcell+npost) == 1){ j += 1 print "dead MC"} //use if killing MC
}
}
}
//*********************************Print out Net cons*********************************************************
strdef strvar
objref dfile
dfile = new File()
proc saveNet(){ local i
dfile.wopen("DGNC.txt")
dfile.printf("Precell \tpstcell \t Synapse \n")
for i=0, nclist.count-1 {
dfile.printf("%s\t%s\t%s\n", nclist.object[i].precell, nclist.object[i].postcell, nclist.object[i].syn)}
dfile.printf("TO BC\n GC \tBC \tMC \tHC \n")
for i= 0, nbcell-1 {dfile.printf("%d\t%d\t%d\t%d \n", vgc2bc.x[i], vbc2bc.x[i], vmc2bc.x[i], vhc2bc.x[i])}
dfile.printf("TO MC\n GC \tBC \tMC \tHC \n")
for i= 0, nmcell-1 {dfile.printf("%d\t%d\t%d\t%d\n", vgc2mc.x[i], vbc2mc.x[i], vmc2mc.x[i], vhc2mc.x[i])}
dfile.printf("TO HC \n GC\t MC\n")
for i= 0, nhcell-1 {dfile.printf("%d\t%d\n", vgc2hc.x[i], vmc2hc.x[i])}
dfile.printf("TO GC\n BC\t MC\t HC\t GC\n")
for i= 0, ngcell-1 {dfile.printf("%d\t%d\t%d\t%d\n", vbc2gc.x[i], vmc2gc.x[i], vhc2gc.x[i], vgc2gc.x[i])}
dfile.close()
}
//******* output memb voltage traces of every 10th GC and all other cells to file **********************************************
strdef strmat
objref efile
efile = new File()
efile.wopen("DGVt.txt")
efile.printf("t\t")
for i = 0, 49 {
b = i*10
efile.printf("%s\t", cells.object[b])}
for i = 498, cells.count-2{
efile.printf("%s\t", cells.object[i])}
efile.printf("\n")
efile.close("DGVt.txt")
proc sMatrix(){ local j
efile.aopen("DGVt.txt")
efile.printf("%f\t", t)
for i = 0, 49 {
b = i*10
efile.printf("%f\t", cells.object[b].soma.v(0.5))}
for j =498, cells.count-2 {
efile.printf("%f\t", cells.object[j].soma.v(0.5))}
efile.printf("\n")
efile.close("DGVt.txt")
}
objref VmT
objref VmMat[cells.count-1]
VmT = new Vector()
for i=0, cells.count-2 {
VmMat[i] = new Vector()
}
proc VecMx() { local i
VmT.append(t)
for i=0, cells.count-2 {
VmMat[i].append( cells.object[i].soma.v(0.5))
}
}
//Generate spike matrix and save to file
objref Spike[cells.count-1]
for i=0, cells.count-2 {
Spike[i] = new Vector()
}
strdef Spkstr
objref dfile
dfile = new File()
proc SpkMx() { local i, j
for i=0, cells.count-2 {
Spike[i].spikebin(VmMat[i], 0)
}
dfile.wopen("DGSp.txt")
while(k < VmT.size) {
for j = 0, cells.count-2 {
if(Spike[j].x[k] != 0) {
dfile.printf("%f\t%d\n", VmT.x[k], j)}
}
k +=1 }
dfile.close("DGSp.txt")
}
objref r_plt
proc initrPlt() {
r_plt = new Graph(0)
r_plt.size(0, tstop,0, cells.count)
r_plt.label(0.95, 0.02, "ms")
r_plt.label(0.01, 0.82, "neu")
r_plt.view(0,0, tstop, cells.count,320,20,300,230)
}
initrPlt()
//Plot spike raster
proc plotAP() { local i, a
a=1
r_plt.erase()
while(j < cells.count-2) {
for i = 0, VmT.size-1 {
if ((j > ngcell-1)&&(j < ngcell+nbcell-1)) { a=2}
if ((j > ngcell+nbcell-1)&&(j < ngcell+nbcell+nmcell-1)) { a=3}
if (j > ngcell+nbcell+nmcell-1) { a=4}
if (Spike[j].x[i] == 1) {
r_plt.mark(VmT.x[i], j, "T", 5, a, 1)}}
j+=1}
r_plt.flush()
}
//################################################################################################
proc init() { local dtsav, temp, secsav
finitialize(v_init)
t = -1000 // negative t step to initialize to steady state
dtsav = dt
secondorder =0
dt= 10
// if cvode is on, turn it off to do large fixed step
temp= cvode.active()
if (temp!=0) {cvode.active(0)}
while(t<-100) { fadvance() print t}
//restore cvode if reqd
if (temp!=0) {cvode.active(1)}
dt = dtsav
secondorder =2
t = 0
if (cvode.active()){
cvode.re_init()
}else{
fcurrent()
}
//frecord_init()
}
proc continuerun() {local rt
eventcount =0
eventslow =1
stoprun =0
if (using_cvode_) {
cvode.event($1)
}
while(t < $1 && stoprun == 0) {
step()
sMatrix()
VecMx()
rt = stopsw()
if (rt > realtime) {
realtime = rt
if (!stdrun_quiet) fastflushPlot()
doNotify()
if (realtime == 2 && eventcount > 50) {
eventslow = int(eventcount/50)+1
}
eventcount = 0
}else{
eventcount = eventcount +1
if ((eventcount%eventslow) == 0) {
doEvents()
}
}
}
flushPlot()
}
objectvar save_window_, rvp_
objectvar scene_vector_[4]
objectvar ocbox_, ocbox_list_, scene_, scene_list_
{ocbox_list_ = new List() scene_list_ = new List()}
{
xpanel("RunControl", 0)
v_init = -60
xvalue("Init","v_init", 1,"stdinit()", 1, 1 )
xbutton("Init & Run","run()")
xbutton("Stop","stoprun=1")
runStopAt = 5
xvalue("Continue til","runStopAt", 1,"{continuerun(runStopAt) stoprun=1}", 1, 1 )
runStopIn = 1
xvalue("Continue for","runStopIn", 1,"{continuerun(t + runStopIn) stoprun=1}", 1, 1 )
xbutton("Single Step","steprun()")
t = 0
xvalue("t","t", 2 )
tstop = 300 //1500
xvalue("Tstop","tstop", 1,"tstop_changed()", 0, 1 )
dt = 0.1
xvalue("dt","dt", 1,"setdt()", 0, 1 )
steps_per_ms = 10 //40
xvalue("Points plotted/ms","steps_per_ms", 1,"setdt()", 0, 1 )
xpanel(544,121)
}
//plot membrane voltage traces
{
save_window_ = new Graph(0)
save_window_.size(0,tstop,-80,40)
scene_vector_[2] = save_window_
{save_window_.view(0, -80, tstop, 120, 290, 470, 579.84, 208)}
graphList[0].append(save_window_)
save_window_.save_name("graphList[0].")
save_window_.addexpr("Gcell[0].soma.v(0.5)",1,1)
save_window_.addexpr("Bcell[0].soma.v(0.5)",2,1)
save_window_.addexpr("Bcell[1].soma.v(0.5)",5,1)
save_window_.addexpr("Mcell[0].soma.v(0.5)",3,1)
save_window_.addexpr("Hcell[0].soma.v(0.5)",4,1)
}
proc rrun(){
initNet()
saveNet()
run()
SpkMx()
}
rrun()
plotAP()
objectvar scene_vector_[1]
{doNotify()}
//quit()