-
Notifications
You must be signed in to change notification settings - Fork 0
/
noisy_OB_PC_network_2CG_modified.m~
2671 lines (2213 loc) · 95.7 KB
/
noisy_OB_PC_network_2CG_modified.m~
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
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
function [Mitral GraProximal GraDistal Feedforward Pyramidal Feedback OSNsource param InputCurrent] = noisy_OB_PC_network_2CG(inputFile,Delay,Wfrac)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This is an adaption of two programs, bulbmain.m and piriformmain.m,
% originally developed by Licurgo de Almeida.
%
% description of the original model can be found in....
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% INPUTS:
% inputfile - txt file with parameters
% Delay - [LOTdelay OPdelay MitGABAdelay GraAMPAdelay GraGABAdelay PyrGABAdelay PyrAMPAdelay IntAMPAdelay]
% in ms
% Wfrac - a vector of length ntimepoints specifying how weights
% increase over time.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% OUTPUTS:
% Mitral, GraProximal, GraDistal, Feedforward, Pyramidal,
% Feedback - data structures including parameters and simulated neuronal activity
% OSNsource - odor matrix (simulates odor by stimulating subset of OSN)
% param - model parameters
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Starting program
tic;
if strcmpi(inputFile(end - 2:end),'txt') % if we use a txt as input, the
% program reads the txt file and create the variables, if we use a mat file,
% the program loads the variables.
% Set new rand seed.
% s = RandStream.create('mt19937ar','seed',sum(100*clock));
% RandStream.setDefaultStream(s);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Reading parameters from input file and creating neurons
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
param.inputFile = 'noisy_OB_PC_params_2CG.txt';
% Open the input file for reading
fid1 = fopen(param.inputFile,'r');
if fid1 == -1
msgbox('Could not open the input file! Make sure the filname and path are correct.','ERROR');
return;
end
str = fgetl(fid1);
% Get network parameters.
while ~strcmpi(str,'neurons')
switch lower(str)
case '' % It's possible to use blank lines to organize the
% network parameters
otherwise
param = SetNetworkParameters(param,str,Delay,Wfrac);
end
str = fgetl(fid1);
end
% Create cells
OSNfile = strcat(param.outputPath,param.OSNsource);
[param,OSNsource,Mitral,GraProximal,GraDistal,Feedforward,Pyramidal,Feedback] = CreateCells(param,OSNfile);
str = fgetl(fid1);
% Get cell parameters.
while ~strcmpi(str,'end')
switch lower(str)
case '' % It's possible to use blank lines to organize the
% neuronal parameters
case 'mitral'
celltype = 'mitral';
case 'graproximal'
celltype = 'graproximal';
case 'gradistal'
celltype = 'gradistal';
case 'feedforward'
celltype = 'feedforward';
case 'pyramidal'
celltype = 'pyramidal';
case 'feedback'
celltype = 'feedback';
otherwise
switch celltype
case 'mitral'
Mitral = SetNeuronParameters(Mitral,param.nMitral,str);
case 'graproximal'
GraProximal = SetNeuronParameters(GraProximal,param.nGraprox,str);
case 'gradistal'
GraDistal = SetNeuronParameters(GraDistal,param.nGradist,str);
case 'feedforward'
Feedforward = SetNeuronParameters(Feedforward,param.nPyramidal,str);
case 'pyramidal'
Pyramidal = SetNeuronParameters(Pyramidal,param.nPyramidal,str);
case 'feedback'
Feedback = SetNeuronParameters(Feedback,param.nFeedback,str);
end
end
str = fgetl(fid1);
end
fclose(fid1); % Close input file
fname = inputFile(1:end - 3);
fname = strcat(fname,'mat');
save(fname,'Mitral','GraProximal','GraDistal','Feedforward','Pyramidal','Feedback','OSNsource','param');
elseif strcmpi(inputFile(end - 2:end),'mat') %if the input file is .mat
% we have to
load(inputFile,'Mitral','GraProximal','GraDistal','OSNsource','param');
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Neuronal activity
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[Mitral GraProximal GraDistal Feedforward Pyramidal Feedback param InputCurrent] = NeuroActivity(Mitral,GraProximal,GraDistal,Feedforward,Pyramidal,Feedback,param,OSNsource);
toc;
end
function param = SetNetworkParameters(param,str,Delay,Wfrac)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%-----------OB--------------OB----------------OB--------------------------
%
% This function sets the parameters for the different neurons
%
% Modified by Boleszek Osinski on 06/14/2013
%
% Licurgo de Almeida
% 12/20/2010
% Information not related with the parameters of different neuros.
% Path: path where we save input and output file
% dt: timestep (in ms)
% tsim: simulation time (in ms)
% tinit: stimulus begin (in ms)
% tfinal: stimulus end (in ms)
% nMitral: number of mitral cells
% nGradist: number of granule distal synapses
% nGraprox: number of granule cell soma
% GraGracon = if true, granule cells connect to each other
% DistalON = if true graded inhibitory distal Granule dendrites are present
% ProximalON = if true spiking inhibitory proximal Granule soma are present
% BulbH = Bulb height (in distance units)
% BulbW = Bulb width (in distance units)
% NoiseMit = Mitral cell noise std
% NoiseGraprox = Granule proximal dendrite noise std
% NoiseGradist = Granule distal dendrite noise std
% mFactor = multiplicative factor. number of granule cells = number of
% mitral cells * mFactor
% OSNsource = source of the OSN inputs.
% Odorant = odortant number.
% Grasource = source of the granule cells (used only for comparison
% (add the name of new parameters here)
% mitAHP = if true, mitral cells show AHP
% graAHP = if true, granule cells show AHP
% graLLD = if true, granule cells show LLD
% Respiration = if true, the input is modulated by an oscillation
% representing the respiration
% RespFreq = Respiratory frequency
% Iext = external current to OSNs
% Inoise = noise fraction of OSN input
% randfrac = fraction of uniform input to MCs
% SpikeV = Spike voltage
% CChanceGraMit = Chance of connection between Gra and Mit
% CChanceGraGra = Chance of connection between Gra
%
%
%-------------PC-------------PC-------------PC-------------PC-------------
%
%
% Modified by Boleszek Osinski on 06/14/2013
%
% Licurgo de Almeida
% 02/25/2011
% Information not related with the parameters of different neuros.
% * nPyramidal = number of pyramindal cells (and feedforward inhibitory neurons)
% * nFeedback = number of feedback inhibitory cells
% * CChancePyrPyr = Chance of connection between two different Pyramidal
% cells.
% * CChancePyrFba = Chance of connection between Pyramidal and Feedback
% cells.
% * CChanceFbaPyr = Chance of connection between Feedback and Pyramidal
% cells.
% * CChanceFfoPyr = Chance of connection between Feedforward cells and Pyramidal
% cells.
% * NoiseFfo = Feedforward neuron noise std
% * NoisePyr = Pyramidal cell noise std
% * NoiseFba = Feedback cell noise std
% * NoiseParam = true if we want a slighly variation on the parameters
% * Noiselevel = percetage of variation in each parameter
% * pyrAHP = if true, pyrAHP is ON
%
%
%-----------OBPC-----------OBPC-----------OBPC-----------OBPC-------------
%
% Boleszek Osinski 06/14/2013
%
% flagLOT = if true Mi-Pyr connection is in tact
% LOTvar = variability of LOT conduction delay (in ms)
% flagOP = if true then Pyr-Gr connection is in tact
% OPvar = variability of OP conduction delay (in ms)
% flagWLOTvar = if true mit-pyr weights are scaled at each timestep with Wfrac
% flagWOPvar = if true pyr-gra weights are scaled at each timestep with Wfrac
% flagWGRAMITvar = if true gra-mit weights are scaled at each timestep with Wfrac
% flagWMitGravar = if true mit-gra weights are scaled at each timestep with Wfrac
% CChancePyrGra = Chance of connection between Pyramidal and Granule cells
% CChanceMitPyr = Chance of connection between Mitral cells and Pyramidal cells
% CChanceMitFfo = Chance of connection between Mitral cells and Feedforward cells
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
param.Wfrac = Wfrac; % Weight fraction for scaling weights over time
param.Delay = Delay; % Synaptic latencies
str_aux = 1;
% Find parameter name
while str(str_aux) ~= ' '
str_aux = str_aux + 1;
end
ParName = str(1:str_aux - 1); % name of the parameter
ParValue = str(str_aux + 1:end); % value of the parameter
switch lower(ParName)
% OB parameters
case 'path'
param.outputPath = ParValue; %path
case 'dt'
param.dt = str2num(ParValue); %step
case 'tsim'
param.tsim = str2num(ParValue); %simulation time
case 'tinit'
param.tinit = str2num(ParValue); %stimulus begin
case 'tfinal'
param.tfinal = str2num(ParValue); %stimulus end
case 'nmitral'
param.nMitral = str2num(ParValue); %number of Mitral cells
case 'ngradist'
param.nGradist = str2num(ParValue); %number of granule distal synapses
case 'ngraprox'
param.nGraprox = str2num(ParValue); %number of Granule cell soma
case 'gragracon'
param.GraGracon = str2num(ParValue); %Gra-Gra connections
case 'distalon'
param.DistalON = str2num(ParValue); %flag distal gra dendrites
case 'proximalon'
param.ProximalON = str2num(ParValue); %flag proximal gra dendrites
case 'bulbh'
param.BulbH = str2num(ParValue); %Bulb height
case 'bulbw'
param.BulbW = str2num(ParValue); %Bulb width
case 'noisemit'
param.noisemit = str2num(ParValue); %noise Mitral
case 'noisegraprox'
param.noisegraprox = str2num(ParValue); %noise granule prox
case 'noisegradist'
param.noisegradist = str2num(ParValue); %noise granule dist
case 'preset'
param.flagpreset = str2num(ParValue); %flag preset positions
case 'mfactor'
param.mFactor = str2num(ParValue); % multiplicative factor
case 'osnsource'
param.OSNsource = ParValue; %name of the file source for OSN information
case 'odorant'
param.Odorant = str2num(ParValue); %odorant number
case 'grasource'
param.Grasource = ParValue; %name of the file source for granule cells information
case 'mitahp'
param.mitAHP = str2num(ParValue); %flag presence of mitral AHP
case 'graahp'
param.graAHP = str2num(ParValue); %flag presence of granule AHP
case 'gralld'
param.graLLD = str2num(ParValue); %flag presence of granule LLD
case 'respiration'
param.flagRespiration = str2num(ParValue); %flag respiratory modulation
case 'respfreq'
param.RespFreq = str2num(ParValue); %respiratory frequency
case 'iext'
param.Iext = str2num(ParValue); %External current to OSNs
case 'inoise'
param.Inoise = str2num(ParValue); %noise fraction of OSN input
case 'randfrac'
param.randfrac = str2num(ParValue); %fraction of uniform input (scaling input to MCs)
case 'spikev'
param.SpikeV = str2num(ParValue); %Spike voltage
case 'cchancegramit'
param.CChanceGraMit = str2num(ParValue); %chance of connection between Granule and Mitral cells
case 'cchancegragra'
param.CChanceGraGra = str2num(ParValue); %chance of connection between Granule cells
% PC parameters
case 'npyramidal'
param.nPyramidal = str2num(ParValue); %number of Pyramidal cells (and Feedforward)
case 'nfeedback'
param.nFeedback = str2num(ParValue); %number of Feedback cells
case 'cchancepyrpyr'
param.CChancePyrPyr = str2num(ParValue); %chance of connection between two Pyramidal cells
case 'cchancepyrfba'
param.CChancePyrFba = str2num(ParValue); %chance of connection between Pyramidal and Feedback cells
case 'cchancefbapyr'
param.CChanceFbaPyr = str2num(ParValue); %chance of connection between Feedback and Pyramidal cells
case 'cchanceffopyr'
param.CChanceFfoPyr = str2num(ParValue); %chance of connection between Feedforward and Pyramidal cells
case 'ffoneurons'
param.FfoNeurons = str2num(ParValue); %flag distal ffo neurons
case 'noiseffo'
param.noiseffo = str2num(ParValue); %noise Feedforward neurons
case 'noisepyr'
param.noisepyr = str2num(ParValue); %noise Pyramidal cells
case 'noisefba'
param.noisefba = str2num(ParValue); %noise Feedback neurons
case 'noiseparam'
param.NoiseParam = str2num(ParValue); %flag noise on the parameters
case 'noiselevel'
param.NoiseLevel = str2num(ParValue); %noise value
case 'pyrahp'
param.pyrAHP = str2num(ParValue); %flag use of pyrAHP
% OB-PC parameters...
case 'flaglot'
param.flagLOT = str2num(ParValue); %if true Mi-Pyr connections are in tact
case 'lotvar'
param.LOTvar = str2num(ParValue); %variability in LOT conduction delay
case 'flagop'
param.flagOP = str2num(ParValue); %if true Pyr-Gr connections are in tact
case 'opvar'
param.OPvar = str2num(ParValue); %variability in OP conduction delay
case 'flagwlotvar'
param.flagWLOTvar = str2num(ParValue); %if true mit-gra weights scale with time by Wfrac
case 'flagwopvar'
param.flagWOPvar = str2num(ParValue); %if true pyr-gra weights scale with time by Wfrac
case 'flagwgramitvar'
param.flagWGRAMITvar = str2num(ParValue); %if true gramit weights scale with time by Wfrac
case 'flagwmitgravar'
param.flagWMitGravar = str2num(ParValue); %if true mitgra weights scale with time by Wfrac
case 'cchancepyrgra'
param.CChancePyrGra = str2num(ParValue); %chance of connection between Pyramidal and Granule cells
case 'cchancemitpyr'
param.CChanceMitPyr = str2num(ParValue); %chance of connection between Mitral and Pyramidal cells
case 'cchancemitffo'
param.CChanceMitFfo = str2num(ParValue); %chance of connection between Mitral and Feedforward cells
otherwise
disp(['parameter ' ParName ' does not exist']);
end
end
function [param,OSNsource,Mitral,GraProximal,GraDistal,Feedforward,Pyramidal,Feedback] = CreateCells(param,OSNfile)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% This function creates neurons based on the OSN file source (excel file)
%
% Modified by Boleszek Osinski on 06/16/2013 and 08/13/2014
% Licurgo de Almeida
% 12/21/2010
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% input pattern to MCs
aux_inputs = load(OSNfile); %read file with OSN information
% OSNsource.inputs = ones(param.nMitral,1);
OSNsource.inputs = aux_inputs.inputmatrand(param.Odorant,:);
OSNsource.inputs(OSNsource.inputs<param.randfrac) = 1;
% OSNsource.inputs = aux_inputs.inputmat(param.Odorant,:);
%OSNsource.inputs = OSNsource.inputs / max(OSNsource.inputs); %%normalize data
Mitral = cell(param.nMitral,1);
for ii = 1:param.nMitral
Mitral{ii}.input = []; %no input for now
Mitral{ii}.label = 'Mitral';
end
GraProximal = cell(param.nGraprox,1);
GraDistal = cell(param.nGradist,1);
for ii = 1:param.nGraprox
GraProximal{ii}.input = [];
GraProximal{ii}.label = 'GraProximal';
end
for ii = 1:param.nGradist
GraDistal{ii}.input = [];
GraDistal{ii}.label = 'GraDistal';
end
Pyramidal = cell(param.nPyramidal,1);
Feedforward = cell(param.nPyramidal,1);
for ii = 1:param.nPyramidal
Pyramidal{ii}.input = []; %no input for now
Pyramidal{ii}.label = 'Pyramidal';
Feedforward{ii}.input = [];
Feedforward{ii}.label = 'Feedforward'; %the number of pyramidal and
% feedforward cells is always the same
end
Feedback = cell(param.nFeedback,1);
for ii = 1:param.nFeedback
Feedback{ii}.input = []; %no input for now
Feedback{ii}.label = 'Feedback';
end
end
function N = SetNeuronParameters(N,ncells,str)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% This function set the parameters for the different neurons
% Modified by Boleszek Osinski on 06/18/2013
%
%----------OB&PC-------------OB&PC----------OB&PC----------OB&PC----------
%
% OB and PC Neurons can present the following set of parameters:
% * tau = charging time constant of the neuron (ms). ms (not s) is the basic time unit in this program.
% * R = Membrane resistance (in ohms)
% * Fthresh = Average firing threshold (in V)
% * Vrest = resting potential
% * Vhyper = hyperpolarization potential
% * EAMPA = AMPA's Nernst potential.
% * EGABA = GABA's Nernst potential.
% * EAHP = AHP's Nernst potential.
% * ELLD = LLD's Nernst potential.
% * tauAMPA1 = AMPA's rising tau.
% * tauAMPA2 = AMPA's falling tau.
% * tauGABA1 = GABA's rising tau.
% * tauGABA2 = GABA's falling tau.
% * tauAHP = AHP time constant.
% * tauLLD = LLD time constant.
%
%
%-------------OB-------------OB-------------OB-------------OB-------------
%
% Licurgo de Almeida
% 11/02/2010
% OB Neurons can present the following set of parameters:
%
% * gmaxAMPA = AMPA's max conductance
% * gmaxGABA = GABA's max conductance
% * gmaxGABAP = Periglomerula GABA's max conductance (for Mitral cells
% only)
% * gmaxAHP = AHP's max conductance
% * IACh = Addition current when ACh is ON in non-spiking cells.
% * nGracon = number of granule cells connected to mitral or granule cells
% * CellRadius = radius of mitral and granule cells' dendrites
% * tauPROX1 = proximal Pyr-Gra synapse rising tau (Gra cell only)
% * tauPROX2 = proximal Pyr-Gra synapse falling tau (Gra cell only)
% * tauAMPA1 = distal Mit-Gra AMPA receptor rising tau (Gra cell only)
% * tauAMPA2 = distal Mit-Gra AMPA receptor falling tau (Gra cell only)
% * tauNMDA1 = distal Mit-Gra NMDA receptor rising tau (Gra cell only)
% * tauNMDA2 = distal Mit-Gra NMDA receptor falling tau (Gra cell only)
% * tauCA1 = distal Ca spike rising tau (Gra cell only)
% * tauCA2 = distal Ca spike falling (Gra cell only)
% * VCAthresh = distal Ca spike falling (Gra cell only)
% * wAMPAMI = excitatory synaptic weight from Mitral cell to Granule cell AMPA
% * wNMDAMI = excitatory synaptic weight from Mitral cell to Granule cell NMDA
% * wGABAGR = inhibitory synaptic weight from Granule cell to Gra or Mit
% * wAMPAGL = excitatory synaptic weight from Glomerulus cell to Mitral cell
%-------------PC-------------PC-------------PC-------------PC-------------
%
% Licurgo de Almeida
% 02/28/2011
% PC Neurons cah present the following set of parameters:
%
% * wAMPA = excitatory synaptic weight
% * wAMPAPY = excitatory synaptic weight for Pyramidal association fibers
% (for Pyramidal cells only)
% * wGABA = inhibitory synaptic weight
% * wGABAFF = inhibitory synaptic weight from Feedforward cells (for
% Pyramidal cells only)
% * wAHP = AHP synaptic weight used to calculate AHP activation curves.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
str_aux = 1;
% Find parameter name
while str(str_aux) ~= ' '
str_aux = str_aux + 1;
end
ParName = str(1:str_aux - 1); % name of the parameter
ParValue = str(str_aux + 1:end); % value of the parameter
switch lower(ParName)
% OB and PC
case 'tau'
for ii = 1:ncells
N{ii}.tau = str2num(ParValue); %time in ms
end
case 'r'
for ii = 1:ncells
N{ii}.R = str2num(ParValue); %resistance in ohms
end
case 'fthresh'
for ii = 1:ncells
N{ii}.FThresh = str2num(ParValue); %potential in volts
end
case 'vrest'
for ii = 1:ncells
N{ii}.Vrest = str2num(ParValue); %potential in volts
end
case 'vhyper'
for ii = 1:ncells
N{ii}.Vhyper = str2num(ParValue); %potential in volts
end
case 'noise'
for ii = 1:ncells
N{ii}.Noise = str2num(ParValue);
end
case 'eampa'
for ii = 1:ncells
N{ii}.EAMPA = str2num(ParValue); %potential in volts
end
case 'egaba'
for ii = 1:ncells
N{ii}.EGABA = str2num(ParValue); %potential in volts
end
case 'eahp'
for ii = 1:ncells
N{ii}.EAHP = str2num(ParValue); %potential in volts
end
case 'elld'
for ii = 1:ncells
N{ii}.ELLD = str2num(ParValue); %potential in volts
end
case 'tauampa1'
for ii = 1:ncells
N{ii}.tauAMPA1 = str2num(ParValue); %time in ms
end
case 'tauampa2'
for ii = 1:ncells
N{ii}.tauAMPA2 = str2num(ParValue); %time in ms
end
case 'taugaba1'
for ii = 1:ncells
N{ii}.tauGABA1 = str2num(ParValue); %time in ms
end
case 'taugaba2'
for ii = 1:ncells
N{ii}.tauGABA2 = str2num(ParValue); %time in ms
end
case 'tauahp'
for ii = 1:ncells
N{ii}.tauAHP = str2num(ParValue); %time in ms
end
case 'taulld'
for ii = 1:ncells
N{ii}.tauLLD = str2num(ParValue); %time in ms
end
% OB
case 'gmaxampa'
for ii = 1:ncells
N{ii}.gmaxAMPA = str2num(ParValue); %AMPA channel
% conductance in siemens
end
case 'gmaxgaba'
for ii = 1:ncells
N{ii}.gmaxGABA = str2num(ParValue); %GABA channel
% conductance in siemens
end
case 'gmaxahp'
for ii = 1:ncells
N{ii}.gmaxAHP = str2num(ParValue); %"AHP" channel (for the simulation)
% conductance in siemens
end
case 'iach'
for ii = 1:ncells
N{ii}.IACh = str2num(ParValue); %Additional current when ACh is ON
% in non-spiking neurons
end
case 'gmaxgabap'
for ii = 1:ncells
N{ii}.gmaxGABAP = str2num(ParValue); %GABA channel from PG cells
% conductance in siemens
end
case 'ngracon'
for ii = 1:ncells
N{ii}.NGraCon = str2num(ParValue); %number of granule cells
% connected to a mitral or granule cell
end
case 'cellradius'
for ii = 1:ncells
N{ii}.CellRadius = str2num(ParValue); % (in distance units) If
% param.conntype is 'spatial' the user must set the radius of
% mitral and granule cells
end
case 'tauprox1'
for ii = 1:ncells
N{ii}.tauPROX1 = str2num(ParValue); %time in ms
end
case 'tauprox2'
for ii = 1:ncells
N{ii}.tauPROX2 = str2num(ParValue); %time in ms
end
case 'taudist1'
for ii = 1:ncells
N{ii}.tauAMPA1 = str2num(ParValue); %time in ms
end
case 'taudist2'
for ii = 1:ncells
N{ii}.tauAMPA2 = str2num(ParValue); %time in ms
end
case 'taunmda1'
for ii = 1:ncells
N{ii}.tauNMDA1 = str2num(ParValue); %time in ms
end
case 'taunmda2'
for ii = 1:ncells
N{ii}.tauNMDA2 = str2num(ParValue); %time in ms
end
case 'tauca1'
for ii = 1:ncells
N{ii}.tauCA1 = str2num(ParValue); %time in ms
end
case 'tauca2'
for ii = 1:ncells
N{ii}.tauCA2 = str2num(ParValue); %time in ms
end
case 'vcathresh'
for ii = 1:ncells
N{ii}.VCAthresh = str2num(ParValue); %Ca spike threshold in V
end
case 'wampami'
for ii = 1:ncells
N{ii}.wAMPAMI = str2num(ParValue); % excitatory synaptic weight from Mitral to Granule AMPA
end
case 'wnmdami'
for ii = 1:ncells
N{ii}.wNMDAMI = str2num(ParValue); % excitatory synaptic weight from Mitral to Granule NMDA
end
case 'wgabagr'
for ii = 1:ncells
N{ii}.wGABAGR = str2num(ParValue); % inhibitory synaptic weight from Granule to Gra or Mit
end
case 'wampagl'
for ii = 1:ncells
N{ii}.wAMPAGL = str2num(ParValue); % excitatory synaptic weight from Glom to Mit
end
% PC
case 'wampa'
for ii = 1:ncells
N{ii}.wAMPA = str2num(ParValue); % excitatory synaptic weight
end
case 'wampapy'
for ii = 1:ncells
N{ii}.wAMPAPY = str2num(ParValue); % excitatory synaptic weight
% from associative connections (pyramidal cells only)
end
case 'wgaba'
for ii = 1:ncells
N{ii}.wGABA = str2num(ParValue); % inhibitory synaptic weight
end
case 'wgabaff'
for ii = 1:ncells
N{ii}.wGABAFF = str2num(ParValue); % inhibitory synaptic weight
% from feedforward cells (pyramidal cells only)
end
case 'wahp'
for ii = 1:ncells
N{ii}.wAHP = str2num(ParValue); % AHP amplitude
end
% New parameters must be added here...
otherwise
disp(['parameter ' ParName ' does not exist']);
end
end
function Cell = SetCellPosition(Cell,param)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% This function set the position on different neurons when no preset is
% presented.
% The main function of this program is neurogenesismain.m
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ncells = length(Cell);
auxposy = param.BulbH / floor(sqrt(ncells));
if sqrt(ncells) == floor(sqrt(ncells))
auxposx = param.BulbW / sqrt(ncells);
else
auxposx = param.BulbW / (sqrt(ncells) + 1);
end
countcell = 0;
x = 0;
y = 0;
while countcell < ncells
countcell = countcell + 1;
if y >= param.BulbH
y = 0;
x = x + auxposx;
end
Cell{countcell}.X = mean([x,(x + auxposx)]);
Cell{countcell}.Y = mean([y,(y + auxposy)]);
y = y + auxposy;
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% MAIN FUNCTION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [Mitral GraProximal GraDistal Feedforward Pyramidal Feedback param InputCurrent] = NeuroActivity(Mitral,GraProximal,GraDistal,Feedforward,Pyramidal,Feedback,param,OSNsource)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% This function creates the neuronal activity
%
% Licurgo de Almeida
% 11/03/2010
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create initial setup -- OB
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if param.flagRespiration == true
Respiration = CreateRespFreq(param);
else
Respiration = ones(1,round(param.tsim / param.dt));
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Set connections
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% OB %%%%%
nds = param.nGradist/param.nGraprox; % number of distal spines per granule cell
% random connectivity
MatGradistMit = SetConnections(param.nMitral,param.nGradist,param.CChanceGraMit);
MatMitGradist = MatGradistMit'; % reciprocal synapses
MatProxProx = SetConnections(param.nGraprox,param.nGraprox,param.CChanceGraGra);
% There are nds distal synapses to each granule cell soma. Note: nGradist must = nds*nGraprox
% (this is hard coded)
MatProxDist = zeros(param.nGradist,param.nGraprox);
for ii = 1:param.nGraprox
MatProxDist((nds*(ii-1)+1):nds*ii,ii) = 1;
end
%%%%% PC %%%%%
MatPyrFba = SetConnections(param.nFeedback,param.nPyramidal,param.CChancePyrFba);
MatFbaPyr = SetConnections(param.nPyramidal,param.nFeedback,param.CChanceFbaPyr);
MatFfoPyr = SetConnections(param.nPyramidal,param.nPyramidal,param.CChanceFfoPyr);
MatPyrPyr = SetConnections(param.nPyramidal,param.nPyramidal,param.CChancePyrPyr);
%%%%% OB-PC %%%%%
MatPyrGraprox = SetConnections(param.nGraprox,param.nPyramidal,param.CChancePyrGra);
MatMitPyr = SetConnections(param.nPyramidal,param.nMitral,param.CChanceMitPyr);
MatMitFfo = SetConnections(param.nPyramidal,param.nMitral,param.CChanceMitFfo);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Set weights matrix -- PC
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% OB %%%%%
wGloMit = eye(param.nMitral)*Mitral{1}.wAMPAGL;
wPglMit = wGloMit;
wGABAMit = zeros(param.nMitral,1);
for ii = 1:param.nMitral
wGABAMit(ii) = Mitral{ii}.wGABAGR;
end
wGradistMit = SetWeights(MatGradistMit,wGABAMit,param);
wAMPAGradist = zeros(param.nGradist,1);
wNMDAGradist = zeros(param.nGradist,1);
wGABAGraProx = zeros(param.nGraprox,1);
for ii = 1:param.nGradist
wAMPAGradist(ii) = GraDistal{ii}.wAMPAMI;
wNMDAGradist(ii) = GraDistal{ii}.wNMDAMI;
end
for ii = 1:param.nGraprox
wGABAGraProx(ii) = GraProximal{ii}.wGABAGR;
end
wMitGradistAMPA = SetWeights(MatMitGradist,wAMPAGradist,param);
wMitGradistNMDA = SetWeights(MatMitGradist,wNMDAGradist,param);
wProxProx = SetWeights(MatProxProx,wGABAGraProx,param);
%%%%% PC %%%%%
wGABAPyr = zeros(param.nPyramidal,1);
wAMPAPYPyr = wGABAPyr;
wGABAFFPyr = wGABAPyr;
for ii = 1:param.nPyramidal
wGABAPyr(ii) = Pyramidal{ii}.wGABA;
wAMPAPYPyr(ii) = Pyramidal{ii}.wAMPAPY;
wGABAFFPyr(ii) = Pyramidal{ii}.wGABAFF;
end
wFbaPyr = SetWeights(MatFbaPyr,wGABAPyr,param);
wPyrPyr = SetWeights(MatPyrPyr,wAMPAPYPyr,param);
wFfoPyr = SetWeights(MatFfoPyr,wGABAFFPyr,param);
wAMPAFba = zeros(param.nFeedback,1);
for ii = 1:param.nFeedback
wAMPAFba(ii) = Feedback{ii}.wAMPA;
end
wPyrFba = SetWeights(MatPyrFba,wAMPAFba,param);
%%%%% OB-PC %%%%%
wAMPAPyr = zeros(param.nPyramidal,1);
wAMPAFfo = wAMPAPyr;
for ii = 1:param.nPyramidal
wAMPAPyr(ii) = Pyramidal{ii}.wAMPA;
wAMPAFfo(ii) = Feedforward{ii}.wAMPA;
end
wMitPyr = SetWeights(MatMitPyr,wAMPAPyr,param);
wMitFfo = SetWeights(MatMitFfo,wAMPAFfo,param);
wAMPAGraprox = zeros(param.nGraprox,1);
for ii = 1:param.nGraprox
wAMPAGraprox(ii) = GraProximal{ii}.wAMPAPY;
end
wPyrGraprox = SetWeights(MatPyrGraprox,wAMPAGraprox,param);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Set OSN parameters and variables
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% OSN external input
% Iextosn = SetExtInput(param,OSN);
Iextosn = zeros(param.nMitral,round(param.tsim / param.dt));
for ii = 1:param.nMitral
Iextosn(ii,round(param.tinit / param.dt) : round(param.tfinal / param.dt)) = param.Iext * OSNsource.inputs(ii);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Set Mitral cells parameters and variables
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Stores the voltage of each Mitral cell at a given time
Vmit = zeros(param.nMitral,round(param.tsim / param.dt));
% Binary matrix recording only the spikes
Smit = Vmit;
VAHPmit = Vmit;
refracmit = 3; % Refractory period after firing (ms)
Restmit = zeros(param.nMitral,1); % resting potential
Threshmit = Restmit; % current firing threshold
Hypermit = Restmit; % hyperpolarization potential
Rmit = Restmit; % membrane resistance
taumit = Restmit; % tau neuron
countrefracmit = Restmit; % Refractory period counter. This is assumed to
% be the same for all Mitral cells so we don't need to add it to the for
% below.
gmaxAMPAmit = Restmit; % Max AMPA conductance
tauAMPA1mit = Restmit; % AMPA's rising tau.
tauAMPA2mit = Restmit; % AMPA's falling tau.
EAMPAmit = Restmit; % AMPA's Nernst potential.
gmaxGABAmit = Restmit; % Max GABA conductance
tauGABA1mit = Restmit; % GABA's rising tau.
tauGABA2mit = Restmit; % GABA's falling tau.
EGABAmit = Restmit; % GABA's Nernst potential.
if param.mitAHP == true
gmaxAHPmit = Restmit; % Max AHP conductance
tauAHPmit = Restmit; % AHP tau.
EAHPmit = Restmit; % AHP's Nernst potential.
end
% ...New parameters should be added here and inside the 'for'...
for ii = 1:param.nMitral
Restmit(ii) = Mitral{ii}.Vrest;
Hypermit(ii) = Mitral{ii}.Vhyper;
Rmit(ii) = Mitral{ii}.R;
taumit(ii) = Mitral{ii}.tau;
gmaxAMPAmit(ii) = Mitral{ii}.gmaxAMPA;
tauAMPA1mit(ii) = Mitral{ii}.tauAMPA1;
tauAMPA2mit(ii) = Mitral{ii}.tauAMPA2;
EAMPAmit(ii) = Mitral{ii}.EAMPA;
gmaxGABAmit(ii) = Mitral{ii}.gmaxGABA;
tauGABA1mit(ii) = Mitral{ii}.tauGABA1;
tauGABA2mit(ii) = Mitral{ii}.tauGABA2;
EGABAmit(ii) = Mitral{ii}.EGABA;
if param.mitAHP == true
gmaxAHPmit(ii) = Mitral{ii}.gmaxAHP;
tauAHPmit(ii) = Mitral{ii}.tauAHP;
EAHPmit(ii) = Mitral{ii}.EAHP;
end
Threshmit(ii) = Mitral{ii}.FThresh;
Mitral{ii}.Connections = MatGradistMit(ii,:);
Mitral{ii}.ConWeights = wGradistMit(ii,:);
end
% Initialize Mitral cells potentials
Vmit(:,1) = Restmit;
Vmit_nospike = Vmit;
% AMPA time counter. This variable starts with a very negative value just
% to make sure that the currents will be = 0
tAMPA0mit = zeros(param.nMitral,1) - 10000000;
Iglomit = zeros(param.nMitral,1); % Input coming from Glo
Iglomit_matrix = zeros(param.nMitral,round(param.tsim / param.dt));
maxgAMPAmit = getmaxg(param.dt,tauAMPA1mit,tauAMPA2mit); % Get max conductance
% amplitude
% GABA time counter. This variable starts with a very negative value just
% to make sure that the currents will be = 0. Each Mitral cell can be
% connected to a varied number of granule cells
tGABA0mit = zeros(param.nGradist,round(param.tsim / param.dt)) - 10000000; %NOTE!!! for 2CG model tGABA0mit exists for each dendrite!
Igradistmit = zeros(param.nMitral,1); % Input coming from Granule cells
Igradistmit_matrix = zeros(param.nMitral,round(param.tsim / param.dt));
% only used when distal gra dendrites are removed
Igraproxmit = zeros(param.nMitral,1); % Input coming from Granule cells
Igraproxmit_matrix = zeros(param.nMitral,round(param.tsim / param.dt));
maxgGABAmit = getmaxg(param.dt,tauGABA1mit,tauGABA2mit); % Get max conductance
% amplitude
% AHP time counter. This variable starts with a very negative value just
% to make sure that the currents will be = 0.
if param.mitAHP == true
tAHP0mit = zeros(param.nMitral,1) - 10000000;
% maxgAHPmit = getmaxg(param.dt,tauAHP1mit,tauAHP2mit); % Get max conductance
% not using the rising and falling taus for AHP current
end