/
m3ha_plot_figure08.m
executable file
·2110 lines (1720 loc) · 78.7 KB
/
m3ha_plot_figure08.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
% m3ha_plot_figure08.m
%% Plots Figure 08 and Figure 09 for the GAT Blocker paper
%
% Requires:
% cd/addvars_custom.m
% cd/all_files.m
% cd/all_subdirs.m
% cd/apply_iteratively.m
% cd/apply_over_cells.m
% cd/archive_dependent_scripts.m
% cd/argfun.m
% cd/array_fun.m
% cd/compute_combined_trace.m
% cd/compute_weighted_average.m
% cd/convert_to_char.m
% cd/convert_units.m
% cd/create_labels_from_numbers.m
% cd/create_label_from_sequence.m
% cd/create_subplots.m
% cd/decide_on_colormap.m
% cd/extract_common_directory.m
% cd/extract_common_prefix.m
% cd/extract_fileparts.m
% cd/extract_substrings.m
% cd/extract_subvectors.m
% cd/extractFrom.m
% cd/find_matching_files.m
% cd/force_column_cell.m
% cd/force_matrix.m
% cd/is_var_in_table.m
% cd/ismatch.m
% cd/ismember_custom.m
% cd/lower_first_char.m
% cd/m3ha_decide_on_ylimits.m
% cd/m3ha_extract_candidate_label.m
% cd/m3ha_extract_cell_name.m
% cd/m3ha_network_analyze_spikes.m
% cd/m3ha_network_plot_gabab.m
% cd/m3ha_network_plot_essential.m
% cd/m3ha_plot_grouped_scatter.m
% cd/m3ha_plot_violin.m
% cd/plot_grouped_jitter.m
% cd/plot_scale_bar.m
% cd/plot_tuning_curve.m
% cd/plot_violin.m
% cd/save_all_figtypes.m
% cd/set_figure_properties.m
% cd/sscanf_full.m
% cd/test_difference.m
% cd/unique_custom.m
% cd/update_figure_for_corel.m
% File History:
% 2020-01-30 Modified from m3ha_plot_figure05.m
% 2020-02-06 Added plot200CellExamples and plot2CellM2h
% 2020-03-10 Updated pharm labels
% 2020-04-09 Added combineActivationProfiles
% 2020-04-28 Added timeToStabilize
% 2020-07-27 Added bicuculineRT plots
% 2020-08-04 Renamed Figure08 -> Figure09, Figure07 -> Figure08
%% Hard-coded parameters
% Flags
plotIpscComparison = false; %true;
plot2CellEssential = false; %true;
plot2CellM2h = false; %true;
plotIpscComparisonBicRT = false; %true;
plot2CellEssentialBicRT = false; %true;
plot2CellM2hBicRT = false; %true;
analyze2CellSpikes = false; %true;
plotAnalysis2Cell = false; %true;
backupPrevious2Cell = false; %true;
combine2CellPop = false; %true;
plot2CellViolins = false; %true;
plot2CellScatters = false; %true;
plot2CellTwoGroups = false; %true;
analyze2CellSpikesBicRT = false; %true;
plotAnalysis2CellBicRT = false; %true;
backupPrevious2CellBicRT = false; %true;
combine2CellPopBicRT = false; %true;
plot2CellViolinsBicRT = false; %true;
plot200CellExamples = false; %true;
plotHeteroExamples = false; %true;
plot200CellExamplesBicRT = false; %true;
plotHeteroExamplesBicRT = false; %true;
analyze200CellSpikes = false; %true;
plotAnalysis200Cell = false; %true;
backupPrevious200Cell = false; %true;
combine200CellPop = false; %true;
plot200CellViolins = false; %true;
analyze200CellSpikesBicRT = false; %true;
plotAnalysis200CellBicRT = false; %true;
backupPrevious200CellBicRT = false; %true;
combine200CellPopBicRT = false; %true;
plot200CellViolinsBicRT = false; %true;
analyzeHeteroSpikes = false; %true;
plotAnalysisHetero = false; %true;
backupPreviousHetero = false; %true;
combineHeteroPop = false; %true;
plotHeteroViolins = false; %true;
analyzeHeteroSpikesBicRT = false; %true;
plotAnalysisHeteroBicRT = false; %true;
backupPreviousHeteroBicRT = false; %true;
combineHeteroPopBicRT = false; %true;
plotHeteroViolinsBicRT = false; %true;
plot200CellGroupByCellJitters = false; %true;
plotHeteroGroupByCellJitters = false; %true;
combineActivationProfiles = false; %true;
combineEach200CellNetwork = false; %true;
plot200CellGroupByEpasJitters = false; %true;
plot200CellCumDist = false; %true;
archiveScriptsFlag = true;
% Directories
parentDirectory = fullfile('/media', 'adamX', 'm3ha');
figure08Dir = fullfile(parentDirectory, 'manuscript', 'figures', 'Figure08');
figure09Dir = fullfile(parentDirectory, 'manuscript', 'figures', 'Figure09');
figureRebuttal2Dir = ...
fullfile(parentDirectory, 'manuscript', 'figures', 'FigureRebuttal2');
figureRebuttal3Dir = ...
fullfile(parentDirectory, 'manuscript', 'figures', 'FigureRebuttal3');
networkDir = fullfile(parentDirectory, 'network_model');
% exampleIterName2Cell = '20200131T1345_using_bestparams_20200126_singleneuronfitting101'; % 20200131
% exampleIterName2Cell = '20200205T1353_using_bestparams_20200203_manual_singleneuronfitting0-102_2cell_examples';
% popIterName2Cell = '20200204T1042_using_bestparams_20200203_manual_singleneuronfitting0-102_vtraub_-65_2cell_spikes';
% exampleIterName200Cell = '20200204T1239_using_bestparams_20200203_manual_singleneuronfitting0-102_200cell_spikes';
% popIterName200Cell = exampleIterName200Cell;
% rankNumsToUse = [2, 4, 5, 7, 9, 10, 12, 13, 16, 20, 21, 23, 25, 29];
% popIterName2Cell = '20200208T1230_using_bestparams_20200203_manual_singleneuronfitting0-102_2cell_spikes';
% popIterName2Cell = '20200305T2334_using_bestparams_20200203_manual_singleneuronfitting0-102_2cell_REgpas_varied';
% popIterName2Cell = '20200306T1724_using_bestparams_20200203_manual_singleneuronfitting0-102_2cell_gpas_varied';
% popIterName2Cell = '20200308T2306_using_bestparams_20200203_manual_singleneuronfitting0-102_2cell_TCepas_varied';
% popIterName200Cell = exampleIterName200Cell;
% popIterName200Cell = '20200309T1346_using_bestparams_20200203_manual_singleneuronfitting0-102_200cell_TCepas_varied';
% popIterName2Cell = '20200309T0013_using_bestparams_20200203_manual_singleneuronfitting0-102_2cell_TCepas_varied';
% popIterName2Cell = '20200311T2144_using_bestparams_20200203_manual_singleneuronfitting0-102_2cell_TCepas_varied';
% popIterName200Cell = '20200312T0130_using_bestparams_20200203_manual_singleneuronfitting0-102_200cell_TCepas_varied';
% exampleIterName200Cell = '20200208T1429_using_bestparams_20200203_manual_singleneuronfitting0-102_200cell_spikes';
% exampleSeedDirName200Cell = 'seedNumber_5'; % Use seed number 5 (TCepas = -70)
% exampleIterName2Cell = '20200207T1554_using_bestparams_20200203_manual_singleneuronfitting0-102_REena88_TCena88_2cell_examples';
% popIterName2Cell = '20200418_using_bestparams_20200203_manual_singleneuronfitting0-102';
% popIterName200Cell = '20200408_using_bestparams_20200203_manual_singleneuronfitting0-102';
% exampleIterName200Cell = '20200408_using_bestparams_20200203_manual_singleneuronfitting0-102';
% exampleSeedDirName200Cell = 'seedNumber_21'; % Use seed number 21 (TCepas = -70)
% popIterName200Cell = '20200503_using_bestparams_20200203_manual_singleneuronfitting0-102_200cell_spikes';
% popIterNameHetero = '20200504_using_bestparams_20200203_manual_singleneuronfitting0-102_hetero_spikes';
% exampleIterName2CellBicRT = '20200724_using_bestparams_20200203_manual_singleneuronfitting0-102_2cell_examples_bicucullineRT';
% popIterName2Cell = '20200731_using_bestparams_20200203_manual_singleneuronfitting0-102_2cell_spikesAndM2h';
% popIterName2Cell = '20200802_using_bestparams_20200203_manual_singleneuronfitting0-102_2cell_spikesAndM2h';
exampleIterName2Cell = '20200501_using_bestparams_20200203_manual_singleneuronfitting0-102_2cell_examples';
exampleIterName2CellBicRT = '20200803_using_bestparams_20200203_manual_singleneuronfitting0-102_2cell_examples_bicucullineRT';
exampleSeedDirName2Cell = 'seedNumber_5'; % Use seed number 5 (TCepas = -70)
popIterName2Cell = '20200430_using_bestparams_20200203_manual_singleneuronfitting0-102_2cell_spikes';
popIterName2CellBicRT = '20200724_using_bestparams_20200203_manual_singleneuronfitting0-102_2cell_spikes_bicucullineRT';
exampleIterName200Cell = '20200503_using_bestparams_20200203_manual_singleneuronfitting0-102_200cell_spikes';
exampleIterName200CellBicRT = '20200726_using_bestparams_20200203_manual_singleneuronfitting0-102_200cell_spikes_bicucullineRT';
exampleIterNameHetero = '20200504_using_bestparams_20200203_manual_singleneuronfitting0-102_hetero_spikes';
exampleIterNameHeteroBicRT = '20200725_using_bestparams_20200203_manual_singleneuronfitting0-102_hetero_spikes_bicucullineRT';
exampleSeedDirName200Cell = 'seedNumber_5'; % Use seed number 5 (TCepas = -70)
popIterName200Cell = '20200516_using_bestparams_20200203_manual_singleneuronfitting0-102_200cell_spikes';
popIterName200CellBicRT = '20200726_using_bestparams_20200203_manual_singleneuronfitting0-102_200cell_spikes_bicucullineRT';
popIterNameHetero = '20200516_using_bestparams_20200203_manual_singleneuronfitting0-102_hetero_spikes';
popIterNameHeteroBicRT = '20200725_using_bestparams_20200203_manual_singleneuronfitting0-102_hetero_spikes_bicucullineRT';
candCellSheetName = 'candidate_cells.csv';
oscParamsSuffix = 'oscillation_params';
% % Stable baseline for the range epas = -62 to -60 (30 networks)
% rankNumsToUse = [1:29, 31];
% epasToUse = -62:-60;
% % Stable baseline for the range epas = -70 to -60 (29 networks)
% rankNumsToUse = [1:19, 21:29, 31];
% epasToUse = -70:-60;
% % Stable baseline for the range epas = -72 to -60 (28 networks)
% rankNumsToUse = [1:11, 13:19, 21:29, 31];
% epasToUse = -72:-60;
% % Stable baseline for the range epas = -73 to -60 (25 networks)
% rankNumsToUse = [2:11, 13:19, 21:24, 26:29];
% epasToUse = -73:-60;
% Stable baseline for the range epas = -74 to -60 (24 networks)
rankNumsToUse = [2:3, 5:11, 13:19, 21:24, 26:29];
% epasToUse = -74:-60;
% % Stable baseline for the range epas = -75 to -60 (19 networks)
% rankNumsToUse = [2:3, 5:7, 9:11, 13, 15:18, 21:24, 26, 28];
% epasToUse = -75:-60;
epasToUse = -73:-60;
% Files
% Analysis settings
% Should be consistent with m3ha_plot_figure03.m & m3ha_plot_figure08.m
exampleCellNames2Cell = {'D101310'; 'G101310'};
% exampleCellNames200Cell = {'D101310'; 'G101310'; 'hetero4'; 'hetero8'; 'hetero12'};
% exampleCellNames200Cell = {'D101310'; 'hetero12'};
exampleCellNames200Cell = {'D101310'};
exampleCellNamesHetero = {'hetero24seed9'};
gIncr = 200; % Original dynamic clamp gIncr value
pharmConditions = (1:4)'; % Pharmacological conditions
% 1 - Control
% 2 - GAT 1 Block
% 3 - GAT 3 Block
% 4 - Dual Block
measuresOfInterest = {'oscillationProbability'; 'meanOscPeriod2Ms'; ...
'meanOscIndex4'; 'meanPercentActiveTC'; ...
'meanHalfActiveLatencyMsTC'; 'meanPercentActive'; ...
'meanOscDurationSec'; ...
'meanMaxLogOpenProbabilityDiscrepancy'; ...
'meanPassedOpdThreshold'};
% measuresOfInterest = {'oscillationProbability'; 'passedOpdThreshold'};
measureTitles = {'Oscillation Probability'; 'Oscillation Period (ms)'; ...
'Oscillatory Index'; 'Active TC Cells (%)'; ...
'Half Activation Time (ms)'; 'Active Cells (%)'; ...
'Oscillation Duration (sec)'; ...
'Maximum Log Open Probability Discrepancy'; ...
'Passed Open Probability Discrepancy Threshold'};
% measureTitles = {'Oscillation Probability'; ...
% 'Passed Open Probability Discrepancy Threshold'};
measuresOfInterestJitter = {'oscPeriod2Ms'; ...
'oscIndex4'; 'percentActiveTC'; ...
'halfActiveLatencyMsTC'; 'percentActive'; ...
'oscDurationSec'};
measureTitlesJitter = measureTitles(2:end);
measuresToPlot = replace(measuresOfInterest, 'Ms', 'Sec');
measuresToPlotJitter = replace(measuresOfInterestJitter, 'Ms', 'Sec');
% The following must be consistent with m3ha_net.hoc
timeToStabilize = 2000; % padded time (ms) to make sure initial value
% of simulations are stabilized
% Plot settings
ipscFigWidth = 8.5;
ipscFigHeight = 6;
xLimits2CellGabab = timeToStabilize + [800, 2800];
xLimits2CellEssential = timeToStabilize + [800, 3100];
yLimitsGabab = [-1, 15];
% yLimitsEssential = {[], [], [], [], [], [], []};
yLimitsEssential = {[-100, 100], [-100, 100], [0, 13], [-15, 5], ...
[1e-10, 1], [1e-10, 1], [1e-8, 1e0]};
yTicksEssential = {[-75, 75], [-75, 75], [0, 5, 10], [-10, -5, 0], ...
[1e-8, 1e-2], [1e-8, 1e-2], [1e-6, 1e-2]};
yLimitsEssentialBicRT = {[-100, 100], [-100, 100], [0, 13], [-15, 5], ...
[1e-10, 1], [1e-10, 1], [1e-8, 1e0], [0, 26]};
yTicksEssentialBicRT = {[-75, 75], [-75, 75], [0, 5, 10], [-10, -5, 0], ...
[1e-8, 1e-2], [1e-8, 1e-2], [1e-6, 1e-2], [0, 10, 20]};
yLimitsM2h = [1e-10, 1];
yTicksM2h = [1e-8, 1e-2];
essential2CellFigWidth = 9.35;
essential2CellFigHeight = 1 * 7;
essential2CellBicRTFigHeight = 1 * 8;
m2h2CellFigWidth = 8.5;
m2h2CellFigHeight = 1;
example200CellFigWidth = 8.5;
example200CellFigHeight = 3;
pharmLabelsShort = {'{\it s}Con', '{\it s}GAT1', ...
'{\it s}GAT3', '{\it s}Dual'};
openProbFigWidth = 5; % (cm)
openProbFigHeight = 3; % (cm)
% epasToPlot = [];
epasToPlot = [-74; -70; -66; -62];
% Candidate labels
rankNumsToUse2Cell = rankNumsToUse;
rankNumsToUse200Cell = rankNumsToUse;
rankNumsToUseHetero = [];
% candidateLabelsEach200Cell = {'candidateIDs_32'; 'candidateIDs_2,14,32,35'; ...
% 'candidateIDs_2,14,20,29-30,32,35-36'};
candidateLabelsEach200Cell = {};
% candidateLabels200CellEcdfs = {'candidateIDs_2,14,32,35'; 'candidateIDs_2'; ...
% 'candidateIDs_14'; 'candidateIDs_32'; 'candidateIDs_35'};
% candidateLabels200CellEcdfs = {'candidateIDs_2,14,20,29-30,32,35-36'; ...
% 'candidateIDs_2'; 'candidateIDs_14'; 'candidateIDs_20'; ...
% 'candidateIDs_29'; 'candidateIDs_30'; 'candidateIDs_32'; ...
% 'candidateIDs_35'; 'candidateIDs_36'};
% candidateLabels200CellEcdfs = {'candidateIDs_2,7,11,13-14,20,27,29-30,32,35-36'; ...
% 'candidateIDs_2'; 'candidateIDs_7'; 'candidateIDs_11'; ...
% 'candidateIDs_13'; 'candidateIDs_14'; 'candidateIDs_20'; ...
% 'candidateIDs_27'; 'candidateIDs_29'; 'candidateIDs_30'; ...
% 'candidateIDs_32'; 'candidateIDs_35'; 'candidateIDs_36'};
candidateLabels200CellEcdfs = {};
% candidateLabels200CellActivationProfiles = {'candidateIDs_32'; ...
% 'candidateIDs_2,7,11,13-14,20,27,29-30,32,35-36'};
candidateLabels200CellActivationProfiles = {};
cellNameStr = 'cellName';
epasStr = 'TCepas';
figTypes = {'png', 'epsc'};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Preparation
% Find the directory for this iteration
exampleIterDir2Cell = fullfile(networkDir, exampleIterName2Cell);
exampleIterDir2CellBicRT = fullfile(networkDir, exampleIterName2CellBicRT);
exampleIterDir200Cell = fullfile(networkDir, exampleIterName200Cell);
exampleIterDir200CellBicRT = fullfile(networkDir, exampleIterName200CellBicRT);
exampleIterDirHetero = fullfile(networkDir, exampleIterNameHetero);
exampleIterDirHeteroBicRT = fullfile(networkDir, exampleIterNameHeteroBicRT);
popIterDir2Cell = fullfile(networkDir, popIterName2Cell);
popIterDir2CellBicRT = fullfile(networkDir, popIterName2CellBicRT);
popIterDir200Cell = fullfile(networkDir, popIterName200Cell);
popIterDir200CellBicRT = fullfile(networkDir, popIterName200CellBicRT);
popIterDirHetero = fullfile(networkDir, popIterNameHetero);
popIterDirHeteroBicRT = fullfile(networkDir, popIterNameHeteroBicRT);
% Find all possible candidate labels
if isempty(candidateLabelsEach200Cell)
candidateLabelsEach200Cell = find_candidate_labels(popIterDir200Cell);
% TEMP: remove
toRemove = contains(candidateLabelsEach200Cell, ...
'candidateIDs_7,13-14,22,32,36');
candidateLabelsEach200Cell = candidateLabelsEach200Cell(~toRemove);
end
% Construct the full path to the candidate cell spreadsheet
candCellSheetPath = fullfile(networkDir, candCellSheetName);
% Create a rank string
rankStr = ['rank', create_label_from_sequence(rankNumsToUse)];
% Create an epas string
epasStr = ['TCepas', create_label_from_sequence(epasToUse)];
% Create a condition label
[conditionLabel2Cell, conditionLabel200Cell, conditionLabelHetero, ...
conditionLabel2CellBicRT, conditionLabel200CellBicRT, ...
conditionLabelHeteroBicRT] = ...
argfun(@(x) [x, '_', rankStr, '_gIncr', num2str(gIncr), '_', epasStr], ...
popIterName2Cell, popIterName200Cell, popIterNameHetero, ...
popIterName2CellBicRT, popIterName200CellBicRT, ...
popIterNameHeteroBicRT);
% Create a population data spreadsheet name
popDataSheetName2Cell = [popIterName2Cell, '_', rankStr, '_', ...
oscParamsSuffix, '.csv'];
popDataSheetName2CellBicRT = [popIterName2CellBicRT, '_', rankStr, '_', ...
oscParamsSuffix, '.csv'];
popDataSheetName200Cell = [popIterName200Cell, '_', rankStr, '_', ...
oscParamsSuffix, '.csv'];
popDataSheetName200CellBicRT = [popIterName200CellBicRT, '_', rankStr, '_', ...
oscParamsSuffix, '.csv'];
popDataSheetNameHetero = [popIterNameHetero, '_', rankStr, '_', ...
oscParamsSuffix, '.csv'];
popDataSheetNameHeteroBicRT = [popIterNameHeteroBicRT, '_', rankStr, '_', ...
oscParamsSuffix, '.csv'];
% Create a network data spreadsheet names
networkSheetNames = strcat(popIterName200Cell, '_', ...
candidateLabelsEach200Cell, '_', ...
oscParamsSuffix, '.csv');
networkSheetNamesEcdfs = strcat(popIterName200Cell, '_', ...
candidateLabels200CellEcdfs, '_', ...
oscParamsSuffix, '.csv');
% Contruct the full path to the population data spreadsheet
popDataPath2Cell = fullfile(figure08Dir, popDataSheetName2Cell);
popDataPath2CellBicRT = fullfile(figureRebuttal2Dir, popDataSheetName2CellBicRT);
popDataPath200Cell = fullfile(figure09Dir, popDataSheetName200Cell);
popDataPath200CellBicRT = fullfile(figureRebuttal3Dir, popDataSheetName200CellBicRT);
popDataPathHetero = fullfile(figure09Dir, popDataSheetNameHetero);
popDataPathHeteroBicRT = fullfile(figureRebuttal3Dir, popDataSheetNameHeteroBicRT);
networkDataPaths = fullfile(figure09Dir, networkSheetNames);
networkDataPathsEcdfs = fullfile(figure09Dir, networkSheetNamesEcdfs);
% Construct stats table paths
networkStatLabels = strcat(popIterName200Cell, '_', candidateLabelsEach200Cell, ...
'_gIncr', num2str(gIncr));
statsGroupByEpasPaths = ...
fullfile(figure09Dir, strcat(networkStatLabels, '_groupByEpas_stats.mat'));
% Create color maps
colorMapPharm = decide_on_colormap([], 4);
colorMapPharmCell = arrayfun(@(x) colorMapPharm(x, :), ...
transpose(1:4), 'UniformOutput', false);
%% Find example files and directories
if plotIpscComparison || plot2CellEssential || plot2CellM2h
% Select seed number directory
seedNumberDir2Cell = ...
fullfile(exampleIterDir2Cell, exampleSeedDirName2Cell);
% Find example network directories
[~, exampleDirs2Cell] = ...
cellfun(@(x) all_subdirs('Directory', seedNumberDir2Cell, ...
'Keyword', x), ...
exampleCellNames2Cell, 'UniformOutput', false);
end
if plotIpscComparisonBicRT || plot2CellEssentialBicRT || ...
plot2CellM2hBicRT
% Select seed number directory
seedNumberDir2CellBicRT = ...
fullfile(exampleIterDir2CellBicRT, exampleSeedDirName2Cell);
% Find example network directories
[~, exampleDirs2CellBicRT] = ...
cellfun(@(x) all_subdirs('Directory', seedNumberDir2CellBicRT, ...
'Keyword', x), ...
exampleCellNames2Cell, 'UniformOutput', false);
end
if plot200CellExamples
% Select seed number directory
seedNumberDir200Cell = ...
fullfile(exampleIterDir200Cell, exampleSeedDirName200Cell);
% Find example network directories
[~, exampleDirs200Cell] = ...
cellfun(@(x) all_subdirs('Directory', seedNumberDir200Cell, ...
'Keyword', x, 'Recursive', true), ...
exampleCellNames200Cell, 'UniformOutput', false);
end
if plot200CellExamplesBicRT
% Select seed number directory
seedNumberDir200CellBicRT = ...
fullfile(exampleIterDir200CellBicRT, exampleSeedDirName200Cell);
% Find example network directories
[~, exampleDirs200CellBicRT] = ...
cellfun(@(x) all_subdirs('Directory', seedNumberDir200CellBicRT, ...
'Keyword', x, 'Recursive', true), ...
exampleCellNames200Cell, 'UniformOutput', false);
end
if plotHeteroExamples
% Select seed number directory
seedNumberDirHetero = ...
fullfile(exampleIterDirHetero, exampleSeedDirName200Cell);
% Find example network directories
[~, exampleDirsHetero] = ...
cellfun(@(x) all_subdirs('Directory', seedNumberDirHetero, ...
'Keyword', x, 'Recursive', true), ...
exampleCellNamesHetero, 'UniformOutput', false);
end
if plotHeteroExamplesBicRT
% Select seed number directory
seedNumberDirHeteroBicRT = ...
fullfile(exampleIterDirHeteroBicRT, exampleSeedDirName200Cell);
% Find example network directories
[~, exampleDirsHeteroBicRT] = ...
cellfun(@(x) all_subdirs('Directory', seedNumberDirHeteroBicRT, ...
'Keyword', x, 'Recursive', true), ...
exampleCellNamesHetero, 'UniformOutput', false);
end
%% Plots figures for comparing dynamic clamp ipsc
if plotIpscComparison
cellfun(@(x, y) plot_ipsc_comparison(x, exampleIterName2Cell, ...
gIncr, y, figure08Dir, figTypes, ...
ipscFigWidth, ipscFigHeight, ...
xLimits2CellGabab, yLimitsGabab), ...
exampleCellNames2Cell, exampleDirs2Cell);
end
if plotIpscComparisonBicRT
cellfun(@(x, y) plot_ipsc_comparison(x, exampleIterName2CellBicRT, ...
gIncr, y, figureRebuttal2Dir, figTypes, ...
ipscFigWidth, ipscFigHeight, ...
xLimits2CellGabab, yLimitsGabab), ...
exampleCellNames2Cell, exampleDirs2CellBicRT);
end
%% Plots example 2-cell networks
if plot2CellEssential
cellfun(@(a, b) ...
cellfun(@(x, y) plot_2cell_examples(x, exampleIterName2Cell, ...
gIncr, a, y, figure08Dir, figTypes, ...
essential2CellFigWidth, essential2CellFigHeight, ...
xLimits2CellEssential, yLimitsEssential, ...
'essential', b, yTicksEssential), ...
exampleCellNames2Cell, exampleDirs2Cell), ...
num2cell(pharmConditions), colorMapPharmCell);
end
if plot2CellEssentialBicRT
cellfun(@(a, b) ...
cellfun(@(x, y) plot_2cell_examples(x, exampleIterName2CellBicRT, ...
gIncr, a, y, figureRebuttal2Dir, figTypes, ...
essential2CellFigWidth, essential2CellBicRTFigHeight, ...
xLimits2CellEssential, yLimitsEssentialBicRT, ...
'essential', b, yTicksEssentialBicRT), ...
exampleCellNames2Cell, exampleDirs2CellBicRT), ...
num2cell(pharmConditions), colorMapPharmCell);
end
%% Plots m2h of example 2-cell networks
if plot2CellM2h
cellfun(@(a, b) ...
cellfun(@(x, y) plot_2cell_examples(x, exampleIterName2Cell, ...
gIncr, a, y, figure08Dir, figTypes, ...
m2h2CellFigWidth, m2h2CellFigHeight, ...
xLimits2CellEssential, yLimitsM2h, ...
'm2h', b, yTicksM2h), ...
exampleCellNames2Cell, exampleDirs2Cell), ...
num2cell(pharmConditions), colorMapPharmCell);
end
if plot2CellM2hBicRT
cellfun(@(a, b) ...
cellfun(@(x, y) plot_2cell_examples(x, exampleIterName2CellBicRT, ...
gIncr, a, y, figureRebuttal2Dir, figTypes, ...
m2h2CellFigWidth, m2h2CellFigHeight, ...
xLimits2CellEssential, yLimitsM2h, ...
'm2h', b, yTicksM2h), ...
exampleCellNames2Cell, exampleDirs2CellBicRT), ...
num2cell(pharmConditions), colorMapPharmCell);
end
%% Plots example homogeneous 200-cell networks
if plot200CellExamples
arrayfun(@(z) ...
cellfun(@(x, y) plot_200cell_examples(x, exampleIterName200Cell, ...
gIncr, z, y, figure09Dir, figTypes, ...
example200CellFigWidth, example200CellFigHeight), ...
exampleCellNames200Cell, exampleDirs200Cell), ...
pharmConditions);
end
if plot200CellExamplesBicRT
arrayfun(@(z) ...
cellfun(@(x, y) plot_200cell_examples(x, exampleIterName200CellBicRT, ...
gIncr, z, y, figureRebuttal3Dir, figTypes, ...
example200CellFigWidth, example200CellFigHeight), ...
exampleCellNames200Cell, exampleDirs200CellBicRT), ...
pharmConditions);
end
%% Plots example heterogenous 200-cell networks
if plotHeteroExamples
arrayfun(@(z) ...
cellfun(@(x, y) plot_200cell_examples(x, exampleIterNameHetero, ...
gIncr, z, y, figure09Dir, figTypes, ...
example200CellFigWidth, example200CellFigHeight), ...
exampleCellNamesHetero, exampleDirsHetero), ...
pharmConditions);
end
if plotHeteroExamplesBicRT
arrayfun(@(z) ...
cellfun(@(x, y) plot_200cell_examples(x, exampleIterNameHeteroBicRT, ...
gIncr, z, y, figureRebuttal3Dir, figTypes, ...
example200CellFigWidth, example200CellFigHeight), ...
exampleCellNamesHetero, exampleDirsHeteroBicRT), ...
pharmConditions);
end
%% Analyzes spikes for all 2-cell networks
if analyze2CellSpikes
reanalyze_network_spikes(popIterDir2Cell, backupPrevious2Cell, ...
plotAnalysis2Cell);
end
if analyze2CellSpikesBicRT
reanalyze_network_spikes(popIterDir2CellBicRT, backupPrevious2CellBicRT, ...
plotAnalysis2CellBicRT);
end
%% Combines quantification over all 2-cell networks
if combine2CellPop
combine_osc_params(popIterDir2Cell, candCellSheetPath, ...
rankNumsToUse2Cell, popDataPath2Cell);
end
if combine2CellPopBicRT
combine_osc_params(popIterDir2CellBicRT, candCellSheetPath, ...
rankNumsToUse2Cell, popDataPath2CellBicRT);
end
%% Analyzes spikes for all homogeneous 200-cell networks
if analyze200CellSpikes
reanalyze_network_spikes(popIterDir200Cell, ...
backupPrevious200Cell, plotAnalysis200Cell);
end
if analyze200CellSpikesBicRT
reanalyze_network_spikes(popIterDir200CellBicRT, ...
backupPrevious200CellBicRT, plotAnalysis200CellBicRT);
end
%% Analyzes spikes for all heterogeneous 200-cell networks
if analyzeHeteroSpikes
reanalyze_network_spikes(popIterDirHetero, ...
backupPreviousHetero, plotAnalysisHetero);
end
if analyzeHeteroSpikesBicRT
reanalyze_network_spikes(popIterDirHeteroBicRT, ...
backupPreviousHeteroBicRT, plotAnalysisHeteroBicRT);
end
%% Combines quantification over all homogeneous 200-cell networks
if combine200CellPop
combine_osc_params(popIterDir200Cell, candCellSheetPath, ...
rankNumsToUse200Cell, popDataPath200Cell);
end
if combine200CellPopBicRT
combine_osc_params(popIterDir200CellBicRT, candCellSheetPath, ...
rankNumsToUse200Cell, popDataPath200CellBicRT);
end
%% Combines quantification over all heterogeneous 200-cell networks
if combineHeteroPop
combine_osc_params(popIterDirHetero, candCellSheetPath, ...
rankNumsToUseHetero, popDataPathHetero);
end
if combineHeteroPopBicRT
combine_osc_params(popIterDirHeteroBicRT, candCellSheetPath, ...
rankNumsToUseHetero, popDataPathHeteroBicRT);
end
%% Combines activation profiles over seed numbers for each 200-cell network
if combineActivationProfiles
combine_activation_profiles(popIterDir200Cell, figure09Dir, epasToPlot, ...
candidateLabels200CellActivationProfiles);
end
%% Plots oscillation measures over pharm condition
% across all 2-cell networks
if plot2CellViolins || plot2CellScatters
% Construct stats table path
stats2dPath2Cell = ...
fullfile(figure08Dir, strcat(conditionLabel2Cell, '_stats.mat'));
% Compute statistics if not done already
m3ha_network_compute_and_save_statistics(stats2dPath2Cell, ...
popDataPath2Cell, gIncr, epasToUse, ...
measuresOfInterest, measureTitles, 'mean', cellNameStr, ...
conditionLabel2Cell, pharmLabelsShort);
% Plot violin plots
if plot2CellViolins
m3ha_plot_violin(stats2dPath2Cell, ...
'RowsToPlot', measuresToPlot, 'OutFolder', figure08Dir);
end
% Plot scatter plots
if plot2CellScatters
m3ha_plot_grouped_scatter(stats2dPath2Cell, ...
'RowsToPlot', measuresToPlot, 'OutFolder', figure08Dir);
end
end
if plot2CellViolinsBicRT
% Construct stats table path
stats2dPath2CellBicRT = ...
fullfile(figureRebuttal2Dir, strcat(conditionLabel2CellBicRT, '_stats.mat'));
% Compute statistics if not done already
m3ha_network_compute_and_save_statistics(stats2dPath2CellBicRT, ...
popDataPath2CellBicRT, gIncr, epasToUse, ...
measuresOfInterest, measureTitles, 'mean', cellNameStr, ...
conditionLabel2CellBicRT, pharmLabelsShort);
% Plot violin plots
m3ha_plot_violin(stats2dPath2CellBicRT, 'RowsToPlot', measuresToPlot, ...
'OutFolder', figureRebuttal2Dir);
end
%% Plots maximum open probability against oscillation measures
% across all 2-cell networks
if plot2CellTwoGroups
m3ha_network_plot_opd(popDataPath2Cell, gIncr, epasToUse, ...
measuresOfInterest, measureTitles, 'mean', cellNameStr, ...
conditionLabel2Cell, pharmLabelsShort, ...
openProbFigWidth, openProbFigHeight, figTypes);
m3ha_network_plot_opd(popDataPath2Cell, gIncr, epasToUse, ...
measuresOfInterest, measureTitles, 'all', cellNameStr, ...
conditionLabel2Cell, pharmLabelsShort, ...
openProbFigWidth, openProbFigHeight, figTypes);
end
%% Plots mean oscillation measures over pharm condition
% across all homogeneous 200-cell networks
if plot200CellViolins
% Construct stats table path
stats2dPath200Cell = ...
fullfile(figure09Dir, strcat(conditionLabel200Cell, '_stats.mat'));
% Compute statistics if not done already
m3ha_network_compute_and_save_statistics(stats2dPath200Cell, ...
popDataPath200Cell, gIncr, epasToUse, ...
measuresOfInterest, measureTitles, 'mean', cellNameStr, ...
conditionLabel200Cell, pharmLabelsShort);
% Plot violin plots
m3ha_plot_violin(stats2dPath200Cell, 'RowsToPlot', measuresToPlot, ...
'OutFolder', figure09Dir);
end
if plot200CellViolinsBicRT
% Construct stats table path
stats2dPath200CellBicRT = ...
fullfile(figureRebuttal3Dir, strcat(conditionLabel200CellBicRT, '_stats.mat'));
% Compute statistics if not done already
m3ha_network_compute_and_save_statistics(stats2dPath200CellBicRT, ...
popDataPath200CellBicRT, gIncr, epasToUse, ...
measuresOfInterest, measureTitles, 'mean', cellNameStr, ...
conditionLabel200CellBicRT, pharmLabelsShort);
% Plot violin plots
m3ha_plot_violin(stats2dPath200CellBicRT, 'RowsToPlot', measuresToPlot, ...
'OutFolder', figureRebuttal3Dir);
end
%% Plots mean oscillation measures over pharm condition
% across all heterogeneous 200-cell networks
if plotHeteroViolins
% Construct stats table path
stats2dPathHetero = ...
fullfile(figure09Dir, strcat(conditionLabelHetero, '_stats.mat'));
% Compute statistics if not done already
m3ha_network_compute_and_save_statistics(stats2dPathHetero, ...
popDataPathHetero, gIncr, epasToUse, ...
measuresOfInterest, measureTitles, 'mean', cellNameStr, ...
conditionLabelHetero, pharmLabelsShort);
% Plot violin plots
m3ha_plot_violin(stats2dPathHetero, 'RowsToPlot', measuresToPlot, ...
'OutFolder', figure09Dir);
end
if plotHeteroViolinsBicRT
% Construct stats table path
stats2dPathHeteroBicRT = ...
fullfile(figureRebuttal3Dir, strcat(conditionLabelHeteroBicRT, '_stats.mat'));
% Compute statistics if not done already
m3ha_network_compute_and_save_statistics(stats2dPathHeteroBicRT, ...
popDataPathHeteroBicRT, gIncr, epasToUse, ...
measuresOfInterest, measureTitles, 'mean', cellNameStr, ...
conditionLabelHeteroBicRT, pharmLabelsShort);
% Plot violin plots
m3ha_plot_violin(stats2dPathHeteroBicRT, 'RowsToPlot', measuresToPlot, ...
'OutFolder', figureRebuttal3Dir);
end
%% Plots oscillation measures grouped by cells for the homogeneous networks
if plot200CellGroupByCellJitters
% Construct stats table path
statsGroupByCellPath200Cell = ...
fullfile(figure09Dir, strcat(conditionLabel200Cell, ...
'_groupByCell_stats.mat'));
% Compute statistics if not done already
m3ha_network_compute_and_save_statistics(statsGroupByCellPath200Cell, ...
popDataPath200Cell, gIncr, epasToUse, ...
measuresOfInterestJitter, measureTitlesJitter, ...
'grouped', cellNameStr, conditionLabel200Cell, pharmLabelsShort);
% Plot jitter plots
m3ha_plot_all_jitters(statsGroupByCellPath200Cell, figure09Dir, ...
measuresToPlotJitter);
end
%% Plots oscillation measures grouped by cells for the heterogeneous networks
if plotHeteroGroupByCellJitters
% Construct stats table path
statsGroupByCellPathHetero = ...
fullfile(figure09Dir, strcat(conditionLabelHetero, ...
'_groupByCell_stats.mat'));
% Compute statistics if not done already
m3ha_network_compute_and_save_statistics(statsGroupByCellPathHetero, ...
popDataPathHetero, gIncr, epasToUse, ...
measuresOfInterestJitter, measureTitlesJitter, ...
'grouped', cellNameStr, conditionLabelHetero, pharmLabelsShort);
% Plot jitter plots
m3ha_plot_all_jitters(statsGroupByCellPathHetero, figure09Dir, ...
measuresToPlotJitter);
end
%% Combines quantification over each 200-cell networks
if combineEach200CellNetwork
cellfun(@(dataPath, candidateLabel) ...
combine_osc_params(popIterDir200Cell, candCellSheetPath, ...
candidateLabel, dataPath), ...
networkDataPaths, candidateLabelsEach200Cell, ...
'UniformOutput', false);
end
%% Plots oscillation measures grouped by TCepas
if plot200CellGroupByEpasJitters
% Compute statistics if not done already
cellfun(@(a, b, c) ...
m3ha_network_compute_and_save_statistics(a, b, gIncr, epasToUse, ...
measuresOfInterestJitter, measureTitlesJitter, ...
'grouped', epasStr, c, pharmLabelsShort), ...
statsGroupByEpasPaths, networkDataPaths, networkStatLabels);
% Plot jitter plots
cellfun(@(a) m3ha_plot_all_jitters(a, figure09Dir, ...
measuresOfInterestJitter), ...
statsGroupByEpasPaths);
end
%% Plots cumulative distribution plots
if plot200CellCumDist
m3ha_plot_all_cumulative_distributions(networkDataPathsEcdfs, ...
measuresOfInterestJitter, ...
measureTitlesJitter, candCellSheetPath);
end
%% Archive all scripts for this run
if archiveScriptsFlag
if plotIpscComparison || plot2CellEssential || plot2CellM2h || ...
analyze2CellSpikes || combine2CellPop || plot2CellViolins || ...
plot2CellScatters || plot2CellTwoGroups || ...
plotIpscComparisonBicRT || plot2CellEssentialBicRT || ...
plot2CellM2hBicRT || analyze2CellSpikesBicRT || ...
combine2CellPopBicRT || plot2CellViolinsBicRT
archive_dependent_scripts(mfilename, 'OutFolder', figureRebuttal2Dir);
end
if plot200CellExamples || analyze200CellSpikes || ...
combineActivationProfiles || combine200CellPop || ...
plot200CellViolins || analyzeHeteroSpikes || ...
combineHeteroPop || plotHeteroViolins || ...
plot200CellGroupByCellJitters || plotHeteroGroupByCellJitters || ...
combineEach200CellNetwork || ...
plot200CellGroupByEpasJitters || plot200CellCumDist
archive_dependent_scripts(mfilename, 'OutFolder', figure09Dir);
end
if plot200CellExamplesBicRT || analyze200CellSpikesBicRT || ...
combine200CellPopBicRT || ...
plot200CellViolinsBicRT || analyzeHeteroSpikesBicRT || ...
combineHeteroPopBicRT || plotHeteroViolinsBicRT
archive_dependent_scripts(mfilename, 'OutFolder', figureRebuttal3Dir);
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function plot_ipsc_comparison (cellName, popIterName2Cell, gIncr, ...
inFolder, outFolder, ...
figTypes, figWidth, figHeight, ...
xLimits, yLimits)
% Plot an IPSC comparison plot
% Create a gIncr string
gIncrStr = ['gIncr', num2str(gIncr)];
% Create figure names
figPathBase = fullfile(outFolder, [cellName, '_', popIterName2Cell, ...
'_', gIncrStr, '_gabab_ipsc_comparison']);
figPathBaseOrig = [figPathBase, '_orig'];
% Create the figure
fig = set_figure_properties('AlwaysNew', true);
% Plot comparison
m3ha_network_plot_gabab('SaveNewFlag', false, 'InFolder', inFolder, ...
'XLimits', xLimits, 'YLimits', yLimits, ...
'FigTitle', 'suppress', ...
'AmpScaleFactor', gIncr);
% Save original figure
drawnow;
save_all_figtypes(fig, figPathBaseOrig, 'png');
% Plot a scale bar
plot_scale_bar('x', 'XBarUnits', 'ms', 'XBarLength', 200, ...
'XPosNormalized', 0.9, 'YPosNormalized', 0.9);
% Update figure for CorelDraw
update_figure_for_corel(fig, 'Units', 'centimeters', ...
'Width', figWidth, 'Height', figHeight, ...
'RemoveXRulers', true, 'AlignSubplots', true);
% Save the figure
drawnow;
save_all_figtypes(fig, figPathBase, figTypes);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function plot_2cell_examples (cellName, iterName, gIncr, pharm, ...
inFolder, outFolder, figTypes, ...
figWidth, figHeight, xLimits, yLimits, ...
plotType, colorMap, yTickLocs)
% Plot 2-cell network examples
% Create a gIncr string
gIncrStr = ['gIncr', num2str(gIncr)];
pharmStr = ['pharm', num2str(pharm)];
% Create figure names
figPathBase = fullfile(outFolder, [cellName, '_', iterName, ...
'_', gIncrStr, '_', pharmStr, '_2cell_', plotType]);
figPathBaseOrig = [figPathBase, '_orig'];
% Create the figure
fig = set_figure_properties('AlwaysNew', true);
% Plot example
handles = ...
m3ha_network_plot_essential('SaveNewFlag', false, 'InFolder', inFolder, ...
'XLimits', xLimits, 'YLimits', yLimits, ...
'FigTitle', 'suppress', ...
'AmpScaleFactor', gIncr, 'PharmCondition', pharm, ...
'PlotType', plotType, 'Color', colorMap);
% Save original figure
drawnow;
save_all_figtypes(fig, figPathBaseOrig, 'png');
% Fine tune
switch plotType
case 'essential'
% Get all subplots
subPlots = handles.subPlots;
% Plot a scale bar in the first subplot
subplot(subPlots(1));
plot_scale_bar('x', 'XBarUnits', 'ms', 'XBarLength', 200, ...
'XPosNormalized', 0.9, 'YPosNormalized', 0.9);
end
% Update figure for CorelDraw
update_figure_for_corel(fig, 'Units', 'centimeters', ...
'Width', figWidth, 'Height', figHeight, ...
'YTickLocs', yTickLocs, ...
'RemoveXRulers', true, 'AlignSubplots', true);
% Save the figure
drawnow;
save_all_figtypes(fig, figPathBase, figTypes);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function plot_200cell_examples (cellName, iterName, gIncrDclamp, pharm, ...
inFolder, outFolder, figTypes, figWidth, figHeight)
% Plot 200-cell network examples
% Get the gIncr value for the network
gIncr = gIncrDclamp / 12;
% Create strings
gIncrStr = ['gIncr', num2str(gIncrDclamp)];
pharmStr = ['pharm', num2str(pharm)];
% Find the appropriate simulation number
simNumber = m3ha_network_find_sim_number(inFolder, pharm, gIncr);
% Create figure names
figPathBase = fullfile(outFolder, [cellName, '_', iterName, ...
'_', gIncrStr, '_', pharmStr, '_200cell_example']);
figPathBaseOrig = [figPathBase, '_orig'];
%% Full figure
% Create the figure
fig = set_figure_properties('AlwaysNew', true);
% Plot spike raster plot
m3ha_network_raster_plot(inFolder, 'OutFolder', outFolder, ...
'SingleTrialNum', simNumber, ...
'PlotSpikes', true, 'PlotTuning', false, ...
'PlotOnly', true);
% Save original figure
drawnow;
save_all_figtypes(fig, figPathBaseOrig, 'png');
% Update figure for CorelDraw
update_figure_for_corel(fig, 'RemoveXLabels', true, 'RemoveYLabels', true, ...
'RemoveTitles', true, 'RemoveXRulers', true);
update_figure_for_corel(fig, 'Units', 'centimeters', ...
'Width', figWidth, 'Height', figHeight);
% Plot a scale bar only for the Dual Blockade condition
if pharm == 4
plot_scale_bar('x', 'XBarUnits', 'sec', 'XBarLength', 2, ...
'XPosNormalized', 0.6, 'YPosNormalized', 0.2);
end
% Save the figure
drawnow;
save_all_figtypes(fig, figPathBase, figTypes);
% Close all figures
close all
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%