OSCR

Local inhibitory dynamics underpin temporal integration and functional segregation between barrels and septa in the mouse barrel cortex.

Code ↔ Paper

3 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

The 3 matches · 1 of them tie a paragraph to a whole file, not to given lines: a weak match, whose lines are not tinted
  1. [1] § Results › Progressive multi- over single-whisker response divergence in septal populations is abolished in Elfn1 KO mice ↔ eLife-VOR-RA-2025-107099/Source Code 3.m, lines 803–926 · score 0.59 · 7–20, KO SW, 1–20, KO MW, Layer, ratio
  2. [2] § Methods › t-SNE analysis ↔ eLife-VOR-RA-2025-107099/Source Code 3.m, lines 2352–2408 · score 0.52 · t-SNE, barneshut, exaggeration, gscatter, perplexity, algorithm
  3. [3] § Methods › t-SNE analysis ↔ eLife-VOR-RA-2025-107099/Source Code 5.m, the whole file · a weak match · score 0.51 · t-SNE, barneshut, exaggeration, gscatter, perplexity, algorithm

Paper

Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

MATLAB · 2,922 lines · 131 KB · no license · 2 matches

  1. %% Ali Özgür Argunşah, June, 2026
  2. %% https://doi.org/10.7554/eLife.107099.3
  3. %% Figure 1 and 4 and Supplements
  4. % Load Data
  5. clear all
  6. %%
  7. load('/Users/aargun/Documents/My Papers/Barrel-Septa/Elife_Revision/VOR_June25_2026/Data/Silicon Probe/NeighbourData_Sep2022.mat');
  8. load('/Users/aargun/Documents/My Papers/Barrel-Septa/Elife_Revision/VOR_June25_2026/Data/Silicon Probe/AllData_May2023.mat');
  9. load stim_raw.mat;
  10. saveFolder = '/Users/aargun/Documents/My Papers/Barrel-Septa/Elife_Revision/VOR_June25_2026/Exported';
  11. % Whisker Stim
  12. stimvec = stim(:,2)-mean(stim(1:100,2));
  13. stimvec_norm = stimvec/max(stimvec);
  14. begin = (2610-round(4000/5));
  15. stimvec_norm_synch = stimvec_norm(begin:begin+9199);
  16. t1 = (1:2200)/1000;
  17. t2 = (1:9200)/4182;
  18. stimvec_norm_synch_Fs1000 = interp1(t2',stimvec_norm_synch,t1','spline');
  19. %% Figure 1A - Waveform
  20. figure , plot((1:2200)/1000,100*stimvec_norm_synch_Fs1000,'LineWidth',1,'Color','k');
  21. title('Figure 1A - Waveform');
  22. figure , plot((1:9200)/4182,100*stimvec_norm_synch,'LineWidth',1,'Color','r');
  23. baselineTimes = 1:190;
  24. tempstim = stimvec_norm_synch_Fs1000;
  25. tempstim(tempstim>0.4*ones(2200,1)) = 0;
  26. [pks,locs] = findpeaks(tempstim,'MinPeakHeight',0.2);
  27. % beglocs = locs(1:2:end);
  28. % New BegLocs
  29. beglocs = [205 306 406 506 606 706 806 905 1004 1104 1204 1304 1404 1502 1602 1702 1802 1902 2000 2100 ];
  30. %%
  31. colorBarrel = [50,50,50]/255;%[31,120,180]/255;%[252 216 134]/255;
  32. colorSepta = [206,18,86]/255;%[51,160,44]/255;%[235 38 31]/255;
  33. colorNeigh = [8,81,156]/255;%[227,26,28]/255;%[188 128 219]/255;
  34. colorBarrelKO = [150,150,150]/255;%[177,89,40]/255;%[247 136 154]/255;
  35. colorSeptaKO = [201,148,199]/255;%[106,61,154]/255;%[31 38 235]/255;
  36. colorNeighKO = [78,179,211]/255;%[245,225,75]/255;%[162 238 135]/255;
  37. colorBarrel_MW = colorBarrel/2;%color1/2;%[252 216 134]/255;
  38. colorSepta_MW = colorSepta/2;%color2/2;%[235 38 31]/255;
  39. colorNeigh_MW = [];%color3/2;%[188 128 219]/255;
  40. colorBarrelKO_MW = colorBarrelKO/2;%color1ko/2;%[247 136 154]/255;
  41. colorSeptaKO_MW = colorSeptaKO/2;%color2ko/2;%[31 38 235]/255;
  42. colorNeighKO_MW = [];%color3ko/2;%[162 238 135]/255;
  43. %% MW Data Etraction
  44. counter = 1;
  45. temp_L23_WT_MW = [];
  46. for i = 1:size(jenqData.wt.barrel.L23.multi.spktimes,2)
  47. for j = 1:20
  48. temp = zeros(1,2200);
  49. temp(jenqData.wt.barrel.L23.multi.spktimes{i}{j}) = 1;
  50. temp_L23_WT_MW(counter,:) = temp;
  51. counter = counter + 1;
  52. end
  53. end
  54. counter = 1;
  55. temp_L4_WT_MW = [];
  56. for i = 1:size(jenqData.wt.barrel.L4.multi.spktimes,2)
  57. for j = 1:20
  58. temp = zeros(1,2200);
  59. temp(jenqData.wt.barrel.L4.multi.spktimes{i}{j}) = 1;
  60. temp_L4_WT_MW(counter,:) = temp;
  61. counter = counter + 1;
  62. end
  63. end
  64. counter = 1;
  65. temp_L5_WT_MW = [];
  66. for i = 1:size(jenqData.wt.barrel.L5.multi.spktimes,2)
  67. for j = 1:20
  68. temp = zeros(1,2200);
  69. temp(jenqData.wt.barrel.L5.multi.spktimes{i}{j}) = 1;
  70. temp_L5_WT_MW(counter,:) = temp;
  71. counter = counter + 1;
  72. end
  73. end
  74. counter = 1;
  75. temp_L23_WT_MW_septa = [];
  76. for i = 1:size(jenqData.wt.septa.L23.multi.spktimes,2)
  77. for j = 1:20
  78. temp = zeros(1,2200);
  79. temp(jenqData.wt.septa.L23.multi.spktimes{i}{j}) = 1;
  80. temp_L23_WT_MW_septa(counter,:) = temp;
  81. counter = counter + 1;
  82. end
  83. end
  84. counter = 1;
  85. temp_L4_WT_MW_septa = [];
  86. for i = 1:size(jenqData.wt.septa.L4.multi.spktimes,2)
  87. for j = 1:20
  88. temp = zeros(1,2200);
  89. temp(jenqData.wt.septa.L4.multi.spktimes{i}{j}) = 1;
  90. temp_L4_WT_MW_septa(counter,:) = temp;
  91. counter = counter + 1;
  92. end
  93. end
  94. counter = 1;
  95. temp_L5_WT_MW_septa = [];
  96. for i = 1:size(jenqData.wt.septa.L5.multi.spktimes,2)
  97. for j = 1:20
  98. temp = zeros(1,2200);
  99. temp(jenqData.wt.septa.L5.multi.spktimes{i}{j}) = 1;
  100. temp_L5_WT_MW_septa(counter,:) = temp;
  101. counter = counter + 1;
  102. end
  103. end
  104. counter = 1;
  105. temp_L23_KO_MW = [];
  106. for i = 1:size(jenqData.ko.barrel.L23.multi.spktimes,2)
  107. for j = 1:20
  108. temp = zeros(1,2200);
  109. temp(jenqData.ko.barrel.L23.multi.spktimes{i}{j}) = 1;
  110. temp_L23_KO_MW(counter,:) = temp;
  111. counter = counter + 1;
  112. end
  113. end
  114. counter = 1;
  115. temp_L4_KO_MW = [];
  116. for i = 1:size(jenqData.ko.barrel.L4.multi.spktimes,2)
  117. for j = 1:20
  118. temp = zeros(1,2200);
  119. temp(jenqData.ko.barrel.L4.multi.spktimes{i}{j}) = 1;
  120. temp_L4_KO_MW(counter,:) = temp;
  121. counter = counter + 1;
  122. end
  123. end
  124. counter = 1;
  125. temp_L5_KO_MW = [];
  126. for i = 1:size(jenqData.ko.barrel.L5.multi.spktimes,2)
  127. for j = 1:20
  128. temp = zeros(1,2200);
  129. temp(jenqData.ko.barrel.L5.multi.spktimes{i}{j}) = 1;
  130. temp_L5_KO_MW(counter,:) = temp;
  131. counter = counter + 1;
  132. end
  133. end
  134. counter = 1;
  135. temp_L23_KO_MW_septa = [];
  136. for i = 1:size(jenqData.ko.septa.L23.multi.spktimes,2)
  137. for j = 1:20
  138. temp = zeros(1,2200);
  139. temp(jenqData.ko.septa.L23.multi.spktimes{i}{j}) = 1;
  140. temp_L23_KO_MW_septa(counter,:) = temp;
  141. counter = counter + 1;
  142. end
  143. end
  144. counter = 1;
  145. temp_L4_KO_MW_septa = [];
  146. for i = 1:size(jenqData.ko.septa.L4.multi.spktimes,2)
  147. for j = 1:20
  148. temp = zeros(1,2200);
  149. temp(jenqData.ko.septa.L4.multi.spktimes{i}{j}) = 1;
  150. temp_L4_KO_MW_septa(counter,:) = temp;
  151. counter = counter + 1;
  152. end
  153. end
  154. counter = 1;
  155. temp_L5_KO_MW_septa = [];
  156. for i = 1:size(jenqData.ko.septa.L5.multi.spktimes,2)
  157. for j = 1:20
  158. temp = zeros(1,2200);
  159. temp(jenqData.ko.septa.L5.multi.spktimes{i}{j}) = 1;
  160. temp_L5_KO_MW_septa(counter,:) = temp;
  161. counter = counter + 1;
  162. end
  163. end
  164. %% Spontaneous Analysis
  165. LFP_Barrel_WT_L23_SW = cat(1,jenqData.wt.barrel.L23.single.LFP,jenqData.wt.barrel.L23.multi.LFP);
  166. MUA_Barrel_WT_L23_SW = cat(2,jenqData.wt.barrel.L23.single.MUA,jenqData.wt.barrel.L23.multi.MUA);
  167. MUA_Barrel_KO_L23_SW = cat(2,jenqData.ko.barrel.L23.single.MUA,jenqData.ko.barrel.L23.multi.MUA);
  168. MUA_Septa_WT_L23_SW = cat(2,jenqData.wt.septa.L23.single.MUA,jenqData.wt.septa.L23.multi.MUA);
  169. MUA_Septa_KO_L23_SW = cat(2,jenqData.ko.septa.L23.single.MUA,jenqData.ko.septa.L23.multi.MUA);
  170. MUA_Barrel_WT_L4_SW = cat(2,jenqData.wt.barrel.L4.single.MUA,jenqData.wt.barrel.L4.multi.MUA);
  171. MUA_Barrel_KO_L4_SW = cat(2,jenqData.ko.barrel.L4.single.MUA,jenqData.ko.barrel.L4.multi.MUA);
  172. MUA_Septa_WT_L4_SW = cat(2,jenqData.wt.septa.L4.single.MUA,jenqData.wt.septa.L4.multi.MUA);
  173. MUA_Septa_KO_L4_SW = cat(2,jenqData.ko.septa.L4.single.MUA,jenqData.ko.septa.L4.multi.MUA);
  174. MUA_Barrel_WT_L5_SW = cat(2,jenqData.wt.barrel.L5.single.MUA,jenqData.wt.barrel.L5.multi.MUA);
  175. MUA_Barrel_KO_L5_SW = cat(2,jenqData.ko.barrel.L5.single.MUA,jenqData.ko.barrel.L5.multi.MUA);
  176. MUA_Septa_WT_L5_SW = cat(2,jenqData.wt.septa.L5.single.MUA,jenqData.wt.septa.L5.multi.MUA);
  177. MUA_Septa_KO_L5_SW = cat(2,jenqData.ko.septa.L5.single.MUA,jenqData.ko.septa.L5.multi.MUA);
  178. ranksum(mean(MUA_Barrel_WT_L23_SW(1:200,:),1),mean(MUA_Barrel_KO_L23_SW(1:200,:),1))
  179. ranksum(mean(MUA_Septa_WT_L23_SW(1:200,:),1),mean(MUA_Septa_KO_L23_SW(1:200,:),1))
  180. ranksum(mean(MUA_Barrel_WT_L4_SW(1:200,:),1),mean(MUA_Barrel_KO_L4_SW(1:200,:),1))
  181. ranksum(mean(MUA_Septa_WT_L4_SW(1:200,:),1),mean(MUA_Septa_KO_L4_SW(1:200,:),1))
  182. ranksum(mean(MUA_Barrel_WT_L23_SW(1:200,:),1),mean(MUA_Septa_WT_L23_SW(1:200,:),1))
  183. ranksum(mean(MUA_Barrel_KO_L23_SW(1:200,:),1),mean(MUA_Septa_KO_L23_SW(1:200,:),1))
  184. %% Remove Baseline
  185. noBase_temp_L23_WT = temp_L23_WT-repmat(mean(temp_L23_WT(:,1:200),2),1,2200);
  186. noBase_temp_L23_WT_neigh = temp_L23_WT_neigh-repmat(mean(temp_L23_WT_neigh(:,1:200),2),1,2201);
  187. noBase_temp_L23_WT_septa = temp_L23_WT_septa-repmat(mean(temp_L23_WT_septa(:,1:200),2),1,2200);
  188. noBase_temp_L23_ko = temp_L23_ko-repmat(mean(temp_L23_ko(:,1:200),2),1,2200);
  189. noBase_temp_L23_KO_neigh = temp_L23_KO_neigh-repmat(mean(temp_L23_KO_neigh(:,1:200),2),1,2201);
  190. noBase_temp_L23_ko_septa = temp_L23_ko_septa-repmat(mean(temp_L23_ko_septa(:,1:200),2),1,2200);
  191. noBase_temp_L23_WT_MW = temp_L23_WT_MW-repmat(mean(temp_L23_WT_MW(:,1:200),2),1,2200);
  192. noBase_temp_L23_WT_MW_septa = temp_L23_WT_MW_septa-repmat(mean(temp_L23_WT_MW_septa(:,1:200),2),1,2200);
  193. noBase_temp_L23_KO_MW = temp_L23_KO_MW-repmat(mean(temp_L23_KO_MW(:,1:200),2),1,2200);
  194. noBase_temp_L23_KO_MW_septa = temp_L23_KO_MW_septa-repmat(mean(temp_L23_KO_MW_septa(:,1:200),2),1,2200);
  195. noBase_temp_L4_WT = temp_L4_WT-repmat(mean(temp_L4_WT(:,1:200),2),1,2200);
  196. noBase_temp_L4_WT_neigh = temp_L4_WT_neigh-repmat(mean(temp_L4_WT_neigh(:,1:200),2),1,2201);
  197. noBase_temp_L4_WT_septa = temp_L4_WT_septa-repmat(mean(temp_L4_WT_septa(:,1:200),2),1,2200);
  198. noBase_temp_L4_ko = temp_L4_ko-repmat(mean(temp_L4_ko(:,1:200),2),1,2200);
  199. noBase_temp_L4_KO_neigh = temp_L4_KO_neigh-repmat(mean(temp_L4_KO_neigh(:,1:200),2),1,2201);
  200. noBase_temp_L4_ko_septa = temp_L4_ko_septa-repmat(mean(temp_L4_ko_septa(:,1:200),2),1,2200);
  201. noBase_temp_L4_WT_MW = temp_L4_WT_MW-repmat(mean(temp_L4_WT_MW(:,1:200),2),1,2200);
  202. noBase_temp_L4_WT_MW_septa = temp_L4_WT_MW_septa-repmat(mean(temp_L4_WT_MW_septa(:,1:200),2),1,2200);
  203. noBase_temp_L4_KO_MW = temp_L4_KO_MW-repmat(mean(temp_L4_KO_MW(:,1:200),2),1,2200);
  204. noBase_temp_L4_KO_MW_septa = temp_L4_KO_MW_septa-repmat(mean(temp_L4_KO_MW_septa(:,1:200),2),1,2200);
  205. noBase_temp_L5_WT = temp_L5_WT-repmat(mean(temp_L5_WT(:,1:200),2),1,2200);
  206. noBase_temp_L5_WT_neigh = temp_L5_WT_neigh-repmat(mean(temp_L5_WT_neigh(:,1:200),2),1,2201);
  207. noBase_temp_L5_WT_septa = temp_L5_WT_septa-repmat(mean(temp_L5_WT_septa(:,1:200),2),1,2200);
  208. noBase_temp_L5_ko = temp_L5_ko-repmat(mean(temp_L5_ko(:,1:200),2),1,2200);
  209. noBase_temp_L5_KO_neigh = temp_L5_KO_neigh-repmat(mean(temp_L5_KO_neigh(:,1:200),2),1,2201);
  210. noBase_temp_L5_ko_septa = temp_L5_ko_septa-repmat(mean(temp_L5_ko_septa(:,1:200),2),1,2200);
  211. noBase_temp_L5_WT_MW = temp_L5_WT_MW-repmat(mean(temp_L5_WT_MW(:,1:200),2),1,2200);
  212. noBase_temp_L5_WT_MW_septa = temp_L5_WT_MW_septa-repmat(mean(temp_L5_WT_MW_septa(:,1:200),2),1,2200);
  213. noBase_temp_L5_KO_MW = temp_L5_KO_MW-repmat(mean(temp_L5_KO_MW(:,1:200),2),1,2200);
  214. noBase_temp_L5_KO_MW_septa = temp_L5_KO_MW_septa-repmat(mean(temp_L5_KO_MW_septa(:,1:200),2),1,2200);
  215. %% Figures
  216. % Figure 1 Figure Supplement 3A - Barrel
  217. figure , bar(mean(temp_L23_WT),2,'FaceColor',colorBarrel,'LineWidth',15);
  218. set(gca,'visible','off'); set(gcf,'Position',[100 100 500 250]);
  219. exportgraphics(gcf,fullfile(saveFolder,'L23_WT_Barrel_spikes.png'),"Resolution",600);
  220. % Figure 1 Figure Supplement 3A - Septa
  221. figure, bar(smooth(mean(temp_L23_WT_septa),3),3,'FaceColor',...
  222. colorSepta,'LineWidth',15); set(gca,'visible','off'); set(gcf,'Position',[100 100 500 250]);
  223. exportgraphics(gcf,fullfile(saveFolder,'L23_WT_Septa_spikes.png'),"Resolution",600);
  224. % Figure 1D - Barrel
  225. figure , bar(smooth(mean(temp_L4_WT),3),3,'FaceColor',...
  226. colorBarrel,'LineWidth',15); set(gca,'visible','off'); set(gcf,'Position',[100 100 500 250]);
  227. exportgraphics(gcf,fullfile(saveFolder,'L4_WT_Barrel_spikes.png'),"Resolution",600);
  228. % Figure 1D - Septa
  229. figure, bar(smooth(mean(temp_L4_WT_septa),3),3,'FaceColor',...
  230. colorSepta,'LineWidth',15); set(gca,'visible','off'); set(gcf,'Position',[100 100 500 250]);
  231. exportgraphics(gcf,fullfile(saveFolder,'L4_WT_Septa_spikes.png'),"Resolution",600);
  232. % Figure 1D - Neighbour
  233. figure, bar(smooth(mean(temp_L4_WT_neigh),3),3,'FaceColor',...
  234. colorNeigh,'LineWidth',15); set(gca,'visible','off'); set(gcf,'Position',[100 100 500 250]);
  235. exportgraphics(gcf,fullfile(saveFolder,'L4_WT_Neighbour_spikes.png'),"Resolution",600);
  236. % Figure 4B - Barrel
  237. figure , bar(smooth(mean(temp_L4_ko),3),3,'FaceColor',...
  238. colorBarrelKO,'LineWidth',15); set(gca,'visible','off'); set(gcf,'Position',[100 100 500 250]);
  239. exportgraphics(gcf,fullfile(saveFolder,'L4_KO_Barrel_spikes.png'),"Resolution",600);
  240. % Figure 4B - Septa
  241. figure, bar(smooth(mean(temp_L4_ko_septa),3),3,'FaceColor',...
  242. colorSeptaKO,'LineWidth',15); set(gca,'visible','off'); set(gcf,'Position',[100 100 500 250]);
  243. exportgraphics(gcf,fullfile(saveFolder,'L4_KO_Septa_spikes.png'),"Resolution",600);
  244. % Figure 4B - Neighbour
  245. figure, bar(smooth(mean(temp_L4_KO_neigh),3),3,'FaceColor',...
  246. colorNeighKO,'LineWidth',15); set(gca,'visible','off'); set(gcf,'Position',[100 100 500 250]);
  247. exportgraphics(gcf,fullfile(saveFolder,'L4_KO_Neighbour_spikes.png'),"Resolution",600);
  248. % Figure 1 Figure Supplement 3B - Barrel
  249. figure , bar(mean(temp_L23_WT_MW),2,'FaceColor',colorBarrel,'LineWidth',15);
  250. set(gca,'visible','off'); set(gcf,'Position',[100 100 500 250]);
  251. exportgraphics(gcf,fullfile(saveFolder,'L23_WT_Barrel_spikes_MW.png'),"Resolution",600);
  252. % Figure 1 Figure Supplement 3B - Septa
  253. figure, bar(smooth(mean(temp_L23_WT_MW_septa),3),3,'FaceColor',...
  254. colorSepta,'LineWidth',15); set(gca,'visible','off'); set(gcf,'Position',[100 100 500 250]);
  255. exportgraphics(gcf,fullfile(saveFolder,'L23_WT_Septa_spikes_MW.png'),"Resolution",600);
  256. % Figure 1F - Barrel
  257. figure , bar(smooth(mean(temp_L4_WT_MW),3),3,'FaceColor',...
  258. colorBarrel,'LineWidth',15); set(gca,'visible','off'); set(gcf,'Position',[100 100 500 250]);
  259. exportgraphics(gcf,fullfile(saveFolder,'L4_WT_Barrel_spikes_MW.png'),"Resolution",600);
  260. % Figure 1F - Septa
  261. figure, bar(smooth(mean(temp_L4_WT_MW_septa),3),3,'FaceColor',...
  262. colorSepta,'LineWidth',15); set(gca,'visible','off'); set(gcf,'Position',[100 100 500 250]);
  263. exportgraphics(gcf,fullfile(saveFolder,'L4_WT_Septa_spikes_MW.png'),"Resolution",600);
  264. % Figure 4D - Barrel
  265. figure , bar(smooth(mean(temp_L4_KO_MW),3),3,'FaceColor',...
  266. colorBarrelKO,'LineWidth',15); set(gca,'visible','off'); set(gcf,'Position',[100 100 500 250]);
  267. exportgraphics(gcf,fullfile(saveFolder,'L4_KO_Barrel_spikes_MW.png'),"Resolution",600);
  268. % Figure 4D - Septa
  269. figure, bar(smooth(mean(temp_L4_KO_MW_septa),3),3,'FaceColor',...
  270. colorSeptaKO,'LineWidth',15); set(gca,'visible','off'); set(gcf,'Position',[100 100 500 250]);
  271. exportgraphics(gcf,fullfile(saveFolder,'L4_KO_Septa_spikes_MW.png'),"Resolution",600);
  272. % Data Rearrabgement
  273. clear stimtrials_L23_WT;
  274. clear stimtrialsAverage_L23_WT;
  275. clear diff_stimtrialsAverage_L23_WT;
  276. % figure; hold on;
  277. rgbColors = zeros(3,20);
  278. rgbColors(3,:) = linspace(1,255,20)/255;
  279. rgbColors(2,:) = linspace(1,155,20)/255;
  280. for s = 1:20
  281. stimtrials_L23_WT(:,:,s) = temp_L23_WT(:,beglocs(s):beglocs(s)+94);
  282. stimtrials_L4_WT(:,:,s) = temp_L4_WT(:,beglocs(s):beglocs(s)+94);
  283. stimtrials_L5_WT(:,:,s) = temp_L5_WT(:,beglocs(s):beglocs(s)+94);
  284. stimtrials_L23_WT_septa(:,:,s) = temp_L23_WT_septa(:,beglocs(s):beglocs(s)+94);
  285. stimtrials_L4_WT_septa(:,:,s) = temp_L4_WT_septa(:,beglocs(s):beglocs(s)+94);
  286. stimtrials_L5_WT_septa(:,:,s) = temp_L5_WT_septa(:,beglocs(s):beglocs(s)+94);
  287. stimtrials_L23_WT_neigh(:,:,s) = temp_L23_WT_neigh(:,beglocs(s):beglocs(s)+94);
  288. stimtrials_L4_WT_neigh(:,:,s) = temp_L4_WT_neigh(:,beglocs(s):beglocs(s)+94);
  289. stimtrials_L5_WT_neigh(:,:,s) = temp_L5_WT_neigh(:,beglocs(s):beglocs(s)+94);
  290. stimtrials_L23_KO(:,:,s) = temp_L23_ko(:,beglocs(s):beglocs(s)+94);
  291. stimtrials_L4_KO(:,:,s) = temp_L4_ko(:,beglocs(s):beglocs(s)+94);
  292. stimtrials_L5_KO(:,:,s) = temp_L5_ko(:,beglocs(s):beglocs(s)+94);
  293. stimtrials_L23_KO_septa(:,:,s) = temp_L23_ko_septa(:,beglocs(s):beglocs(s)+94);
  294. stimtrials_L4_KO_septa(:,:,s) = temp_L4_ko_septa(:,beglocs(s):beglocs(s)+94);
  295. stimtrials_L5_KO_septa(:,:,s) = temp_L5_ko_septa(:,beglocs(s):beglocs(s)+94);
  296. stimtrials_L23_KO_neigh(:,:,s) = temp_L23_KO_neigh(:,beglocs(s):beglocs(s)+94);
  297. stimtrials_L4_KO_neigh(:,:,s) = temp_L4_KO_neigh(:,beglocs(s):beglocs(s)+94);
  298. stimtrials_L5_KO_neigh(:,:,s) = temp_L5_KO_neigh(:,beglocs(s):beglocs(s)+94);
  299. end
  300. % Normalized
  301. for s = 1:20
  302. norm_stimtrials_L23_WT(:,:,s) = temp_L23_WT(:,beglocs(s):beglocs(s)+94)/max(mean(temp_L23_WT(:,201:230)));
  303. norm_stimtrials_L4_WT(:,:,s) = temp_L4_WT(:,beglocs(s):beglocs(s)+94)/max(mean(temp_L4_WT(:,201:230)));
  304. norm_stimtrials_L5_WT(:,:,s) = temp_L5_WT(:,beglocs(s):beglocs(s)+94)/max(mean(temp_L5_WT(:,201:230)));
  305. norm_stimtrials_L23_WT_septa(:,:,s) = temp_L23_WT_septa(:,beglocs(s):beglocs(s)+94)/max(mean(temp_L23_WT_septa(:,201:230)));
  306. norm_stimtrials_L4_WT_septa(:,:,s) = temp_L4_WT_septa(:,beglocs(s):beglocs(s)+94)/max(mean(temp_L4_WT_septa(:,201:230)));
  307. norm_stimtrials_L5_WT_septa(:,:,s) = temp_L5_WT_septa(:,beglocs(s):beglocs(s)+94)/max(mean(temp_L5_WT_septa(:,201:230)));
  308. norm_stimtrials_L23_WT_neigh(:,:,s) = temp_L23_WT_neigh(:,beglocs(s):beglocs(s)+94)/max(mean(temp_L23_WT_neigh(:,201:230)));
  309. norm_stimtrials_L4_WT_neigh(:,:,s) = temp_L4_WT_neigh(:,beglocs(s):beglocs(s)+94)/max(mean(temp_L4_WT_neigh(:,201:230)));
  310. norm_stimtrials_L5_WT_neigh(:,:,s) = temp_L5_WT_neigh(:,beglocs(s):beglocs(s)+94)/max(mean(temp_L5_WT_neigh(:,201:230)));
  311. norm_stimtrials_L23_KO(:,:,s) = temp_L23_ko(:,beglocs(s):beglocs(s)+94)/max(mean(temp_L23_ko(:,201:230)));
  312. norm_stimtrials_L4_KO(:,:,s) = temp_L4_ko(:,beglocs(s):beglocs(s)+94)/max(mean(temp_L4_ko(:,201:230)));
  313. norm_stimtrials_L5_KO(:,:,s) = temp_L5_ko(:,beglocs(s):beglocs(s)+94)/max(mean(temp_L5_ko(:,201:230)));
  314. norm_stimtrials_L23_KO_septa(:,:,s) = temp_L23_ko_septa(:,beglocs(s):beglocs(s)+94)/max(mean(temp_L23_ko_septa(:,201:230)));
  315. norm_stimtrials_L4_KO_septa(:,:,s) = temp_L4_ko_septa(:,beglocs(s):beglocs(s)+94)/max(mean(temp_L4_ko_septa(:,201:230)));
  316. norm_stimtrials_L5_KO_septa(:,:,s) = temp_L5_ko_septa(:,beglocs(s):beglocs(s)+94)/max(mean(temp_L5_ko_septa(:,201:230)));
  317. norm_stimtrials_L23_KO_neigh(:,:,s) = temp_L23_KO_neigh(:,beglocs(s):beglocs(s)+94)/max(mean(temp_L23_KO_neigh(:,201:230)));
  318. norm_stimtrials_L4_KO_neigh(:,:,s) = temp_L4_KO_neigh(:,beglocs(s):beglocs(s)+94)/max(mean(temp_L4_KO_neigh(:,201:230)));
  319. norm_stimtrials_L5_KO_neigh(:,:,s) = temp_L5_KO_neigh(:,beglocs(s):beglocs(s)+94)/max(mean(temp_L5_KO_neigh(:,201:230)));
  320. end
  321. % MW
  322. for s = 1:20
  323. %
  324. stimtrials_MW_L23_WT(:,:,s) = temp_L23_WT_MW(:,beglocs(s):beglocs(s)+94);
  325. stimtrials_MW_L4_WT(:,:,s) = temp_L4_WT_MW(:,beglocs(s):beglocs(s)+94);
  326. stimtrials_MW_L5_WT(:,:,s) = temp_L5_WT_MW(:,beglocs(s):beglocs(s)+94);
  327. stimtrials_MW_L23_WT_septa(:,:,s) = temp_L23_WT_MW_septa(:,beglocs(s):beglocs(s)+94);
  328. stimtrials_MW_L4_WT_septa(:,:,s) = temp_L4_WT_MW_septa(:,beglocs(s):beglocs(s)+94);
  329. stimtrials_MW_L5_WT_septa(:,:,s) = temp_L5_WT_MW_septa(:,beglocs(s):beglocs(s)+94);
  330. stimtrials_MW_L23_KO(:,:,s) = temp_L23_KO_MW(:,beglocs(s):beglocs(s)+94);
  331. stimtrials_MW_L4_KO(:,:,s) = temp_L4_KO_MW(:,beglocs(s):beglocs(s)+94);
  332. stimtrials_MW_L5_KO(:,:,s) = temp_L5_KO_MW(:,beglocs(s):beglocs(s)+94);
  333. stimtrials_MW_L23_KO_septa(:,:,s) = temp_L23_KO_MW_septa(:,beglocs(s):beglocs(s)+94);
  334. stimtrials_MW_L4_KO_septa(:,:,s) = temp_L4_KO_MW_septa(:,beglocs(s):beglocs(s)+94);
  335. stimtrials_MW_L5_KO_septa(:,:,s) = temp_L5_KO_MW_septa(:,beglocs(s):beglocs(s)+94);
  336. end
  337. %% Peak Comparison L2/3 WT
  338. % Figure 1D Figure Supplement 3A - Image - Barrel
  339. figure; set(gcf,'Position',[100 100 350 300]);
  340. imagesc(squeeze(mean(stimtrials_L23_WT,1))',[0 0.35]);
  341. colormap turbo; colorbar;
  342. colorbar('Ticks',[0 0.1 0.2 0.3 0.4],'TickLabels',{'0','0.1','0.2','0.3','0.4'});
  343. xlabel('Time (ms)','FontSize',18); xticks([1 20 40 60 80]);
  344. set(gca,'FontSize',18); set(gca,'TickDir','out');
  345. ylabel('Pulse Number','FontSize',18); yticks([1 5 10 15 20]);
  346. exportgraphics(gcf,fullfile(saveFolder,'L23_Barrel_WT_Image.png'),"Resolution",600);
  347. % Figure 1D Figure Supplement 3A - Image - Septa
  348. figure; set(gcf,'Position',[100 100 500 300]);
  349. imagesc(squeeze(mean(stimtrials_L23_WT_septa,1))',[0 0.35]);
  350. colormap turbo; colorbar;
  351. colorbar('Ticks',[0 0.1 0.2 0.3 0.4],'TickLabels',{'0','0.1','0.2','0.3','0.4'});
  352. xlabel('Time (ms)','FontSize',24); xticks([1 20 40 60 80]);
  353. set(gca,'FontSize',24); set(gca,'TickDir','out');
  354. ylabel('Pulse Number','FontSize',22); yticks([1 5 10 15 20]);
  355. exportgraphics(gcf,fullfile(saveFolder,'L23_Septa_WT_Image.png'),"Resolution",600);
  356. % Figure 1D - Image - Barrel
  357. figure; set(gcf,'Position',[100 100 350 300]);
  358. imagesc(squeeze(mean(stimtrials_L4_WT,1))',[0 0.35]);
  359. colormap turbo; colorbar;
  360. colorbar('Ticks',[0 0.1 0.2 0.3 0.4],'TickLabels',{'0','0.1','0.2','0.3','0.4'});
  361. xlabel('Time (ms)','FontSize',18); xticks([1 20 40 60 80]);
  362. set(gca,'FontSize',18); set(gca,'TickDir','out');
  363. ylabel('Pulse Number','FontSize',18); yticks([1 5 10 15 20]);
  364. exportgraphics(gcf,fullfile(saveFolder,'L4_Barrel_WT_Image.png'),"Resolution",600);
  365. % Figure 1D - Image - Septa
  366. figure; set(gcf,'Position',[100 100 350 300]);
  367. imagesc(squeeze(mean(stimtrials_L4_WT_septa,1))',[0 0.35]);
  368. colormap turbo; colorbar;
  369. colorbar('Ticks',[0 0.1 0.2 0.3 0.4],'TickLabels',{'0','0.1','0.2','0.3','0.4'});
  370. xlabel('Time (ms)','FontSize',18); xticks([1 20 40 60 80]);
  371. set(gca,'FontSize',18); set(gca,'TickDir','out');
  372. ylabel('Pulse Number','FontSize',18); yticks([1 5 10 15 20]);
  373. exportgraphics(gcf,fullfile(saveFolder,'L4_Septa_WT_Image.png'),"Resolution",600);
  374. % Figure 1D - Image - Neighbour
  375. figure; set(gcf,'Position',[100 100 350 300]);
  376. imagesc(squeeze(mean(stimtrials_L4_WT_neigh,1))',[0 0.35]);
  377. colormap turbo; colorbar;
  378. colorbar('Ticks',[0 0.1 0.2 0.3 0.4],'TickLabels',{'0','0.1','0.2','0.3','0.4'});
  379. xlabel('Time (ms)','FontSize',18); xticks([1 20 40 60 80]);
  380. set(gca,'FontSize',18); set(gca,'TickDir','out');
  381. ylabel('Pulse Number','FontSize',18); yticks([1 5 10 15 20]);
  382. exportgraphics(gcf,fullfile(saveFolder,'L4_Neigh_WT_Image.png'),"Resolution",600);
  383. % Figure 4B - Image - Barrel
  384. figure; set(gcf,'Position',[100 100 350 300]);
  385. imagesc(squeeze(mean(stimtrials_L4_KO,1))',[0 0.35]);
  386. colormap turbo; colorbar;
  387. colorbar('Ticks',[0 0.1 0.2 0.3 0.4],'TickLabels',{'0','0.1','0.2','0.3','0.4'});
  388. xlabel('Time (ms)','FontSize',18); xticks([1 20 40 60 80]);
  389. set(gca,'FontSize',18); set(gca,'TickDir','out');
  390. ylabel('Pulse Number','FontSize',18); yticks([1 5 10 15 20]);
  391. exportgraphics(gcf,fullfile(saveFolder,'L4_Barrel_KO_Image.png'),"Resolution",600);
  392. % Figure 4B - Image - Septa
  393. figure; set(gcf,'Position',[100 100 350 300]);
  394. imagesc(squeeze(mean(stimtrials_L4_KO_septa,1))',[0 0.35]);
  395. colormap turbo; colorbar;
  396. colorbar('Ticks',[0 0.1 0.2 0.3 0.4],'TickLabels',{'0','0.1','0.2','0.3','0.4'});
  397. xlabel('Time (ms)','FontSize',18); xticks([1 20 40 60 80]);
  398. set(gca,'FontSize',18); set(gca,'TickDir','out');
  399. ylabel('Pulse Number','FontSize',18); yticks([1 5 10 15 20]);
  400. exportgraphics(gcf,fullfile(saveFolder,'L4_Septa_KO_Image.png'),"Resolution",600);
  401. % Figure 4B - Image - Neighbour
  402. figure; set(gcf,'Position',[100 100 350 300]);
  403. imagesc(squeeze(mean(stimtrials_L4_KO_neigh,1))',[0 0.35]);
  404. colormap turbo; colorbar;
  405. colorbar('Ticks',[0 0.1 0.2 0.3 0.4],'TickLabels',{'0','0.1','0.2','0.3','0.4'});
  406. xlabel('Time (ms)','FontSize',18); xticks([1 20 40 60 80]);
  407. set(gca,'FontSize',18); set(gca,'TickDir','out');
  408. ylabel('Pulse Number','FontSize',18); yticks([1 5 10 15 20]);
  409. exportgraphics(gcf,fullfile(saveFolder,'L4_Neigh_KO_Image.png'),"Resolution",600);
  410. % Figure 1 Figure Supplement 3B - Image - Barrel
  411. figure; set(gcf,'Position',[100 100 500 300]);
  412. imagesc(squeeze(mean(stimtrials_MW_L23_WT,1))',[0 0.35]);
  413. colormap turbo; colorbar;
  414. colorbar('Ticks',[0 0.1 0.2 0.3 0.4],'TickLabels',{'0','0.1','0.2','0.3','0.4'});
  415. xlabel('Time (ms)','FontSize',24); xticks([1 20 40 60 80]);
  416. set(gca,'FontSize',24); set(gca,'TickDir','out');
  417. ylabel('Pulse Number','FontSize',22); yticks([1 5 10 15 20]);
  418. exportgraphics(gcf,fullfile(saveFolder,'L23_Barrel_WT_Image_MW.png'),"Resolution",600);
  419. % Figure 1 Figure Supplement 3B - Image - Septa
  420. figure; set(gcf,'Position',[100 100 500 300]);
  421. imagesc(squeeze(mean(stimtrials_MW_L23_WT_septa,1))',[0 0.35]);
  422. colormap turbo; colorbar;
  423. colorbar('Ticks',[0 0.1 0.2 0.3 0.4],'TickLabels',{'0','0.1','0.2','0.3','0.4'});
  424. xlabel('Time (ms)','FontSize',24); xticks([1 20 40 60 80]);
  425. set(gca,'FontSize',24); set(gca,'TickDir','out');
  426. ylabel('Pulse Number','FontSize',22); yticks([1 5 10 15 20]);
  427. exportgraphics(gcf,fullfile(saveFolder,'L23_Septa_WT_Image_MW.png'),"Resolution",600);
  428. % Figure 1F - Image - Barrel
  429. figure; set(gcf,'Position',[100 100 350 300]);
  430. imagesc(squeeze(mean(stimtrials_MW_L4_WT,1))',[0 0.35]);
  431. colormap turbo; colorbar;
  432. colorbar('Ticks',[0 0.1 0.2 0.3 0.4],'TickLabels',{'0','0.1','0.2','0.3','0.4'});
  433. xlabel('Time (ms)','FontSize',18); xticks([1 20 40 60 80]);
  434. set(gca,'FontSize',18); set(gca,'TickDir','out');
  435. ylabel('Pulse Number','FontSize',18); yticks([1 5 10 15 20]);
  436. exportgraphics(gcf,fullfile(saveFolder,'L4_Barrel_WT_Image_MW.png'),"Resolution",600);
  437. % Figure 1F - Image - Septa
  438. figure; set(gcf,'Position',[100 100 350 300]);
  439. imagesc(squeeze(mean(stimtrials_MW_L4_WT_septa,1))',[0 0.35]);
  440. colormap turbo; colorbar;
  441. colorbar('Ticks',[0 0.1 0.2 0.3 0.4],'TickLabels',{'0','0.1','0.2','0.3','0.4'});
  442. xlabel('Time (ms)','FontSize',18); xticks([1 20 40 60 80]);
  443. set(gca,'FontSize',18); set(gca,'TickDir','out');
  444. ylabel('Pulse Number','FontSize',18); yticks([1 5 10 15 20]);
  445. exportgraphics(gcf,fullfile(saveFolder,'L4_Septa_WT_Image_MW.png'),"Resolution",600);
  446. % Figure 4D - Image - Barrel
  447. figure; set(gcf,'Position',[100 100 350 300]);
  448. imagesc(squeeze(mean(stimtrials_MW_L4_KO,1))',[0 0.35]);
  449. colormap turbo; colorbar;
  450. colorbar('Ticks',[0 0.1 0.2 0.3 0.4],'TickLabels',{'0','0.1','0.2','0.3','0.4'});
  451. xlabel('Time (ms)','FontSize',18); xticks([1 20 40 60 80]);
  452. set(gca,'FontSize',18); set(gca,'TickDir','out');
  453. ylabel('Pulse Number','FontSize',18); yticks([1 5 10 15 20]);
  454. exportgraphics(gcf,fullfile(saveFolder,'L4_Barrel_KO_Image_MW.png'),"Resolution",600);
  455. % Figure 4D - Image - Septa
  456. figure; set(gcf,'Position',[100 100 350 300]);
  457. imagesc(squeeze(mean(stimtrials_MW_L4_KO_septa,1))',[0 0.35]);
  458. colormap turbo; colorbar;
  459. colorbar('Ticks',[0 0.1 0.2 0.3 0.4],'TickLabels',{'0','0.1','0.2','0.3','0.4'});
  460. xlabel('Time (ms)','FontSize',18); xticks([1 20 40 60 80]);
  461. set(gca,'FontSize',18); set(gca,'TickDir','out');
  462. ylabel('Pulse Number','FontSize',18); yticks([1 5 10 15 20]);
  463. exportgraphics(gcf,fullfile(saveFolder,'L4_Septa_KO_Image_MW.png'),"Resolution",600);
  464. %% MW/SW Extraction
  465. for i = 1:size(temp_L4_WT,1)
  466. temp_L4_WT_smooth(i,:) = smooth(temp_L4_WT(i,:),3);
  467. temp_L4_WT_MW_smooth(i,:) = smooth(temp_L4_WT_MW(i,:),3);
  468. end
  469. c = 1;
  470. for t = 1:20:size(temp_L4_WT,1)
  471. temp_L4_WT_smooth_trials(c,:) = mean(temp_L4_WT_smooth(t:t+19,:),1);
  472. temp_L4_WT_MW_smooth_trials(c,:) = mean(temp_L4_WT_MW_smooth(t:t+19,:),1);
  473. c = c + 1;
  474. end
  475. for i = 1:size(temp_L4_WT_septa,1)
  476. temp_L4_WT_septa_smooth(i,:) = smooth(temp_L4_WT_septa(i,:),3);
  477. temp_L4_WT_MW_septa_smooth(i,:) = smooth(temp_L4_WT_MW_septa(i,:),3);
  478. end
  479. c = 1;
  480. for t = 1:20:size(temp_L4_WT_septa,1)
  481. temp_L4_WT_septa_smooth_trials(c,:) = mean(temp_L4_WT_septa_smooth(t:t+19,:),1);
  482. temp_L4_WT_MW_septa_smooth_trials(c,:) = mean(temp_L4_WT_MW_septa_smooth(t:t+19,:),1);
  483. c = c + 1;
  484. end
  485. for b = 1:size(temp_L4_WT_smooth_trials,1)
  486. for s = 1:20
  487. L4_WT_SW_Barrel_Max(b,s) = trapz(nanmean(temp_L4_WT_smooth_trials(b,beglocs(s):beglocs(s)+49),1));
  488. L4_WT_MW_Barrel_Max(b,s) = trapz(nanmean(temp_L4_WT_MW_smooth_trials(b,beglocs(s):beglocs(s)+49),1));
  489. end
  490. end
  491. for b = 1:size(temp_L4_WT_septa_smooth_trials,1)
  492. for s = 1:20
  493. L4_WT_SW_Septa_Max(b,s) = trapz(nanmean(temp_L4_WT_septa_smooth_trials(b,beglocs(s):beglocs(s)+49),1));
  494. L4_WT_MW_Septa_Max(b,s) = trapz(nanmean(temp_L4_WT_MW_septa_smooth_trials(b,beglocs(s):beglocs(s)+49),1));
  495. end
  496. end
  497. L4_WT_MW_div_SW_Barrel_mean = 100*mean(L4_WT_MW_Barrel_Max./L4_WT_SW_Barrel_Max);
  498. L4_WT_MW_div_SW_Barrel_sem = 100*std(L4_WT_MW_Barrel_Max./L4_WT_SW_Barrel_Max,[],1)/sqrt(size(L4_WT_MW_Barrel_Max,1));
  499. L4_WT_MW_div_SW_Septa_mean = 100*mean(L4_WT_MW_Septa_Max./L4_WT_SW_Septa_Max);
  500. L4_WT_MW_div_SW_Septa_sem = 100*std(L4_WT_MW_Septa_Max./L4_WT_SW_Septa_Max,[],1)/sqrt(size(L4_WT_MW_Septa_Max,1));
  501. for i = 1:size(temp_L4_ko,1)
  502. temp_L4_KO_smooth(i,:) = smooth(temp_L4_ko(i,:),3);
  503. temp_L4_KO_MW_smooth(i,:) = smooth(temp_L4_KO_MW(i,:),3);
  504. end
  505. c = 1;
  506. for t = 1:20:size(temp_L4_ko,1)
  507. temp_L4_KO_smooth_trials(c,:) = mean(temp_L4_KO_smooth(t:t+19,:),1);
  508. temp_L4_KO_MW_smooth_trials(c,:) = mean(temp_L4_KO_MW_smooth(t:t+19,:),1);
  509. c = c + 1;
  510. end
  511. for i = 1:size(temp_L4_ko_septa,1)
  512. temp_L4_KO_septa_smooth(i,:) = smooth(temp_L4_ko_septa(i,:),3);
  513. temp_L4_KO_MW_septa_smooth(i,:) = smooth(temp_L4_KO_MW_septa(i,:),3);
  514. end
  515. c = 1;
  516. for t = 1:20:size(temp_L4_ko_septa,1)
  517. temp_L4_KO_septa_smooth_trials(c,:) = mean(temp_L4_KO_septa_smooth(t:t+19,:),1);
  518. temp_L4_KO_MW_septa_smooth_trials(c,:) = mean(temp_L4_KO_MW_septa_smooth(t:t+19,:),1);
  519. c = c + 1;
  520. end
  521. for b = 1:size(temp_L4_KO_smooth_trials,1)
  522. for s = 1:20
  523. L4_KO_SW_Barrel_Max(b,s) = trapz(nanmean(temp_L4_KO_smooth_trials(b,beglocs(s):beglocs(s)+49),1));
  524. L4_KO_MW_Barrel_Max(b,s) = trapz(nanmean(temp_L4_KO_MW_smooth_trials(b,beglocs(s):beglocs(s)+49),1));
  525. end
  526. end
  527. for b = 1:size(temp_L4_KO_septa_smooth_trials,1)
  528. for s = 1:20
  529. L4_KO_SW_Septa_Max(b,s) = trapz(nanmean(temp_L4_KO_septa_smooth_trials(b,beglocs(s):beglocs(s)+49),1));
  530. L4_KO_MW_Septa_Max(b,s) = trapz(nanmean(temp_L4_KO_MW_septa_smooth_trials(b,beglocs(s):beglocs(s)+49),1));
  531. end
  532. end
  533. L4_KO_MW_div_SW_Barrel_mean = 100*mean(L4_KO_MW_Barrel_Max./L4_KO_SW_Barrel_Max);
  534. L4_KO_MW_div_SW_Barrel_sem = 100*std(L4_KO_MW_Barrel_Max./L4_KO_SW_Barrel_Max,[],1)/sqrt(size(L4_KO_MW_Barrel_Max,1));
  535. L4_KO_MW_div_SW_Septa_mean = 100*mean(L4_KO_MW_Septa_Max./L4_KO_SW_Septa_Max);
  536. L4_KO_MW_div_SW_Septa_sem = 100*std(L4_KO_MW_Septa_Max./L4_KO_SW_Septa_Max,[],1)/sqrt(size(L4_KO_MW_Septa_Max,1));
  537. % Figure 1H
  538. figure; set(gcf,'Position',[500 500 610 400]);
  539. hold on; errorbar(1:20,L4_WT_MW_div_SW_Barrel_mean,L4_WT_MW_div_SW_Barrel_sem,'LineWidth',3,'Color',colorBarrel);
  540. hold on; errorbar(1:20,L4_WT_MW_div_SW_Septa_mean,L4_WT_MW_div_SW_Septa_sem,'LineWidth',3,'Color',colorSepta);
  541. plot(1:20,100*ones(1,20),'--','Color',[.1 .1 .1]);
  542. xlim([0 21]); ylim([50 225]);
  543. yticks(0:50:250);
  544. xticks([1:20]); ylabel('AUC_{MW}/AUC_{SW}','FontWeight','normal'); xlabel('Pulse Number','FontSize',22);
  545. set(gca,'FontSize',18); set(gca,'TickDir','out');
  546. legend('Barrel WT','Septa WT','Location','NorthWest');
  547. title('L4 Multi/Single','FontWeight','normal');
  548. exportgraphics(gcf,fullfile(saveFolder,'L4_WT_MW_div_SW_Barrel.png'),"Resolution",600);
  549. % Figure 4F
  550. figure; set(gcf,'Position',[500 500 610 400]);
  551. hold on; errorbar(1:20,L4_KO_MW_div_SW_Barrel_mean,L4_KO_MW_div_SW_Barrel_sem,'LineWidth',3,'Color',colorBarrelKO);
  552. hold on; errorbar(1:20,L4_KO_MW_div_SW_Septa_mean,L4_KO_MW_div_SW_Septa_sem,'LineWidth',3,'Color',colorSeptaKO);
  553. plot(1:20,100*ones(1,20),'--','Color',[.1 .1 .1]);
  554. xlim([0 21]); ylim([50 225]);
  555. yticks(0:50:250);
  556. xticks([1:20]); ylabel('AUC_{MW}/AUC_{SW}','FontWeight','normal'); xlabel('Pulse Number','FontSize',22);
  557. set(gca,'FontSize',18); set(gca,'TickDir','out');
  558. legend('Barrel KO','Septa KO','Location','NorthWest');
  559. title('L4 Multi/Single','FontWeight','normal');
  560. exportgraphics(gcf,fullfile(saveFolder,'L4_KO_MW_div_SW_Barrel.png'),"Resolution",600);
  561. % Figure 1I - 1-20 Pulses
  562. all_L4_WT_ratio_Barrel = 100*mean(L4_WT_MW_Barrel_Max./L4_WT_SW_Barrel_Max,2);
  563. all_L4_WT_ratio_Septa = 100*mean(L4_WT_MW_Septa_Max./L4_WT_SW_Septa_Max,2);
  564. all_L4_KO_ratio_Barrel = 100*mean(L4_KO_MW_Barrel_Max./L4_KO_SW_Barrel_Max,2);
  565. all_L4_KO_ratio_Septa = 100*mean(L4_KO_MW_Septa_Max./L4_KO_SW_Septa_Max,2);
  566. t1 = all_L4_WT_ratio_Barrel;
  567. t2 = all_L4_WT_ratio_Septa;
  568. ranksum((t1),(t2))
  569. ranksum(rmoutliers(t1),rmoutliers(t2))
  570. figure; set(gcf,'Position',[1200 100 300 400]); hold on;
  571. bar(1, mean(t1), 'FaceColor', colorBarrel, 'EdgeColor', 'none', 'BarWidth', 0.6);
  572. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  573. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrel/2);
  574. bar(2, mean(t2), 'FaceColor', colorSepta, 'EdgeColor', 'none', 'BarWidth', 0.6);
  575. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  576. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSepta/2);
  577. hold on; plot([1 2],[200 200],'LineWidth',3,'Color','k');
  578. text(1.5,205,'*','HorizontalAlignment','center','FontSize',48);
  579. axis([0.5 2.5 0 270]);
  580. yticks(0:50:250);
  581. xticks([1 2]); xticklabels({'B' 'S'}); ylabel('AUC(MW/SW)%'); title('1-20');
  582. set(gca,'FontSize',30); set(gca,'TickDir','out');
  583. exportgraphics(gcf,fullfile(saveFolder,'L4_WT_MW_div_SW_Barrel_Septa_AllPulses.png'),"Resolution",600);
  584. % Figure 4G - 1-20 Pulses
  585. t1 = all_L4_KO_ratio_Barrel;
  586. t2 = all_L4_KO_ratio_Septa;
  587. ranksum((t1),(t2))
  588. ranksum(rmoutliers(t1),rmoutliers(t2))
  589. figure; set(gcf,'Position',[1200 100 300 400]); hold on;
  590. bar(1, mean(t1), 'FaceColor', colorBarrelKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  591. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  592. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrelKO/2);
  593. bar(2, mean(t2), 'FaceColor', colorSeptaKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  594. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  595. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSeptaKO/2);
  596. axis([0.5 2.5 0 270]);
  597. yticks(0:50:250);
  598. xticks([1 2]); xticklabels({'B' 'S'}); ylabel('AUC(MW/SW)%'); title('1-20');
  599. set(gca,'FontSize',30); set(gca,'TickDir','out');
  600. exportgraphics(gcf,fullfile(saveFolder,'L4_KO_MW_div_SW_Barrel_Septa_AllPulses.png'),"Resolution",600);
  601. % Figure 1I - 1-6 Pulses
  602. all_L4_WT_ratio_Barrel = 100*mean(L4_WT_MW_Barrel_Max(:,1:6)./L4_WT_SW_Barrel_Max(:,1:6),2);
  603. all_L4_WT_ratio_Septa = 100*mean(L4_WT_MW_Septa_Max(:,1:6)./L4_WT_SW_Septa_Max(:,1:6),2);
  604. all_L4_KO_ratio_Barrel = 100*mean(L4_KO_MW_Barrel_Max(:,1:6)./L4_KO_SW_Barrel_Max(:,1:6),2);
  605. all_L4_KO_ratio_Septa = 100*mean(L4_KO_MW_Septa_Max(:,1:6)./L4_KO_SW_Septa_Max(:,1:6),2);
  606. t1 = all_L4_WT_ratio_Barrel;
  607. t2 = all_L4_WT_ratio_Septa;
  608. ranksum((t1),(t2))
  609. ranksum(rmoutliers(t1),rmoutliers(t2))
  610. figure; set(gcf,'Position',[1200 100 300 400]); hold on;
  611. bar(1, mean(t1), 'FaceColor', colorBarrel, 'EdgeColor', 'none', 'BarWidth', 0.6);
  612. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  613. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrel/2);
  614. bar(2, mean(t2), 'FaceColor', colorSepta, 'EdgeColor', 'none', 'BarWidth', 0.6);
  615. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  616. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSepta/2);
  617. axis([0.5 2.5 0 270]);
  618. yticks(0:50:250);
  619. xticks([1 2]); xticklabels({'B' 'S'}); ylabel('AUC(MW/SW)%'); title('1-6');
  620. set(gca,'FontSize',30); set(gca,'TickDir','out');
  621. exportgraphics(gcf,fullfile(saveFolder,'L4_WT_MW_div_SW_Barrel_Septa_Pulses1_6.png'),"Resolution",600);
  622. % Figure 4G - 1-6 Pulses
  623. t1 = all_L4_KO_ratio_Barrel;
  624. t2 = all_L4_KO_ratio_Septa;
  625. ranksum((t1),(t2))
  626. ranksum(rmoutliers(t1),rmoutliers(t2))
  627. figure; set(gcf,'Position',[1200 100 300 400]); hold on;
  628. bar(1, mean(t1), 'FaceColor', colorBarrelKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  629. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  630. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrelKO/2);
  631. bar(2, mean(t2), 'FaceColor', colorSeptaKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  632. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  633. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSeptaKO/2);
  634. axis([0.5 2.5 0 270]);
  635. yticks(0:50:250);
  636. xticks([1 2]); xticklabels({'B' 'S'}); ylabel('AUC(MW/SW)%'); title('1-6');
  637. set(gca,'FontSize',30); set(gca,'TickDir','out');
  638. exportgraphics(gcf,fullfile(saveFolder,'L4_KO_MW_div_SW_Barrel_Septa_Pulses1_6.png'),"Resolution",600);
  639. % Figure 1I - 7-20 Pulses
  640. all_L4_WT_ratio_Barrel = 100*mean(L4_WT_MW_Barrel_Max(:,7:20)./L4_WT_SW_Barrel_Max(:,7:20),2);
  641. all_L4_WT_ratio_Septa = 100*mean(L4_WT_MW_Septa_Max(:,7:20)./L4_WT_SW_Septa_Max(:,7:20),2);
  642. all_L4_KO_ratio_Barrel = 100*mean(L4_KO_MW_Barrel_Max(:,7:20)./L4_KO_SW_Barrel_Max(:,7:20),2);
  643. all_L4_KO_ratio_Septa = 100*mean(L4_KO_MW_Septa_Max(:,7:20)./L4_KO_SW_Septa_Max(:,7:20),2);
  644. t1 = all_L4_WT_ratio_Barrel;
  645. t2 = all_L4_WT_ratio_Septa;
  646. ranksum((t1),(t2))
  647. ranksum(rmoutliers(t1),rmoutliers(t2))
  648. figure; set(gcf,'Position',[1200 100 300 400]); hold on;
  649. bar(1, mean(t1), 'FaceColor', colorBarrel, 'EdgeColor', 'none', 'BarWidth', 0.6);
  650. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  651. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrel/2);
  652. bar(2, mean(t2), 'FaceColor', colorSepta, 'EdgeColor', 'none', 'BarWidth', 0.6);
  653. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  654. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSepta/2);
  655. hold on; plot([1 2],[200 200],'LineWidth',3,'Color','k');
  656. text(1.5,205,'**','HorizontalAlignment','center','FontSize',48);
  657. axis([0.5 2.5 0 270]);
  658. yticks(0:50:250);
  659. xticks([1 2]); xticklabels({'B' 'S'}); ylabel('AUC(MW/SW)%'); title('7-20');
  660. set(gca,'FontSize',30); set(gca,'TickDir','out');
  661. exportgraphics(gcf,fullfile(saveFolder,'L4_WT_MW_div_SW_Barrel_Septa_Pulses7_20.png'),"Resolution",600);
  662. % Figure 4G - 7-20 Pulses
  663. t1 = all_L4_KO_ratio_Barrel;
  664. t2 = all_L4_KO_ratio_Septa;
  665. ranksum((t1),(t2))
  666. ranksum(rmoutliers(t1),rmoutliers(t2))
  667. figure; set(gcf,'Position',[1200 100 300 400]); hold on;
  668. bar(1, mean(t1), 'FaceColor', colorBarrelKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  669. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  670. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrelKO/2);
  671. bar(2, mean(t2), 'FaceColor', colorSeptaKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  672. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  673. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSeptaKO/2);
  674. axis([0.5 2.5 0 270]);
  675. yticks(0:50:250);
  676. xticks([1 2]); xticklabels({'B' 'S'}); ylabel('AUC(MW/SW)%'); title('7-20');
  677. set(gca,'FontSize',30); set(gca,'TickDir','out');
  678. exportgraphics(gcf,fullfile(saveFolder,'L4_KO_MW_div_SW_Barrel_Septa_Pulses7_20.png'),"Resolution",600);
  679. %% WT L23
  680. for i = 1:size(temp_L23_WT,1)
  681. temp_L23_WT_smooth(i,:) = smooth(temp_L23_WT(i,:),3);
  682. temp_L23_WT_MW_smooth(i,:) = smooth(temp_L23_WT_MW(i,:),3);
  683. end
  684. c = 1;
  685. for t = 1:20:size(temp_L23_WT,1)
  686. temp_L23_WT_smooth_trials(c,:) = mean(temp_L23_WT_smooth(t:t+19,:),1);
  687. temp_L23_WT_MW_smooth_trials(c,:) = mean(temp_L23_WT_MW_smooth(t:t+19,:),1);
  688. c = c + 1;
  689. end
  690. for i = 1:size(temp_L23_WT_septa,1)
  691. temp_L23_WT_septa_smooth(i,:) = smooth(temp_L23_WT_septa(i,:),3);
  692. temp_L23_WT_MW_septa_smooth(i,:) = smooth(temp_L23_WT_MW_septa(i,:),3);
  693. end
  694. c = 1;
  695. for t = 1:20:size(temp_L23_WT_septa,1)
  696. temp_L23_WT_septa_smooth_trials(c,:) = mean(temp_L23_WT_septa_smooth(t:t+19,:),1);
  697. temp_L23_WT_MW_septa_smooth_trials(c,:) = mean(temp_L23_WT_MW_septa_smooth(t:t+19,:),1);
  698. c = c + 1;
  699. end
  700. for b = 1:size(temp_L23_WT_smooth_trials,1)
  701. for s = 1:20
  702. L23_WT_SW_Barrel_Max(b,s) = trapz(nanmean(temp_L23_WT_smooth_trials(b,beglocs(s):beglocs(s)+49),1));
  703. L23_WT_MW_Barrel_Max(b,s) = trapz(nanmean(temp_L23_WT_MW_smooth_trials(b,beglocs(s):beglocs(s)+49),1));
  704. end
  705. end
  706. for b = 1:size(temp_L23_WT_septa_smooth_trials,1)
  707. for s = 1:20
  708. L23_WT_SW_Septa_Max(b,s) = trapz(nanmean(temp_L23_WT_septa_smooth_trials(b,beglocs(s):beglocs(s)+49),1));
  709. L23_WT_MW_Septa_Max(b,s) = trapz(nanmean(temp_L23_WT_MW_septa_smooth_trials(b,beglocs(s):beglocs(s)+49),1));
  710. end
  711. end
  712. % KO L23
  713. for i = 1:size(temp_L23_ko,1)
  714. temp_L23_KO_smooth(i,:) = smooth(temp_L23_ko(i,:),3);
  715. temp_L23_KO_MW_smooth(i,:) = smooth(temp_L23_KO_MW(i,:),3);
  716. end
  717. c = 1;
  718. for t = 1:20:size(temp_L23_ko,1)
  719. temp_L23_KO_smooth_trials(c,:) = mean(temp_L23_KO_smooth(t:t+19,:),1);
  720. temp_L23_KO_MW_smooth_trials(c,:) = mean(temp_L23_KO_MW_smooth(t:t+19,:),1);
  721. c = c + 1;
  722. end
  723. for i = 1:size(temp_L23_ko_septa,1)
  724. temp_L23_KO_septa_smooth(i,:) = smooth(temp_L23_ko_septa(i,:),3);
  725. temp_L23_KO_MW_septa_smooth(i,:) = smooth(temp_L23_KO_MW_septa(i,:),3);
  726. end
  727. c = 1;
  728. for t = 1:20:size(temp_L23_ko_septa,1)
  729. temp_L23_KO_septa_smooth_trials(c,:) = mean(temp_L23_KO_septa_smooth(t:t+19,:),1);
  730. temp_L23_KO_MW_septa_smooth_trials(c,:) = mean(temp_L23_KO_MW_septa_smooth(t:t+19,:),1);
  731. c = c + 1;
  732. end
  733. for b = 1:size(temp_L23_KO_smooth_trials,1)
  734. for s = 1:20
  735. L23_KO_SW_Barrel_Max(b,s) = trapz(nanmean(temp_L23_KO_smooth_trials(b,beglocs(s):beglocs(s)+49),1));
  736. L23_KO_MW_Barrel_Max(b,s) = trapz(nanmean(temp_L23_KO_MW_smooth_trials(b,beglocs(s):beglocs(s)+49),1));
  737. end
  738. end
  739. for b = 1:size(temp_L23_KO_septa_smooth_trials,1)
  740. for s = 1:20
  741. L23_KO_SW_Septa_Max(b,s) = trapz(nanmean(temp_L23_KO_septa_smooth_trials(b,beglocs(s):beglocs(s)+49),1));
  742. L23_KO_MW_Septa_Max(b,s) = trapz(nanmean(temp_L23_KO_MW_septa_smooth_trials(b,beglocs(s):beglocs(s)+49),1));
  743. end
  744. end
  745. L23_WT_MW_div_SW_Barrel_mean = 100*mean(L23_WT_MW_Barrel_Max./L23_WT_SW_Barrel_Max);
  746. L23_WT_MW_div_SW_Barrel_sem = 100*std(L23_WT_MW_Barrel_Max./L23_WT_SW_Barrel_Max,[],1)/sqrt(size(L23_WT_MW_Barrel_Max,1));
  747. L23_WT_MW_div_SW_Septa_mean = 100*mean(L23_WT_MW_Septa_Max./L23_WT_SW_Septa_Max);
  748. L23_WT_MW_div_SW_Septa_sem = 100*std(L23_WT_MW_Septa_Max./L23_WT_SW_Septa_Max,[],1)/sqrt(size(L23_WT_MW_Septa_Max,1));
  749. L23_KO_MW_div_SW_Barrel_mean = 100*mean(L23_KO_MW_Barrel_Max./L23_KO_SW_Barrel_Max);
  750. L23_KO_MW_div_SW_Barrel_sem = 100*std(L23_KO_MW_Barrel_Max./L23_KO_SW_Barrel_Max,[],1)/sqrt(size(L23_KO_MW_Barrel_Max,1));
  751. L23_KO_MW_div_SW_Septa_mean = 100*mean(L23_KO_MW_Septa_Max./L23_KO_SW_Septa_Max);
  752. L23_KO_MW_div_SW_Septa_sem = 100*std(L23_KO_MW_Septa_Max./L23_KO_SW_Septa_Max,[],1)/sqrt(size(L23_KO_MW_Septa_Max,1));
  753. % Figure 1 Figure SUpplement 3C
  754. figure; set(gcf,'Position',[500 500 610 400]);
  755. hold on; errorbar(1:20,L23_WT_MW_div_SW_Barrel_mean,L23_WT_MW_div_SW_Barrel_sem,'LineWidth',3,'Color',colorBarrel);
  756. hold on; errorbar(1:20,L23_WT_MW_div_SW_Septa_mean,L23_WT_MW_div_SW_Septa_sem,'LineWidth',3,'Color',colorSepta);
  757. plot(1:20,100*ones(1,20),'--','Color',[.1 .1 .1]);
  758. xlim([0 21]); ylim([50 400]);
  759. yticks(0:50:350);
  760. xticks([1:20]); ylabel('AUC_{MW}/AUC_{SW}','FontWeight','normal'); xlabel('Pulse Number','FontSize',22);
  761. set(gca,'FontSize',18); set(gca,'TickDir','out');
  762. legend('Barrel WT','Septa WT','Location','NorthWest');
  763. title('Layer_{2/3} Multi/Single','FontWeight','normal');
  764. exportgraphics(gcf,fullfile(saveFolder,'L23_WT_MW_div_SW_Barrel.png'),"Resolution",600);
  765. figure; set(gcf,'Position',[500 500 610 400]);
  766. hold on; errorbar(1:20,L23_KO_MW_div_SW_Barrel_mean,L23_KO_MW_div_SW_Barrel_sem,'LineWidth',3,'Color',colorBarrelKO);
  767. hold on; errorbar(1:20,L23_KO_MW_div_SW_Septa_mean,L23_KO_MW_div_SW_Septa_sem,'LineWidth',3,'Color',colorSeptaKO);
  768. plot(1:20,100*ones(1,20),'--','Color',[.1 .1 .1]);
  769. xlim([0 21]); ylim([50 400]);
  770. yticks(0:50:350);
  771. xticks([1:20]); ylabel('AUC_{MW}/AUC_{SW}','FontWeight','normal'); xlabel('Pulse Number','FontSize',22);
  772. set(gca,'FontSize',18); set(gca,'TickDir','out');
  773. legend('Barrel KO','Septa KO','Location','NorthWest');
  774. title('Layer_{2/3} Multi/Single','FontWeight','normal');
  775. exportgraphics(gcf,fullfile(saveFolder,'L23_KO_MW_div_SW_Barrel.png'),"Resolution",600);
  776. % % Figure 4G - 7-20 Pulses
  777. %
  778. % t1 = all_L4_KO_ratio_Barrel;
  779. % t2 = all_L4_KO_ratio_Septa;
  780. % ranksum(t1,t2)
  781. % figure; set(gcf,'Position',[1200 100 200 300]); hold on;
  782. % bar(1, mean(t1), 'FaceColor', colorBarrelKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  783. % plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  784. % plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrelKO/2);
  785. % bar(2, mean(t2), 'FaceColor', colorSeptaKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  786. % plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  787. % plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSeptaKO/2);
  788. %
  789. % hold on; plot([1 2],[240 240],'LineWidth',3,'Color','w');
  790. % text(1.5,245,'NS','HorizontalAlignment','center','FontSize',64,'Color','w');
  791. %
  792. % axis([0.5 2.5 0 270]);
  793. % yticks(0:50:250);
  794. % xticks([1 2]); xticklabels({'B' 'S'}); ylabel('Peak(MW/SW)%');
  795. % set(gca,'FontSize',30); set(gca,'TickDir','out');
  796. % exportgraphics(gcf,fullfile(saveFolder,'L4_KO_MW_div_SW_Barrel_Septa.png'),"Resolution",600);
  797. %%
  798. %% Statistical Comparisons
  799. %% L2/3 WT
  800. tempB = []; tempS = []; tempN = [];
  801. for ii = 1:size(stimtrials_L23_WT,1)
  802. for jj = 1:20
  803. tempB(ii,jj) = trapz(1:50,stimtrials_L23_WT(ii,1:50,jj));
  804. end
  805. end
  806. for ii = 1:size(stimtrials_L23_WT_septa,1)
  807. for jj = 1:20
  808. tempS(ii,jj) = trapz(1:50,stimtrials_L23_WT_septa(ii,1:50,jj));
  809. end
  810. end
  811. for ii = 1:size(stimtrials_L23_WT_neigh,1)
  812. for jj = 1:20
  813. tempN(ii,jj) = trapz(1:50,stimtrials_L23_WT_neigh(ii,1:50,jj));
  814. end
  815. end
  816. %%
  817. %% All Pulse Stats
  818. for p = 1:20
  819. t1 = mean(reshape(tempB(:,p),20,length(tempB(:,20))/20),1);
  820. t2 = mean(reshape(tempS(:,p),20,length(tempS(:,20))/20),1);
  821. t3 = mean(reshape(tempN(:,p),20,length(tempN(:,20))/20),1);
  822. pValues(1,p) = ranksum(t1,t2);
  823. pValues(2,p) = ranksum(t1,t3);
  824. pValues(3,p) = ranksum(t2,t3);
  825. end
  826. colorMapDiscrete = [];
  827. colorMapDiscrete = hot(10);
  828. figure; set(gcf,'Position',[100 100 250 800]);
  829. imagesc(pValues',[0 0.1]); colormap(flipud(colorMapDiscrete)); colorbar;
  830. set(gca,'FontSize',20); set(gca,'TickDir','out');
  831. ylabel('Pulse Number','FontSize',20); yticks((1:20));
  832. xlabel('Stats','FontSize',20); xticks([1 2 3]); xticklabels({'BS','BN','SN'}); xtickangle(90);
  833. exportgraphics(gcf,fullfile(saveFolder,'L23_BSN_WT_Stats_SW.png'),"Resolution",600);
  834. % First Pulse
  835. t1 = mean(reshape(tempB(:,1),20,length(tempB(:,20))/20),1);
  836. t2 = mean(reshape(tempS(:,1),20,length(tempS(:,20))/20),1);
  837. t3 = mean(reshape(tempN(:,1),20,length(tempN(:,20))/20),1);
  838. %
  839. % clc;
  840. % ranksum(t1,t2)
  841. % ranksum(t1,t3)
  842. % ranksum(t2,t3)
  843. %
  844. % figure; set(gcf,'Position',[1200 100 300 500]); hold on;
  845. % bar(1, mean(t1), 'FaceColor', colorBarrel, 'EdgeColor', 'none', 'BarWidth', 0.6);
  846. % plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  847. % plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrel/2);
  848. % bar(2, mean(t2), 'FaceColor', colorSepta, 'EdgeColor', 'none', 'BarWidth', 0.6);
  849. % plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  850. % plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSepta/2);
  851. % bar(3, mean(t3), 'FaceColor', colorNeigh, 'EdgeColor', 'none', 'BarWidth', 0.6);
  852. % plot([3 3],[mean(t3)-std(t3)/sqrt(length(t3)) mean(t3)+std(t3)/sqrt(length(t3))],'LineWidth',5,'Color','k');
  853. % plot(3*ones(1,length(t3))-0.1+rand(1,length(t3))/5,t3,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorNeigh/2);
  854. %
  855. % plot([2 3],[19 19],'LineWidth',3,'Color','k');
  856. % text(2.5,19.1,'*','HorizontalAlignment','center','FontSize',64);
  857. %
  858. % axis([0.5 3.5 0 20]);
  859. % yticks(0:4:20);
  860. % xticks([1 2 3]); xticklabels({'B' 'S' 'N'}); ylabel('AUC');
  861. % set(gca,'FontSize',30); set(gca,'TickDir','out');
  862. % exportgraphics(gcf,fullfile(saveFolder,'L23_WT_BSN_stat_first_pulse.png'),"Resolution",600);
  863. %
  864. % % Second Pulse
  865. % t1 = mean(reshape(tempB(:,2),20,length(tempB(:,20))/20),1);
  866. % t2 = mean(reshape(tempS(:,2),20,length(tempS(:,20))/20),1);
  867. % t3 = mean(reshape(tempN(:,2),20,length(tempN(:,20))/20),1);
  868. %
  869. % clc;
  870. % ranksum(t1,t2)
  871. % ranksum(t1,t3)
  872. % ranksum(t2,t3)
  873. %
  874. % figure; set(gcf,'Position',[1200 100 300 500]); hold on;
  875. % bar(1, mean(t1), 'FaceColor', colorBarrel, 'EdgeColor', 'none', 'BarWidth', 0.6);
  876. % plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  877. % plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrel/2);
  878. % bar(2, mean(t2), 'FaceColor', colorSepta, 'EdgeColor', 'none', 'BarWidth', 0.6);
  879. % plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  880. % plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSepta/2);
  881. % bar(3, mean(t3), 'FaceColor', colorNeigh, 'EdgeColor', 'none', 'BarWidth', 0.6);
  882. % plot([3 3],[mean(t3)-std(t3)/sqrt(length(t3)) mean(t3)+std(t3)/sqrt(length(t3))],'LineWidth',5,'Color','k');
  883. % plot(3*ones(1,length(t3))-0.1+rand(1,length(t3))/5,t3,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorNeigh/2);
  884. %
  885. % % plot([2 3],[19 19],'LineWidth',3,'Color','k');
  886. % % text(2.5,19.1,'*','HorizontalAlignment','center','FontSize',64);
  887. %
  888. % axis([0.5 3.5 0 20]);
  889. % yticks(0:4:20);
  890. % xticks([1 2 3]); xticklabels({'B' 'S' 'N'}); ylabel('AUC');
  891. % set(gca,'FontSize',30); set(gca,'TickDir','out');
  892. % exportgraphics(gcf,fullfile(saveFolder,'L23_WT_BSN_stat_second_pulse.png'),"Resolution",600);
  893. %
  894. % % Third Pulse
  895. % t1 = mean(reshape(tempB(:,3),20,length(tempB(:,20))/20),1);
  896. % t2 = mean(reshape(tempS(:,3),20,length(tempS(:,20))/20),1);
  897. % t3 = mean(reshape(tempN(:,3),20,length(tempN(:,20))/20),1);
  898. %
  899. % clc;
  900. % ranksum(t1,t2)
  901. % ranksum(t1,t3)
  902. % ranksum(t2,t3)
  903. %
  904. % figure; set(gcf,'Position',[1200 100 300 500]); hold on;
  905. % bar(1, mean(t1), 'FaceColor', colorBarrel, 'EdgeColor', 'none', 'BarWidth', 0.6);
  906. % plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  907. % plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrel/2);
  908. % bar(2, mean(t2), 'FaceColor', colorSepta, 'EdgeColor', 'none', 'BarWidth', 0.6);
  909. % plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  910. % plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSepta/2);
  911. % bar(3, mean(t3), 'FaceColor', colorNeigh, 'EdgeColor', 'none', 'BarWidth', 0.6);
  912. % plot([3 3],[mean(t3)-std(t3)/sqrt(length(t3)) mean(t3)+std(t3)/sqrt(length(t3))],'LineWidth',5,'Color','k');
  913. % plot(3*ones(1,length(t3))-0.1+rand(1,length(t3))/5,t3,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorNeigh/2);
  914. %
  915. % plot([1 2],[12 12],'LineWidth',3,'Color','k');
  916. % text(1.5,12.1,'*','HorizontalAlignment','center','FontSize',64);
  917. %
  918. % axis([0.5 3.5 0 20]);
  919. % yticks(0:4:20);
  920. % xticks([1 2 3]); xticklabels({'B' 'S' 'N'}); ylabel('AUC');
  921. % set(gca,'FontSize',30); set(gca,'TickDir','out');
  922. % exportgraphics(gcf,fullfile(saveFolder,'L23_WT_BSN_stat_third_pulse.png'),"Resolution",600);
  923. %
  924. % % 20th Pulse
  925. % t1 = mean(reshape(tempB(:,20),20,length(tempB(:,20))/20),1);
  926. % t2 = mean(reshape(tempS(:,20),20,length(tempS(:,20))/20),1);
  927. % t3 = mean(reshape(tempN(:,20),20,length(tempN(:,20))/20),1);
  928. %
  929. % clc;
  930. % ranksum(t1,t2)
  931. % ranksum(t1,t3)
  932. % ranksum(t2,t3)
  933. %
  934. % figure; set(gcf,'Position',[1200 100 300 500]); hold on;
  935. % bar(1, mean(t1), 'FaceColor', colorBarrel, 'EdgeColor', 'none', 'BarWidth', 0.6);
  936. % plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  937. % plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrel/2);
  938. % bar(2, mean(t2), 'FaceColor', colorSepta, 'EdgeColor', 'none', 'BarWidth', 0.6);
  939. % plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  940. % plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSepta/2);
  941. % bar(3, mean(t3), 'FaceColor', colorNeigh, 'EdgeColor', 'none', 'BarWidth', 0.6);
  942. % plot([3 3],[mean(t3)-std(t3)/sqrt(length(t3)) mean(t3)+std(t3)/sqrt(length(t3))],'LineWidth',5,'Color','k');
  943. % plot(3*ones(1,length(t3))-0.1+rand(1,length(t3))/5,t3,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorNeigh/2);
  944. %
  945. % plot([1 2],[7.5 7.5],'LineWidth',3,'Color','k');
  946. % text(1.5,7.7,'**','HorizontalAlignment','center','FontSize',64);
  947. % plot([2 3],[5.5 5.5],'LineWidth',3,'Color','k');
  948. % text(2.5,5.7,'*','HorizontalAlignment','center','FontSize',64);
  949. %
  950. % axis([0.5 3.5 0 20]);
  951. % yticks(0:4:20);
  952. % xticks([1 2 3]); xticklabels({'B' 'S' 'N'}); ylabel('AUC');
  953. % set(gca,'FontSize',30); set(gca,'TickDir','out');
  954. % exportgraphics(gcf,fullfile(saveFolder,'L23_WT_BSN_stat_20th_pulse.png'),"Resolution",600);
  955. %% L4 WT
  956. tempB = []; tempS = []; tempN = [];
  957. for ii = 1:size(stimtrials_L4_WT,1)
  958. for jj = 1:20
  959. tempB(ii,jj) = trapz(1:50,stimtrials_L4_WT(ii,1:50,jj));
  960. end
  961. end
  962. for ii = 1:size(stimtrials_L4_WT_septa,1)
  963. for jj = 1:20
  964. tempS(ii,jj) = trapz(1:50,stimtrials_L4_WT_septa(ii,1:50,jj));
  965. end
  966. end
  967. for ii = 1:size(stimtrials_L4_WT_neigh,1)
  968. for jj = 1:20
  969. tempN(ii,jj) = trapz(1:50,stimtrials_L4_WT_neigh(ii,1:50,jj));
  970. end
  971. end
  972. %% All Pulse Stats
  973. for p = 1:20
  974. t1 = mean(reshape(tempB(:,p),20,length(tempB(:,20))/20),1);
  975. t2 = mean(reshape(tempS(:,p),20,length(tempS(:,20))/20),1);
  976. t3 = mean(reshape(tempN(:,p),20,length(tempN(:,20))/20),1);
  977. pValues(1,p) = ranksum(t1,t2);
  978. pValues(2,p) = ranksum(t1,t3);
  979. pValues(3,p) = ranksum(t2,t3);
  980. end
  981. colorMapDiscreteTemp = [];
  982. colorMapDiscreteTemp = hot(10);
  983. colorMapDiscrete(10,:) = colorMapDiscreteTemp(10,:);
  984. colorMapDiscrete(9,:) = colorMapDiscreteTemp(8,:);
  985. colorMapDiscrete(8,:) = colorMapDiscreteTemp(6,:);
  986. colorMapDiscrete(7,:) = colorMapDiscreteTemp(4,:);
  987. colorMapDiscrete(6,:) = colorMapDiscreteTemp(2,:);
  988. colorMapDiscrete(5,:) = colorMapDiscreteTemp(1,:);
  989. colorMapDiscrete(4,:) = colorMapDiscreteTemp(1,:);
  990. colorMapDiscrete(3,:) = colorMapDiscreteTemp(1,:);
  991. colorMapDiscrete(2,:) = colorMapDiscreteTemp(1,:);
  992. colorMapDiscrete(1,:) = [0 0 0];
  993. colorMapDiscrete = 1-colorMapDiscrete;
  994. % Figure 1E
  995. figure; set(gcf,'Position',[100 100 1000 200]);
  996. imagesc(pValues,[0 0.05]); cmap = colormap(flipud(colorMapDiscrete)); cbh = colorbar;
  997. cbh.Ticks = [0, 0.01, 0.05]; cbh.TickLabels = {'0','0.01','>0.05'} ;
  998. set(gca,'FontSize',20); set(gca,'TickDir','out');
  999. xlabel('Pulse Number','FontSize',20); xticks((1:20));
  1000. yticks([1 2 3]); yticklabels({'B vs S','B vs N','S vs N'}); %xtickangle(45);
  1001. exportgraphics(gcf,fullfile(saveFolder, 'L4_BSN_WT_Stats_SW.png'),"Resolution",300);
  1002. %% MW Stats
  1003. %% L2/3 WT MW
  1004. tempB = []; tempS = []; tempN = [];
  1005. for ii = 1:size(stimtrials_MW_L23_WT,1)
  1006. for jj = 1:20
  1007. tempB(ii,jj) = trapz(1:50,stimtrials_MW_L23_WT(ii,1:50,jj));
  1008. end
  1009. end
  1010. for ii = 1:size(stimtrials_MW_L23_WT_septa,1)
  1011. for jj = 1:20
  1012. tempS(ii,jj) = trapz(1:50,stimtrials_MW_L23_WT_septa(ii,1:50,jj));
  1013. end
  1014. end
  1015. pValuesL23 = [];
  1016. for p = 1:20
  1017. t1 = mean(reshape(tempB(:,p),20,length(tempB(:,20))/20),1);
  1018. t2 = mean(reshape(tempS(:,p),20,length(tempS(:,20))/20),1);
  1019. pValuesL23(p) = ranksum(t1,t2);
  1020. end
  1021. figure; set(gcf,'Position',[100 100 150 800]);
  1022. imagesc(pValues',[0 0.05]); colormap gray; colorbar;
  1023. colorbar('Ticks',[0 0.01 0.05],'TickLabels',{'***','**','*'});
  1024. set(gca,'FontSize',24); set(gca,'TickDir','out');
  1025. ylabel('Pulse Number','FontSize',28); yticks((1:20));
  1026. xlabel('pValue','FontSize',22); xticks([1]); xticklabels({'BS'});
  1027. exportgraphics(gcf,fullfile(saveFolder,'L23_BS_WT_Stats_MW.png'),"Resolution",600);
  1028. % First Pulse
  1029. t1 = mean(reshape(tempB(:,1),20,length(tempB(:,20))/20),1);
  1030. t2 = mean(reshape(tempS(:,1),20,length(tempS(:,20))/20),1);
  1031. clc;
  1032. ranksum(t1,t2)
  1033. figure; set(gcf,'Position',[1200 100 300 500]); hold on;
  1034. bar(1, mean(t1), 'FaceColor', colorBarrel, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1035. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  1036. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrel/2);
  1037. bar(2, mean(t2), 'FaceColor', colorSepta, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1038. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  1039. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSepta/2);
  1040. % plot([1 2],[8 8],'LineWidth',3,'Color','k');
  1041. % text(1.5,8.1,'***','HorizontalAlignment','center','FontSize',64);
  1042. axis([0.5 2.5 0 13]);
  1043. yticks(0:4:20);
  1044. xticks([1 2]); xticklabels({'B' 'S'}); ylabel('AUC');
  1045. set(gca,'FontSize',30); set(gca,'TickDir','out');
  1046. exportgraphics(gcf,fullfile(saveFolder,'L23_WT_MW_BSN_stat_first_pulse.png'),"Resolution",600);
  1047. % Second Pulse
  1048. t1 = mean(reshape(tempB(:,2),20,length(tempB(:,20))/20),1);
  1049. t2 = mean(reshape(tempS(:,2),20,length(tempS(:,20))/20),1);
  1050. clc;
  1051. ranksum(t1,t2)
  1052. figure; set(gcf,'Position',[1200 100 300 500]); hold on;
  1053. bar(1, mean(t1), 'FaceColor', colorBarrel, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1054. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  1055. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrel/2);
  1056. bar(2, mean(t2), 'FaceColor', colorSepta, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1057. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  1058. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSepta/2);
  1059. % plot([1 2],[8 8],'LineWidth',3,'Color','k');
  1060. % text(1.5,8.1,'***','HorizontalAlignment','center','FontSize',64);
  1061. axis([0.5 2.5 0 13]);
  1062. yticks(0:4:20);
  1063. xticks([1 2]); xticklabels({'B' 'S'}); ylabel('AUC');
  1064. set(gca,'FontSize',30); set(gca,'TickDir','out');
  1065. exportgraphics(gcf,fullfile(saveFolder,'L23_WT_MW_BSN_stat_second_pulse.png'),"Resolution",600);
  1066. % Third Pulse
  1067. t1 = mean(reshape(tempB(:,3),20,length(tempB(:,20))/20),1);
  1068. t2 = mean(reshape(tempS(:,3),20,length(tempS(:,20))/20),1);
  1069. clc;
  1070. ranksum(t1,t2)
  1071. figure; set(gcf,'Position',[1200 100 300 500]); hold on;
  1072. bar(1, mean(t1), 'FaceColor', colorBarrel, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1073. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  1074. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrel/2);
  1075. bar(2, mean(t2), 'FaceColor', colorSepta, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1076. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  1077. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSepta/2);
  1078. % plot([1 2],[8 8],'LineWidth',3,'Color','k');
  1079. % text(1.5,8.1,'***','HorizontalAlignment','center','FontSize',64);
  1080. axis([0.5 2.5 0 13]);
  1081. yticks(0:4:20);
  1082. xticks([1 2]); xticklabels({'B' 'S'}); ylabel('AUC');
  1083. set(gca,'FontSize',30); set(gca,'TickDir','out');
  1084. exportgraphics(gcf,fullfile(saveFolder,'L23_WT_MW_BSN_stat_third_pulse.png'),"Resolution",600);
  1085. % 20th Pulse
  1086. t1 = mean(reshape(tempB(:,20),20,length(tempB(:,20))/20),1);
  1087. t2 = mean(reshape(tempS(:,20),20,length(tempS(:,20))/20),1);
  1088. clc;
  1089. ranksum(t1,t2)
  1090. figure; set(gcf,'Position',[1200 100 300 500]); hold on;
  1091. bar(1, mean(t1), 'FaceColor', colorBarrel, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1092. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  1093. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrel/2);
  1094. bar(2, mean(t2), 'FaceColor', colorSepta, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1095. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  1096. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSepta/2);
  1097. % plot([1 2],[8 8],'LineWidth',3,'Color','k');
  1098. % text(1.5,8.1,'***','HorizontalAlignment','center','FontSize',64);
  1099. axis([0.5 2.5 0 13]);
  1100. yticks(0:4:20);
  1101. xticks([1 2]); xticklabels({'B' 'S'}); ylabel('AUC');
  1102. set(gca,'FontSize',30); set(gca,'TickDir','out');
  1103. exportgraphics(gcf,fullfile(saveFolder,'L23_WT_MW_BSN_stat_20th_pulse.png'),"Resolution",600);
  1104. %% L4 WT MW
  1105. %%
  1106. tempB = []; tempS = [];
  1107. for ii = 1:size(stimtrials_MW_L4_WT,1)
  1108. for jj = 1:20
  1109. tempB(ii,jj) = trapz(1:50,stimtrials_MW_L4_WT(ii,1:50,jj));
  1110. end
  1111. end
  1112. for ii = 1:size(stimtrials_MW_L4_WT_septa,1)
  1113. for jj = 1:20
  1114. tempS(ii,jj) = trapz(1:50,stimtrials_MW_L4_WT_septa(ii,1:50,jj));
  1115. end
  1116. end
  1117. for p = 1:20
  1118. t1 = mean(reshape(tempB(:,p),20,length(tempB(:,20))/20),1);
  1119. t2 = mean(reshape(tempS(:,p),20,length(tempS(:,20))/20),1);
  1120. pValuesMW(p) = ranksum(t1,t2);
  1121. end
  1122. % colorMapDiscrete = [];
  1123. % colorMapDiscrete = hot(10);
  1124. figure; set(gcf,'Position',[100 100 100 700]); set(gcf,'OuterPosition',[100 100 180 700]);
  1125. imagesc(pValuesMW',[0 0.1]); colormap(flipud(colorMapDiscrete)); colorbar;
  1126. set(gca,'FontSize',20); set(gca,'TickDir','out');
  1127. ylabel('Pulse Number','FontSize',20); yticks((1:20));
  1128. xlabel('Stats','FontSize',20); xticks([1]); xticklabels({'B vs S'});
  1129. exportgraphics(gcf,fullfile(saveFolder, 'L4_BSN_WT_Stats_MW.png'),"Resolution",300);
  1130. %%
  1131. pValuesL4 = [];
  1132. for p = 1:20
  1133. t1 = mean(reshape(tempB(:,p),20,length(tempB(:,20))/20),1);
  1134. t2 = mean(reshape(tempS(:,p),20,length(tempS(:,20))/20),1);
  1135. pValuesL4(p) = ranksum(t1,t2);
  1136. end
  1137. figure; set(gcf,'Position',[100 100 150 800]);
  1138. imagesc(pValues',[0 0.05]); colormap gray; colorbar;
  1139. colorbar('Ticks',[0 0.01 0.05],'TickLabels',{'***','**','*'});
  1140. set(gca,'FontSize',24); set(gca,'TickDir','out');
  1141. ylabel('Pulse Number','FontSize',28); yticks((1:20));
  1142. xlabel('pValue','FontSize',22); xticks([1]); xticklabels({'BS'});
  1143. exportgraphics(gcf,fullfile(saveFolder,'L4_BS_WT_Stats_MW.png'),"Resolution",600);
  1144. % Figure 1G - First Pulse
  1145. t1 = mean(reshape(tempB(:,1),20,length(tempB(:,20))/20),1);
  1146. t2 = mean(reshape(tempS(:,1),20,length(tempS(:,20))/20),1);
  1147. clc;
  1148. ranksum(t1,t2)
  1149. figure; set(gcf,'Position',[1200 100 200 400]); hold on;
  1150. bar(1, mean(t1), 'FaceColor', colorBarrel, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1151. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  1152. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrel/2);
  1153. bar(2, mean(t2), 'FaceColor', colorSepta, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1154. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  1155. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSepta/2);
  1156. axis([0.5 2.5 0 13]);
  1157. yticks(0:4:20);
  1158. xticks([1 2]); xticklabels({'B' 'S'}); ylabel('AUC');
  1159. set(gca,'FontSize',30); set(gca,'TickDir','out');
  1160. exportgraphics(gcf,fullfile(saveFolder,'L4_WT_MW_BSN_stat_first_pulse.png'),"Resolution",600);
  1161. % Figure 1G - Second Pulse
  1162. t1 = mean(reshape(tempB(:,2),20,length(tempB(:,20))/20),1);
  1163. t2 = mean(reshape(tempS(:,2),20,length(tempS(:,20))/20),1);
  1164. clc;
  1165. ranksum(t1,t2)
  1166. figure; set(gcf,'Position',[1200 100 200 400]); hold on;
  1167. bar(1, mean(t1), 'FaceColor', colorBarrel, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1168. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  1169. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrel/2);
  1170. bar(2, mean(t2), 'FaceColor', colorSepta, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1171. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  1172. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSepta/2);
  1173. plot([1 2],[12 12],'LineWidth',3,'Color','k');
  1174. text(1.5,12.1,'**','HorizontalAlignment','center','FontSize',64);
  1175. axis([0.5 2.5 0 13]);
  1176. yticks(0:4:20);
  1177. xticks([1 2]); xticklabels({'B' 'S'}); ylabel('AUC');
  1178. set(gca,'FontSize',30); set(gca,'TickDir','out');
  1179. exportgraphics(gcf,fullfile(saveFolder,'L4_WT_MW_BSN_stat_second_pulse.png'),"Resolution",600);
  1180. % Figure 1G - Third Pulse
  1181. t1 = mean(reshape(tempB(:,3),20,length(tempB(:,20))/20),1);
  1182. t2 = mean(reshape(tempS(:,3),20,length(tempS(:,20))/20),1);
  1183. clc;
  1184. ranksum(t1,t2)
  1185. figure; set(gcf,'Position',[1200 100 200 400]); hold on;
  1186. bar(1, mean(t1), 'FaceColor', colorBarrel, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1187. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  1188. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrel/2);
  1189. bar(2, mean(t2), 'FaceColor', colorSepta, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1190. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  1191. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSepta/2);
  1192. plot([1 2],[11 11],'LineWidth',3,'Color','k');
  1193. text(1.5,11.1,'**','HorizontalAlignment','center','FontSize',64);
  1194. axis([0.5 2.5 0 13]);
  1195. yticks(0:4:20);
  1196. xticks([1 2]); xticklabels({'B' 'S'}); ylabel('AUC');
  1197. set(gca,'FontSize',30); set(gca,'TickDir','out');
  1198. exportgraphics(gcf,fullfile(saveFolder,'L4_WT_MW_BSN_stat_third_pulse.png'),"Resolution",600);
  1199. % Figure 1G - 20th Pulse
  1200. t1 = mean(reshape(tempB(:,20),20,length(tempB(:,20))/20),1);
  1201. t2 = mean(reshape(tempS(:,20),20,length(tempS(:,20))/20),1);
  1202. clc;
  1203. ranksum(t1,t2)
  1204. figure; set(gcf,'Position',[1200 100 200 400]); hold on;
  1205. bar(1, mean(t1), 'FaceColor', colorBarrel, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1206. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  1207. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrel/2);
  1208. bar(2, mean(t2), 'FaceColor', colorSepta, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1209. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  1210. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSepta/2);
  1211. plot([1 2],[9.3 9.3],'LineWidth',3,'Color','k');
  1212. text(1.5,9.4,'**','HorizontalAlignment','center','FontSize',64);
  1213. axis([0.5 2.5 0 13]);
  1214. yticks(0:4:20);
  1215. xticks([1 2]); xticklabels({'B' 'S'}); ylabel('AUC');
  1216. set(gca,'FontSize',30); set(gca,'TickDir','out');
  1217. exportgraphics(gcf,fullfile(saveFolder,'L4_WT_MW_BSN_stat_20th_pulse.png'),"Resolution",600);
  1218. %% MW Stats - KO
  1219. %% L2/3 KO MW
  1220. tempB = []; tempS = []; tempN = [];
  1221. for ii = 1:size(stimtrials_MW_L23_KO,1)
  1222. for jj = 1:20
  1223. tempB(ii,jj) = trapz(1:50,stimtrials_MW_L23_KO(ii,1:50,jj));
  1224. end
  1225. end
  1226. for ii = 1:size(stimtrials_MW_L23_KO_septa,1)
  1227. for jj = 1:20
  1228. tempS(ii,jj) = trapz(1:50,stimtrials_MW_L23_KO_septa(ii,1:50,jj));
  1229. end
  1230. end
  1231. pValuesL23KO = [];
  1232. for p = 1:20
  1233. t1 = mean(reshape(tempB(:,p),20,length(tempB(:,20))/20),1);
  1234. t2 = mean(reshape(tempS(:,p),20,length(tempS(:,20))/20),1);
  1235. pValuesL23KO(p) = ranksum(t1,t2);
  1236. end
  1237. figure; set(gcf,'Position',[100 100 150 800]);
  1238. imagesc(pValues',[0 0.05]); colormap gray; colorbar;
  1239. colorbar('Ticks',[0 0.01 0.05],'TickLabels',{'***','**','*'});
  1240. set(gca,'FontSize',24); set(gca,'TickDir','out');
  1241. ylabel('Pulse Number','FontSize',28); yticks((1:20));
  1242. xlabel('pValue','FontSize',22); xticks([1]); xticklabels({'BS'});
  1243. exportgraphics(gcf,fullfile(saveFolder,'L23_BS_KO_Stats_MW.png'),"Resolution",600);
  1244. % First Pulse
  1245. t1 = mean(reshape(tempB(:,1),20,length(tempB(:,20))/20),1);
  1246. t2 = mean(reshape(tempS(:,1),20,length(tempS(:,20))/20),1);
  1247. clc;
  1248. ranksum(t1,t2)
  1249. figure; set(gcf,'Position',[1200 100 300 500]); hold on;
  1250. bar(1, mean(t1), 'FaceColor', colorBarrelKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1251. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  1252. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrelKO/2);
  1253. bar(2, mean(t2), 'FaceColor', colorSeptaKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1254. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  1255. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSeptaKO/2);
  1256. % plot([1 2],[8 8],'LineWidth',3,'Color','k');
  1257. % text(1.5,8.1,'***','HorizontalAlignment','center','FontSize',64);
  1258. axis([0.5 2.5 0 13]);
  1259. yticks(0:4:20);
  1260. xticks([1 2]); xticklabels({'B' 'S'}); ylabel('AUC');
  1261. set(gca,'FontSize',30); set(gca,'TickDir','out');
  1262. exportgraphics(gcf,fullfile(saveFolder,'L23_KO_MW_BSN_stat_first_pulse.png'),"Resolution",600);
  1263. % Second Pulse
  1264. t1 = mean(reshape(tempB(:,2),20,length(tempB(:,20))/20),1);
  1265. t2 = mean(reshape(tempS(:,2),20,length(tempS(:,20))/20),1);
  1266. clc;
  1267. ranksum(t1,t2)
  1268. figure; set(gcf,'Position',[1200 100 300 500]); hold on;
  1269. bar(1, mean(t1), 'FaceColor', colorBarrelKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1270. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  1271. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrelKO/2);
  1272. bar(2, mean(t2), 'FaceColor', colorSeptaKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1273. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  1274. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSeptaKO/2);
  1275. % plot([1 2],[8 8],'LineWidth',3,'Color','k');
  1276. % text(1.5,8.1,'***','HorizontalAlignment','center','FontSize',64);
  1277. axis([0.5 2.5 0 13]);
  1278. yticks(0:4:20);
  1279. xticks([1 2]); xticklabels({'B' 'S'}); ylabel('AUC');
  1280. set(gca,'FontSize',30); set(gca,'TickDir','out');
  1281. exportgraphics(gcf,fullfile(saveFolder,'L23_KO_MW_BSN_stat_second_pulse.png'),"Resolution",600);
  1282. % Third Pulse
  1283. t1 = mean(reshape(tempB(:,3),20,length(tempB(:,20))/20),1);
  1284. t2 = mean(reshape(tempS(:,3),20,length(tempS(:,20))/20),1);
  1285. clc;
  1286. ranksum(t1,t2)
  1287. figure; set(gcf,'Position',[1200 100 300 500]); hold on;
  1288. bar(1, mean(t1), 'FaceColor', colorBarrelKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1289. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  1290. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrelKO/2);
  1291. bar(2, mean(t2), 'FaceColor', colorSeptaKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1292. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  1293. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSeptaKO/2);
  1294. % plot([1 2],[8 8],'LineWidth',3,'Color','k');
  1295. % text(1.5,8.1,'***','HorizontalAlignment','center','FontSize',64);
  1296. axis([0.5 2.5 0 13]);
  1297. yticks(0:4:20);
  1298. xticks([1 2]); xticklabels({'B' 'S'}); ylabel('AUC');
  1299. set(gca,'FontSize',30); set(gca,'TickDir','out');
  1300. exportgraphics(gcf,fullfile(saveFolder,'L23_KO_MW_BSN_stat_third_pulse.png'),"Resolution",600);
  1301. % 20th Pulse
  1302. t1 = mean(reshape(tempB(:,20),20,length(tempB(:,20))/20),1);
  1303. t2 = mean(reshape(tempS(:,20),20,length(tempS(:,20))/20),1);
  1304. clc;
  1305. ranksum(t1,t2)
  1306. figure; set(gcf,'Position',[1200 100 300 500]); hold on;
  1307. bar(1, mean(t1), 'FaceColor', colorBarrelKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1308. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  1309. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrelKO/2);
  1310. bar(2, mean(t2), 'FaceColor', colorSeptaKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1311. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  1312. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSeptaKO/2);
  1313. % plot([1 2],[8 8],'LineWidth',3,'Color','k');
  1314. % text(1.5,8.1,'***','HorizontalAlignment','center','FontSize',64);
  1315. axis([0.5 2.5 0 13]);
  1316. yticks(0:4:20);
  1317. xticks([1 2]); xticklabels({'B' 'S'}); ylabel('AUC');
  1318. set(gca,'FontSize',30); set(gca,'TickDir','out');
  1319. exportgraphics(gcf,fullfile(saveFolder,'L23_KO_MW_BSN_stat_20th_pulse.png'),"Resolution",600);
  1320. %% L4 KO MW
  1321. tempB = []; tempS = []; tempN = [];
  1322. for ii = 1:size(stimtrials_MW_L4_KO,1)
  1323. for jj = 1:20
  1324. tempB(ii,jj) = trapz(1:50,stimtrials_MW_L4_KO(ii,1:50,jj));
  1325. end
  1326. end
  1327. for ii = 1:size(stimtrials_MW_L4_KO_septa,1)
  1328. for jj = 1:20
  1329. tempS(ii,jj) = trapz(1:50,stimtrials_MW_L4_KO_septa(ii,1:50,jj));
  1330. end
  1331. end
  1332. pValuesL4KO = [];
  1333. for p = 1:20
  1334. t1 = mean(reshape(tempB(:,p),20,length(tempB(:,20))/20),1);
  1335. t2 = mean(reshape(tempS(:,p),20,length(tempS(:,20))/20),1);
  1336. pValuesL4KO(p) = ranksum(t1,t2);
  1337. end
  1338. figure; set(gcf,'Position',[100 100 150 800]);
  1339. imagesc(pValues',[0 0.05]); colormap gray; colorbar;
  1340. colorbar('Ticks',[0 0.01 0.05],'TickLabels',{'***','**','*'});
  1341. set(gca,'FontSize',24); set(gca,'TickDir','out');
  1342. ylabel('Pulse Number','FontSize',28); yticks((1:20));
  1343. xlabel('pValue','FontSize',22); xticks([1]); xticklabels({'BS'});
  1344. exportgraphics(gcf,fullfile(saveFolder,'L4_BS_KO_Stats_MW.png'),"Resolution",600);
  1345. % Figure 4E - First Pulse
  1346. t1 = mean(reshape(tempB(:,1),20,length(tempB(:,20))/20),1);
  1347. t2 = mean(reshape(tempS(:,1),20,length(tempS(:,20))/20),1);
  1348. clc;
  1349. ranksum(t1,t2)
  1350. figure; set(gcf,'Position',[1200 100 300 500]); hold on;
  1351. bar(1, mean(t1), 'FaceColor', colorBarrelKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1352. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  1353. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrelKO/2);
  1354. bar(2, mean(t2), 'FaceColor', colorSeptaKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1355. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  1356. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSeptaKO/2);
  1357. axis([0.5 2.5 0 13]);
  1358. yticks(0:4:20);
  1359. xticks([1 2]); xticklabels({'B' 'S'}); ylabel('AUC');
  1360. set(gca,'FontSize',30); set(gca,'TickDir','out');
  1361. exportgraphics(gcf,fullfile(saveFolder,'L4_KO_MW_BSN_stat_first_pulse.png'),"Resolution",600);
  1362. % Figure 4E - Second Pulse
  1363. t1 = mean(reshape(tempB(:,2),20,length(tempB(:,20))/20),1);
  1364. t2 = mean(reshape(tempS(:,2),20,length(tempS(:,20))/20),1);
  1365. clc;
  1366. ranksum(t1,t2)
  1367. figure; set(gcf,'Position',[1200 100 300 500]); hold on;
  1368. bar(1, mean(t1), 'FaceColor', colorBarrelKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1369. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  1370. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrelKO/2);
  1371. bar(2, mean(t2), 'FaceColor', colorSeptaKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1372. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  1373. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSeptaKO/2);
  1374. axis([0.5 2.5 0 13]);
  1375. yticks(0:4:20);
  1376. xticks([1 2]); xticklabels({'B' 'S'}); ylabel('AUC');
  1377. set(gca,'FontSize',30); set(gca,'TickDir','out');
  1378. exportgraphics(gcf,fullfile(saveFolder,'L4_KO_MW_BSN_stat_second_pulse.png'),"Resolution",600);
  1379. % Figure 4E - Third Pulse
  1380. t1 = mean(reshape(tempB(:,3),20,length(tempB(:,20))/20),1);
  1381. t2 = mean(reshape(tempS(:,3),20,length(tempS(:,20))/20),1);
  1382. clc;
  1383. ranksum(t1,t2)
  1384. figure; set(gcf,'Position',[1200 100 300 500]); hold on;
  1385. bar(1, mean(t1), 'FaceColor', colorBarrelKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1386. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  1387. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrelKO/2);
  1388. bar(2, mean(t2), 'FaceColor', colorSeptaKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1389. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  1390. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSeptaKO/2);
  1391. axis([0.5 2.5 0 13]);
  1392. yticks(0:4:20);
  1393. xticks([1 2]); xticklabels({'B' 'S'}); ylabel('AUC');
  1394. set(gca,'FontSize',30); set(gca,'TickDir','out');
  1395. exportgraphics(gcf,fullfile(saveFolder,'L4_KO_MW_BSN_stat_third_pulse.png'),"Resolution",600);
  1396. % Figure 4E - 20th Pulse
  1397. t1 = mean(reshape(tempB(:,20),20,length(tempB(:,20))/20),1);
  1398. t2 = mean(reshape(tempS(:,20),20,length(tempS(:,20))/20),1);
  1399. clc;
  1400. ranksum(t1,t2)
  1401. figure; set(gcf,'Position',[1200 100 300 500]); hold on;
  1402. bar(1, mean(t1), 'FaceColor', colorBarrelKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1403. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  1404. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrelKO/2);
  1405. bar(2, mean(t2), 'FaceColor', colorSeptaKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1406. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  1407. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSeptaKO/2);
  1408. plot([1 2],[10 10],'LineWidth',3,'Color','k');
  1409. text(1.5,10.1,'**','HorizontalAlignment','center','FontSize',64);
  1410. axis([0.5 2.5 0 13]);
  1411. yticks(0:4:20);
  1412. xticks([1 2]); xticklabels({'B' 'S'}); ylabel('AUC');
  1413. set(gca,'FontSize',30); set(gca,'TickDir','out');
  1414. exportgraphics(gcf,fullfile(saveFolder,'L4_KO_MW_BSN_stat_20th_pulse.png'),"Resolution",600);
  1415. %% L4 KO
  1416. tempB = []; tempS = []; tempN = [];
  1417. for ii = 1:size(stimtrials_L4_KO,1)
  1418. for jj = 1:20
  1419. tempB(ii,jj) = trapz(1:50,stimtrials_L4_KO(ii,1:50,jj));
  1420. end
  1421. end
  1422. for ii = 1:size(stimtrials_L4_KO_septa,1)
  1423. for jj = 1:20
  1424. tempS(ii,jj) = trapz(1:50,stimtrials_L4_KO_septa(ii,1:50,jj));
  1425. end
  1426. end
  1427. for ii = 1:size(stimtrials_L4_KO_neigh,1)
  1428. for jj = 1:20
  1429. tempN(ii,jj) = trapz(1:50,stimtrials_L4_KO_neigh(ii,1:50,jj));
  1430. end
  1431. end
  1432. % Figure 4C
  1433. for p = 1:20
  1434. t1 = mean(reshape(tempB(:,p),20,length(tempB(:,20))/20),1);
  1435. t2 = mean(reshape(tempS(:,p),20,length(tempS(:,20))/20),1);
  1436. t3 = mean(reshape(tempN(:,p),20,length(tempN(:,20))/20),1);
  1437. pValues(1,p) = ranksum(t1,t2);
  1438. pValues(2,p) = ranksum(t1,t3);
  1439. pValues(3,p) = ranksum(t2,t3);
  1440. end
  1441. colorMapDiscreteTemp = [];
  1442. colorMapDiscreteTemp = hot(10);
  1443. colorMapDiscrete(10,:) = colorMapDiscreteTemp(10,:);
  1444. colorMapDiscrete(9,:) = colorMapDiscreteTemp(8,:);
  1445. colorMapDiscrete(8,:) = colorMapDiscreteTemp(6,:);
  1446. colorMapDiscrete(7,:) = colorMapDiscreteTemp(4,:);
  1447. colorMapDiscrete(6,:) = colorMapDiscreteTemp(2,:);
  1448. colorMapDiscrete(5,:) = colorMapDiscreteTemp(1,:);
  1449. colorMapDiscrete(4,:) = colorMapDiscreteTemp(1,:);
  1450. colorMapDiscrete(3,:) = colorMapDiscreteTemp(1,:);
  1451. colorMapDiscrete(2,:) = colorMapDiscreteTemp(1,:);
  1452. colorMapDiscrete(1,:) = [0 0 0];
  1453. colorMapDiscrete = 1-colorMapDiscrete;
  1454. figure; set(gcf,'Position',[100 100 1000 200]);
  1455. imagesc(pValues,[0 0.05]); cmap = colormap(flipud(colorMapDiscrete)); cbh = colorbar;
  1456. cbh.Ticks = [0, 0.01, 0.05]; cbh.TickLabels = {'0','0.01','>0.05'} ;
  1457. set(gca,'FontSize',20); set(gca,'TickDir','out');
  1458. xlabel('Pulse Number','FontSize',20); xticks((1:20));
  1459. yticks([1 2 3]); yticklabels({'B vs S','B vs N','S vs N'}); %xtickangle(45);
  1460. exportgraphics(gcf,fullfile(saveFolder, 'L4_BSN_KO_Stats_SW.png'),"Resolution",300);
  1461. %% WT vs KO SW and MW p Values
  1462. tempB_WT = []; tempB_KO = [];
  1463. for ii = 1:size(stimtrials_L5_WT,1)
  1464. for jj = 1:20
  1465. tempB_WT(ii,jj) = trapz(1:50,stimtrials_L5_WT(ii,1:50,jj));
  1466. end
  1467. end
  1468. for ii = 1:size(stimtrials_L5_KO,1)
  1469. for jj = 1:20
  1470. tempB_KO(ii,jj) = trapz(1:50,stimtrials_L5_KO(ii,1:50,jj));
  1471. end
  1472. end
  1473. tempS_WT = []; tempS_KO = [];
  1474. for ii = 1:size(stimtrials_L5_WT_septa,1)
  1475. for jj = 1:20
  1476. tempS_WT(ii,jj) = trapz(1:50,stimtrials_L5_WT_septa(ii,1:50,jj));
  1477. end
  1478. end
  1479. for ii = 1:size(stimtrials_L5_KO_septa,1)
  1480. for jj = 1:20
  1481. tempS_KO(ii,jj) = trapz(1:50,stimtrials_L5_KO_septa(ii,1:50,jj));
  1482. end
  1483. end
  1484. tempN_WT = []; tempN_KO = [];
  1485. for ii = 1:size(stimtrials_L5_WT_neigh,1)
  1486. for jj = 1:20
  1487. tempN_WT(ii,jj) = trapz(1:50,stimtrials_L5_WT_neigh(ii,1:50,jj));
  1488. end
  1489. end
  1490. for ii = 1:size(stimtrials_L5_KO_neigh,1)
  1491. for jj = 1:20
  1492. tempN_KO(ii,jj) = trapz(1:50,stimtrials_L5_KO_neigh(ii,1:50,jj));
  1493. end
  1494. end
  1495. %% All Pulse Stats
  1496. for p = 1:20
  1497. t1 = mean(reshape(tempB_WT(:,p),20,length(tempB_WT(:,20))/20),1);
  1498. t2 = mean(reshape(tempB_KO(:,p),20,length(tempB_KO(:,20))/20),1);
  1499. t3 = mean(reshape(tempS_WT(:,p),20,length(tempS_WT(:,20))/20),1);
  1500. t4 = mean(reshape(tempS_KO(:,p),20,length(tempS_KO(:,20))/20),1);
  1501. t5 = mean(reshape(tempN_WT(:,p),20,length(tempN_WT(:,20))/20),1);
  1502. t6 = mean(reshape(tempN_KO(:,p),20,length(tempN_KO(:,20))/20),1);
  1503. pValues(1,p) = ranksum(t1,t2);
  1504. pValues(2,p) = ranksum(t3,t4);
  1505. pValues(3,p) = ranksum(t5,t6);
  1506. end
  1507. figure; hold on;
  1508. plot(pValues(1,:)','Color',(colorBarrel+colorBarrelKO)/2,'LineWidth',3);
  1509. plot(pValues(2,:)','Color',(colorSepta+colorSeptaKO)/2,'LineWidth',3);
  1510. plot(pValues(3,:)','Color',(colorNeigh+colorNeighKO)/2,'LineWidth',3);
  1511. set(gca,'FontSize',24); set(gca,'TickDir','out');
  1512. legend({'Barrel','Septa','Neighbor'},'FontSize',14,'AutoUpdate','off');
  1513. plot(0:21,0.05*ones(1,22),'Color','r','LineWidth',1)
  1514. xlabel('Pulse Number','FontSize',24);
  1515. ylabel('p','FontSize',24);
  1516. title('WT vs KO','FontSize',24); axis([1 20 0 1]);
  1517. saveas(gcf, fullfile(saveFolder,'L5_p_WT_vs_KO_1-50ms.png','epsc'));
  1518. %% MW
  1519. tempB_WT = []; tempB_KO = [];
  1520. for ii = 1:size(stimtrials_MW_L23_WT,1)
  1521. for jj = 1:20
  1522. tempB_WT(ii,jj) = trapz(1:50,stimtrials_MW_L23_WT(ii,1:50,jj));
  1523. end
  1524. end
  1525. for ii = 1:size(stimtrials_MW_L23_KO,1)
  1526. for jj = 1:20
  1527. tempB_KO(ii,jj) = trapz(1:50,stimtrials_MW_L23_KO(ii,1:50,jj));
  1528. end
  1529. end
  1530. tempS_WT = []; tempS_KO = [];
  1531. for ii = 1:size(stimtrials_MW_L23_WT_septa,1)
  1532. for jj = 1:20
  1533. tempS_WT(ii,jj) = trapz(1:50,stimtrials_MW_L23_WT_septa(ii,1:50,jj));
  1534. end
  1535. end
  1536. for ii = 1:size(stimtrials_MW_L23_KO_septa,1)
  1537. for jj = 1:20
  1538. tempS_KO(ii,jj) = trapz(1:50,stimtrials_MW_L23_KO_septa(ii,1:50,jj));
  1539. end
  1540. end
  1541. %% All Pulse Stats
  1542. for p = 1:20
  1543. t1 = mean(reshape(tempB_WT(:,p),20,length(tempB_WT(:,20))/20),1);
  1544. t2 = mean(reshape(tempB_KO(:,p),20,length(tempB_KO(:,20))/20),1);
  1545. t3 = mean(reshape(tempS_WT(:,p),20,length(tempS_WT(:,20))/20),1);
  1546. t4 = mean(reshape(tempS_KO(:,p),20,length(tempS_KO(:,20))/20),1);
  1547. pValues(1,p) = ranksum(t1,t2);
  1548. pValues(2,p) = ranksum(t3,t4);
  1549. end
  1550. figure; hold on;
  1551. plot(pValues(1,:)','Color',(colorBarrel+colorBarrelKO)/2,'LineWidth',3);
  1552. plot(pValues(2,:)','Color',(colorSepta+colorSeptaKO)/2,'LineWidth',3);
  1553. set(gca,'FontSize',24); set(gca,'TickDir','out');
  1554. legend({'Barrel','Septa'},'FontSize',14,'AutoUpdate','off');
  1555. plot(0:21,0.05*ones(1,22),'Color','r','LineWidth',1)
  1556. xlabel('Pulse Number','FontSize',24);
  1557. ylabel('p','FontSize',24);
  1558. title('WT vs KO','FontSize',24); axis([1 20 0 1]);
  1559. saveas(gcf, fullfile(saveFolder,'L23_p_WT_vs_KO_MW_1-50ms.png','epsc'));
  1560. %%
  1561. one = squeeze(mean(stimtrials_L23_WT_neigh,1))';
  1562. two = squeeze(mean(stimtrials_L23_KO_neigh,1))';
  1563. [ds,ix,iy] = dtw(one,two);
  1564. onewarp = one(:,ix);
  1565. twowarp = two(:,iy);
  1566. figure; set(gcf,'Position',[100 100 500 300]);
  1567. imagesc(onewarp,[0 0.35]);
  1568. colormap turbo; colorbar;
  1569. colorbar('Ticks',[0 0.1 0.2 0.3 0.4],'TickLabels',{'0','0.1','0.2','0.3','0.4'});
  1570. xlabel('Time (ms)','FontSize',24); xticks([1 20 40 60 80]);
  1571. set(gca,'FontSize',24); set(gca,'TickDir','out');
  1572. ylabel('Pulse Number','FontSize',22); yticks([1 5 10 15 20]);
  1573. exportgraphics(gcf,fullfile(saveFolder,'L23_Neigh_WT_Image_Warped.png'),"Resolution",600);
  1574. figure; set(gcf,'Position',[100 100 500 300]);
  1575. imagesc(twowarp,[0 0.35]);
  1576. colormap turbo; colorbar;
  1577. colorbar('Ticks',[0 0.1 0.2 0.3 0.4],'TickLabels',{'0','0.1','0.2','0.3','0.4'});
  1578. xlabel('Time (ms)','FontSize',24); xticks([1 20 40 60 80]);
  1579. set(gca,'FontSize',24); set(gca,'TickDir','out');
  1580. ylabel('Pulse Number','FontSize',22); yticks([1 5 10 15 20]);
  1581. exportgraphics(gcf,fullfile(saveFolder,'L23_Neigh_KO_Image_Warped.png'),"Resolution",600);
  1582. %% L2/3 KO
  1583. tempB = []; tempS = []; tempN = [];
  1584. for ii = 1:size(stimtrials_L23_KO,1)
  1585. for jj = 1:20
  1586. tempB(ii,jj) = trapz(1:50,stimtrials_L23_KO(ii,1:50,jj));
  1587. end
  1588. end
  1589. for ii = 1:size(stimtrials_L23_KO_septa,1)
  1590. for jj = 1:20
  1591. tempS(ii,jj) = trapz(1:50,stimtrials_L23_KO_septa(ii,1:50,jj));
  1592. end
  1593. end
  1594. for ii = 1:size(stimtrials_L23_KO_neigh,1)
  1595. for jj = 1:20
  1596. tempN(ii,jj) = trapz(1:50,stimtrials_L23_KO_neigh(ii,1:50,jj));
  1597. end
  1598. end
  1599. for p = 1:20
  1600. t1 = mean(reshape(tempB(:,p),20,length(tempB(:,20))/20),1);
  1601. t2 = mean(reshape(tempS(:,p),20,length(tempS(:,20))/20),1);
  1602. t3 = mean(reshape(tempN(:,p),20,length(tempN(:,20))/20),1);
  1603. pValues(1,p) = ranksum(t1,t2);
  1604. pValues(2,p) = ranksum(t1,t3);
  1605. pValues(3,p) = ranksum(t2,t3);
  1606. end
  1607. figure; set(gcf,'Position',[100 100 250 800]);
  1608. imagesc(pValues',[0 0.05]); colormap gray; colorbar;
  1609. colorbar('Ticks',[0 0.01 0.05],'TickLabels',{'***','**','*'});
  1610. set(gca,'FontSize',24); set(gca,'TickDir','out');
  1611. ylabel('Pulse Number','FontSize',28); yticks((1:20));
  1612. xlabel('pValue','FontSize',22); xticks([1 2 3]); xticklabels({'BS','BN','SN'});
  1613. exportgraphics(gcf,fullfile(saveFolder,'L23_BSN_KO_Stats_SW.png'),"Resolution",600);
  1614. % First Pulse
  1615. t1 = mean(reshape(tempB(:,1),20,length(tempB(:,20))/20),1);
  1616. t2 = mean(reshape(tempS(:,1),20,length(tempS(:,20))/20),1);
  1617. t3 = mean(reshape(tempN(:,1),20,length(tempN(:,20))/20),1);
  1618. clc;
  1619. ranksum(t1,t2)
  1620. ranksum(t1,t3)
  1621. ranksum(t2,t3)
  1622. figure; set(gcf,'Position',[1200 100 300 500]); hold on;
  1623. bar(1, mean(t1), 'FaceColor', colorBarrelKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1624. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  1625. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrelKO/2);
  1626. bar(2, mean(t2), 'FaceColor', colorSeptaKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1627. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  1628. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSeptaKO/2);
  1629. bar(3, mean(t3), 'FaceColor', colorNeighKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1630. plot([3 3],[mean(t3)-std(t3)/sqrt(length(t3)) mean(t3)+std(t3)/sqrt(length(t3))],'LineWidth',5,'Color','k');
  1631. plot(3*ones(1,length(t3))-0.1+rand(1,length(t3))/5,t3,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorNeighKO/2);
  1632. plot([2 3],[17.8 17.8],'LineWidth',3,'Color','k');
  1633. text(2.5,17.8,'*','HorizontalAlignment','center','FontSize',64);
  1634. plot([1 3],[19 19],'LineWidth',3,'Color','k');
  1635. text(2,19,'*','HorizontalAlignment','center','FontSize',64);
  1636. axis([0.5 3.5 0 20]);
  1637. yticks(0:4:20);
  1638. xticks([1 2 3]); xticklabels({'B' 'S' 'N'}); ylabel('AUC');
  1639. set(gca,'FontSize',30); set(gca,'TickDir','out');
  1640. exportgraphics(gcf,fullfile(saveFolder,'L23_KO_BSN_stat_first_pulse.png'),"Resolution",600);
  1641. % Second Pulse
  1642. t1 = mean(reshape(tempB(:,2),20,length(tempB(:,20))/20),1);
  1643. t2 = mean(reshape(tempS(:,2),20,length(tempS(:,20))/20),1);
  1644. t3 = mean(reshape(tempN(:,2),20,length(tempN(:,20))/20),1);
  1645. clc;
  1646. ranksum(t1,t2)
  1647. ranksum(t1,t3)
  1648. ranksum(t2,t3)
  1649. figure; set(gcf,'Position',[1200 100 300 500]); hold on;
  1650. bar(1, mean(t1), 'FaceColor', colorBarrelKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1651. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  1652. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrelKO/2);
  1653. bar(2, mean(t2), 'FaceColor', colorSeptaKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1654. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  1655. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSeptaKO/2);
  1656. bar(3, mean(t3), 'FaceColor', colorNeighKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1657. plot([3 3],[mean(t3)-std(t3)/sqrt(length(t3)) mean(t3)+std(t3)/sqrt(length(t3))],'LineWidth',5,'Color','k');
  1658. plot(3*ones(1,length(t3))-0.1+rand(1,length(t3))/5,t3,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorNeighKO/2);
  1659. % plot([2 3],[19 19],'LineWidth',3,'Color','k');
  1660. % text(2.5,19.1,'*','HorizontalAlignment','center','FontSize',64);
  1661. axis([0.5 3.5 0 20]);
  1662. yticks(0:4:20);
  1663. xticks([1 2 3]); xticklabels({'B' 'S' 'N'}); ylabel('AUC');
  1664. set(gca,'FontSize',30); set(gca,'TickDir','out');
  1665. exportgraphics(gcf,fullfile(saveFolder,'L23_KO_BSN_stat_second_pulse.png'),"Resolution",600);
  1666. % Third Pulse
  1667. t1 = mean(reshape(tempB(:,3),20,length(tempB(:,20))/20),1);
  1668. t2 = mean(reshape(tempS(:,3),20,length(tempS(:,20))/20),1);
  1669. t3 = mean(reshape(tempN(:,3),20,length(tempN(:,20))/20),1);
  1670. clc;
  1671. ranksum(t1,t2)
  1672. ranksum(t1,t3)
  1673. ranksum(t2,t3)
  1674. figure; set(gcf,'Position',[1200 100 300 500]); hold on;
  1675. bar(1, mean(t1), 'FaceColor', colorBarrelKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1676. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  1677. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrelKO/2);
  1678. bar(2, mean(t2), 'FaceColor', colorSeptaKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1679. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  1680. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSeptaKO/2);
  1681. bar(3, mean(t3), 'FaceColor', colorNeighKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1682. plot([3 3],[mean(t3)-std(t3)/sqrt(length(t3)) mean(t3)+std(t3)/sqrt(length(t3))],'LineWidth',5,'Color','k');
  1683. plot(3*ones(1,length(t3))-0.1+rand(1,length(t3))/5,t3,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorNeighKO/2);
  1684. % plot([1 2],[12 12],'LineWidth',3,'Color','k');
  1685. % text(1.5,12.1,'*','HorizontalAlignment','center','FontSize',64);
  1686. axis([0.5 3.5 0 20]);
  1687. yticks(0:4:20);
  1688. xticks([1 2 3]); xticklabels({'B' 'S' 'N'}); ylabel('AUC');
  1689. set(gca,'FontSize',30); set(gca,'TickDir','out');
  1690. exportgraphics(gcf,fullfile(saveFolder,'L23_KO_BSN_stat_third_pulse.png'),"Resolution",600);
  1691. % 20th Pulse
  1692. t1 = mean(reshape(tempB(:,20),20,length(tempB(:,20))/20),1);
  1693. t2 = mean(reshape(tempS(:,20),20,length(tempS(:,20))/20),1);
  1694. t3 = mean(reshape(tempN(:,20),20,length(tempN(:,20))/20),1);
  1695. clc;
  1696. ranksum(t1,t2)
  1697. ranksum(t1,t3)
  1698. ranksum(t2,t3)
  1699. figure; set(gcf,'Position',[1200 100 300 500]); hold on;
  1700. bar(1, mean(t1), 'FaceColor', colorBarrelKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1701. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  1702. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrelKO/2);
  1703. bar(2, mean(t2), 'FaceColor', colorSeptaKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1704. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  1705. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSeptaKO/2);
  1706. bar(3, mean(t3), 'FaceColor', colorNeighKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1707. plot([3 3],[mean(t3)-std(t3)/sqrt(length(t3)) mean(t3)+std(t3)/sqrt(length(t3))],'LineWidth',5,'Color','k');
  1708. plot(3*ones(1,length(t3))-0.1+rand(1,length(t3))/5,t3,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorNeighKO/2);
  1709. % plot([1 2],[7.5 7.5],'LineWidth',3,'Color','k');
  1710. % text(1.5,7.7,'**','HorizontalAlignment','center','FontSize',64);
  1711. % plot([2 3],[5.5 5.5],'LineWidth',3,'Color','k');
  1712. % text(2.5,5.7,'*','HorizontalAlignment','center','FontSize',64);
  1713. axis([0.5 3.5 0 20]);
  1714. yticks(0:4:20);
  1715. xticks([1 2 3]); xticklabels({'B' 'S' 'N'}); ylabel('AUC');
  1716. set(gca,'FontSize',30); set(gca,'TickDir','out');
  1717. exportgraphics(gcf,fullfile(saveFolder,'L23_KO_BSN_stat_20th_pulse.png'),"Resolution",600);
  1718. %% L4 KO
  1719. tempB = []; tempS = []; tempN = [];
  1720. for ii = 1:size(stimtrials_L4_KO,1)
  1721. for jj = 1:20
  1722. tempB(ii,jj) = trapz(1:50,stimtrials_L4_KO(ii,1:50,jj));
  1723. end
  1724. end
  1725. for ii = 1:size(stimtrials_L4_KO_septa,1)
  1726. for jj = 1:20
  1727. tempS(ii,jj) = trapz(1:50,stimtrials_L4_KO_septa(ii,1:50,jj));
  1728. end
  1729. end
  1730. for ii = 1:size(stimtrials_L4_KO_neigh,1)
  1731. for jj = 1:20
  1732. tempN(ii,jj) = trapz(1:50,stimtrials_L4_KO_neigh(ii,1:50,jj));
  1733. end
  1734. end
  1735. for p = 1:20
  1736. t1 = mean(reshape(tempB(:,p),20,length(tempB(:,20))/20),1);
  1737. t2 = mean(reshape(tempS(:,p),20,length(tempS(:,20))/20),1);
  1738. t3 = mean(reshape(tempN(:,p),20,length(tempN(:,20))/20),1);
  1739. pValues(1,p) = ranksum(t1,t2);
  1740. pValues(2,p) = ranksum(t1,t3);
  1741. pValues(3,p) = ranksum(t2,t3);
  1742. end
  1743. figure; set(gcf,'Position',[100 100 250 800]);
  1744. imagesc(pValues',[0 0.05]); colormap gray; colorbar;
  1745. colorbar('Ticks',[0 0.01 0.05],'TickLabels',{'***','**','*'});
  1746. set(gca,'FontSize',24); set(gca,'TickDir','out');
  1747. ylabel('Pulse Number','FontSize',28); yticks((1:20));
  1748. xlabel('pValue','FontSize',22); xticks([1 2 3]); xticklabels({'BS','BN','SN'});
  1749. exportgraphics(gcf,fullfile(saveFolder,'L4_BSN_KO_Stats_SW.png'),"Resolution",600);
  1750. % First Pulse
  1751. t1 = mean(reshape(tempB(:,1),20,length(tempB(:,20))/20),1);
  1752. t2 = mean(reshape(tempS(:,1),20,length(tempS(:,20))/20),1);
  1753. t3 = mean(reshape(tempN(:,1),20,length(tempN(:,20))/20),1);
  1754. clc;
  1755. ranksum(t1,t2)
  1756. ranksum(t1,t3)
  1757. ranksum(t2,t3)
  1758. figure; set(gcf,'Position',[1200 100 300 500]); hold on;
  1759. bar(1, mean(t1), 'FaceColor', colorBarrelKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1760. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  1761. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrelKO/2);
  1762. bar(2, mean(t2), 'FaceColor', colorSeptaKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1763. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  1764. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSeptaKO/2);
  1765. bar(3, mean(t3), 'FaceColor', colorNeighKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1766. plot([3 3],[mean(t3)-std(t3)/sqrt(length(t3)) mean(t3)+std(t3)/sqrt(length(t3))],'LineWidth',5,'Color','k');
  1767. plot(3*ones(1,length(t3))-0.1+rand(1,length(t3))/5,t3,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorNeighKO/2);
  1768. plot([2 3],[15 15],'LineWidth',3,'Color','k');
  1769. text(2.5,15.1,'*','HorizontalAlignment','center','FontSize',64);
  1770. plot([1 3],[17 17],'LineWidth',3,'Color','k');
  1771. text(2,17.1,'*','HorizontalAlignment','center','FontSize',64);
  1772. axis([0.5 3.5 0 20]);
  1773. yticks(0:4:20);
  1774. xticks([1 2 3]); xticklabels({'B' 'S' 'N'}); ylabel('AUC');
  1775. set(gca,'FontSize',30); set(gca,'TickDir','out');
  1776. exportgraphics(gcf,fullfile(saveFolder,'L4_KO_BSN_stat_first_pulse.png'),"Resolution",600);
  1777. % Second Pulse
  1778. t1 = mean(reshape(tempB(:,2),20,length(tempB(:,20))/20),1);
  1779. t2 = mean(reshape(tempS(:,2),20,length(tempS(:,20))/20),1);
  1780. t3 = mean(reshape(tempN(:,2),20,length(tempN(:,20))/20),1);
  1781. clc;
  1782. ranksum(t1,t2)
  1783. ranksum(t1,t3)
  1784. ranksum(t2,t3)
  1785. figure; set(gcf,'Position',[1200 100 300 500]); hold on;
  1786. bar(1, mean(t1), 'FaceColor', colorBarrelKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1787. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  1788. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrelKO/2);
  1789. bar(2, mean(t2), 'FaceColor', colorSeptaKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1790. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  1791. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSeptaKO/2);
  1792. bar(3, mean(t3), 'FaceColor', colorNeighKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1793. plot([3 3],[mean(t3)-std(t3)/sqrt(length(t3)) mean(t3)+std(t3)/sqrt(length(t3))],'LineWidth',5,'Color','k');
  1794. plot(3*ones(1,length(t3))-0.1+rand(1,length(t3))/5,t3,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorNeighKO/2);
  1795. % plot([2 3],[19 19],'LineWidth',3,'Color','k');
  1796. % text(2.5,19.1,'*','HorizontalAlignment','center','FontSize',64);
  1797. axis([0.5 3.5 0 20]);
  1798. yticks(0:4:20);
  1799. xticks([1 2 3]); xticklabels({'B' 'S' 'N'}); ylabel('AUC');
  1800. set(gca,'FontSize',30); set(gca,'TickDir','out');
  1801. exportgraphics(gcf,fullfile(saveFolder,'L4_KO_BSN_stat_second_pulse.png'),"Resolution",600);
  1802. % Third Pulse
  1803. t1 = mean(reshape(tempB(:,3),20,length(tempB(:,20))/20),1);
  1804. t2 = mean(reshape(tempS(:,3),20,length(tempS(:,20))/20),1);
  1805. t3 = mean(reshape(tempN(:,3),20,length(tempN(:,20))/20),1);
  1806. clc;
  1807. ranksum(t1,t2)
  1808. ranksum(t1,t3)
  1809. ranksum(t2,t3)
  1810. figure; set(gcf,'Position',[1200 100 300 500]); hold on;
  1811. bar(1, mean(t1), 'FaceColor', colorBarrelKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1812. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  1813. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrelKO/2);
  1814. bar(2, mean(t2), 'FaceColor', colorSeptaKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1815. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  1816. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSeptaKO/2);
  1817. bar(3, mean(t3), 'FaceColor', colorNeighKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1818. plot([3 3],[mean(t3)-std(t3)/sqrt(length(t3)) mean(t3)+std(t3)/sqrt(length(t3))],'LineWidth',5,'Color','k');
  1819. plot(3*ones(1,length(t3))-0.1+rand(1,length(t3))/5,t3,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorNeighKO/2);
  1820. % plot([1 2],[12.5 12.5],'LineWidth',3,'Color','k');
  1821. % text(1.5,12.7,'**','HorizontalAlignment','center','FontSize',64);
  1822. axis([0.5 3.5 0 20]);
  1823. yticks(0:4:20);
  1824. xticks([1 2 3]); xticklabels({'B' 'S' 'N'}); ylabel('AUC');
  1825. set(gca,'FontSize',30); set(gca,'TickDir','out');
  1826. exportgraphics(gcf,fullfile(saveFolder,'L4_KO_BSN_stat_third_pulse.png'),"Resolution",600);
  1827. % 20th Pulse
  1828. t1 = mean(reshape(tempB(:,20),20,length(tempB(:,20))/20),1);
  1829. t2 = mean(reshape(tempS(:,20),20,length(tempS(:,20))/20),1);
  1830. t3 = mean(reshape(tempN(:,20),20,length(tempN(:,20))/20),1);
  1831. clc;
  1832. ranksum(t1,t2)
  1833. ranksum(t1,t3)
  1834. ranksum(t2,t3)
  1835. figure; set(gcf,'Position',[1200 100 300 500]); hold on;
  1836. bar(1, mean(t1), 'FaceColor', colorBarrelKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1837. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  1838. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorBarrelKO/2);
  1839. bar(2, mean(t2), 'FaceColor', colorSeptaKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1840. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  1841. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorSeptaKO/2);
  1842. bar(3, mean(t3), 'FaceColor', colorNeighKO, 'EdgeColor', 'none', 'BarWidth', 0.6);
  1843. plot([3 3],[mean(t3)-std(t3)/sqrt(length(t3)) mean(t3)+std(t3)/sqrt(length(t3))],'LineWidth',5,'Color','k');
  1844. plot(3*ones(1,length(t3))-0.1+rand(1,length(t3))/5,t3,'Marker','.','MarkerSize',38,'LineStyle','none','Color',colorNeighKO/2);
  1845. plot([1 2],[12 12],'LineWidth',3,'Color','k');
  1846. text(1.5,12.2,'*','HorizontalAlignment','center','FontSize',64);
  1847. plot([1 3],[14 14],'LineWidth',3,'Color','k');
  1848. text(2,14.2,'*','HorizontalAlignment','center','FontSize',64);
  1849. axis([0.5 3.5 0 20]);
  1850. yticks(0:4:20);
  1851. xticks([1 2 3]); xticklabels({'B' 'S' 'N'}); ylabel('AUC');
  1852. set(gca,'FontSize',30); set(gca,'TickDir','out');
  1853. exportgraphics(gcf,fullfile(saveFolder,'L4_KO_BSN_stat_20th_pulse.png'),"Resolution",600);
  1854. %% ANOVA Calculations - July 2025
  1855. % Compate WT Barrel vs Septa
  1856. % SW
  1857. tempB_perBarrel = convertTrialtoPerBarrel(stimtrials_L4_WT);
  1858. tempS_perBarrel = convertTrialtoPerBarrel(stimtrials_L4_WT_septa);
  1859. tempN_perBarrel = convertTrialtoPerBarrel(stimtrials_L4_WT_neigh);
  1860. [rm, ranovaResults, timeResults] = calculate3ANOVA(tempB_perBarrel,tempS_perBarrel,tempN_perBarrel)
  1861. size(tempB_perBarrel)
  1862. size(tempS_perBarrel)
  1863. size(tempN_perBarrel)
  1864. % MW
  1865. tempB_MW_perBarrel = convertTrialtoPerBarrel(stimtrials_MW_L4_WT);
  1866. tempS_MW_perBarrel = convertTrialtoPerBarrel(stimtrials_MW_L4_WT_septa);
  1867. [rm, ranovaResults, timeResults] = calculateANOVA(tempB_MW_perBarrel,tempS_MW_perBarrel)
  1868. size(tempB_MW_perBarrel)
  1869. size(tempS_MW_perBarrel)
  1870. % MW_SW
  1871. mw_sw_L4_WT_Barrel = (tempB_MW_perBarrel./tempB_perBarrel);
  1872. mw_sw_L4_WT_Septa = (tempS_MW_perBarrel./tempS_perBarrel);
  1873. [rm, ranovaResults, timeResults] = calculateANOVA(mw_sw_L4_WT_Barrel,mw_sw_L4_WT_Septa)
  1874. size(mw_sw_L4_WT_Barrel)
  1875. size(mw_sw_L4_WT_Septa)
  1876. % Compate KO Barrel vs Septa
  1877. % SW
  1878. tempB_perBarrel = convertTrialtoPerBarrel(stimtrials_L4_KO);
  1879. tempS_perBarrel = convertTrialtoPerBarrel(stimtrials_L4_KO_septa);
  1880. tempN_perBarrel = convertTrialtoPerBarrel(stimtrials_L4_KO_neigh);
  1881. [rm, ranovaResults, timeResults] = calculate3ANOVA(tempB_perBarrel,tempS_perBarrel,tempN_perBarrel)
  1882. size(tempB_perBarrel)
  1883. size(tempS_perBarrel)
  1884. size(tempN_perBarrel)
  1885. % MW
  1886. tempB_MW_perBarrel = convertTrialtoPerBarrel(stimtrials_MW_L4_KO);
  1887. tempS_MW_perBarrel = convertTrialtoPerBarrel(stimtrials_MW_L4_KO_septa);
  1888. [rm, ranovaResults, timeResults] = calculateANOVA(tempB_MW_perBarrel,tempS_MW_perBarrel)
  1889. size(tempB_MW_perBarrel)
  1890. size(tempS_MW_perBarrel)
  1891. % MW_SW
  1892. mw_sw_L4_KO_Barrel = (tempB_MW_perBarrel./tempB_perBarrel);
  1893. mw_sw_L4_KO_Septa = (tempS_MW_perBarrel./tempS_perBarrel);
  1894. [rm, ranovaResults, timeResults] = calculateANOVA(mw_sw_L4_KO_Barrel,mw_sw_L4_KO_Septa)
  1895. size(mw_sw_L4_KO_Barrel)
  1896. size(mw_sw_L4_KO_Septa)
  1897. %% ANOVA Stats June 2025
  1898. all_L4_WT_ratio_Barrel_Combined = (L4_WT_MW_Barrel_Max./L4_WT_SW_Barrel_Max);
  1899. all_L4_WT_ratio_Septa_Combined = (L4_WT_MW_Septa_Max./L4_WT_SW_Septa_Max);
  1900. all_L4_KO_ratio_Barrel_Combined = (L4_KO_MW_Barrel_Max./L4_KO_SW_Barrel_Max);
  1901. all_L4_KO_ratio_Septa_Combined = (L4_KO_MW_Septa_Max./L4_KO_SW_Septa_Max);
  1902. dataA = all_L4_WT_ratio_Barrel_Combined; % Condition A : 14 Barrels, 20 time points
  1903. dataB = all_L4_WT_ratio_Septa_Combined; % Condition B : 9 Septa, 20 time points
  1904. data = [dataA; dataB]; % Combine : 23 BS x 20 time points
  1905. condition = [repmat({'A'}, 13, 1); repmat({'B'}, 8, 1)];
  1906. % Create table
  1907. timeNames = arrayfun(@(x) sprintf('Time%d', x), 1:20, 'UniformOutput', false);
  1908. T = array2table(data, 'VariableNames', timeNames);
  1909. T.Condition = condition;
  1910. % Define within-subject factor
  1911. withinDesign = table((1:20)', 'VariableNames', {'Time'});
  1912. withinDesign.Time = categorical(withinDesign.Time);
  1913. % Fit repeated measures model
  1914. rm = fitrm(T, 'Time1-Time20 ~ Condition', 'WithinDesign', withinDesign);
  1915. % Run ANOVA
  1916. ranovaResults = ranova(rm, 'WithinModel', 'Time');
  1917. disp(ranovaResults);
  1918. % Post-hoc tests (if needed)
  1919. timeResults = multcompare(rm, 'Time', 'By', 'Condition');
  1920. disp(timeResults);
  1921. % Post-hoc test for Condition at each Time point
  1922. rm = fitrm(T, 'Time1-Time20 ~ Condition', 'WithinDesign', table(categorical(1:20)', 'VariableNames', {'Time'}));
  1923. timeResults = multcompare(rm, 'Condition', 'By', 'Time');
  1924. disp(timeResults);
  1925. %%
  1926. dataA = all_L4_KO_ratio_Barrel_Combined; % Condition A: 13 subjects, 20 time points
  1927. dataB = all_L4_KO_ratio_Septa_Combined; % Condition B: 8 subjects, 20 time points
  1928. data = [dataA; dataB]; % Combine: 21 subjects x 20 time points
  1929. condition = [repmat({'A'}, size(dataA,1), 1); repmat({'B'}, size(dataB,1), 1)];
  1930. % Create table
  1931. timeNames = arrayfun(@(x) sprintf('Time%d', x), 1:20, 'UniformOutput', false);
  1932. T = array2table(data, 'VariableNames', timeNames);
  1933. T.Condition = condition;
  1934. % Define within-subject factor
  1935. withinDesign = table((1:20)', 'VariableNames', {'Time'});
  1936. withinDesign.Time = categorical(withinDesign.Time);
  1937. % Fit repeated measures model
  1938. rm = fitrm(T, 'Time1-Time20 ~ Condition', 'WithinDesign', withinDesign);
  1939. % Run ANOVA
  1940. ranovaResults = ranova(rm, 'WithinModel', 'Time');
  1941. disp(ranovaResults);
  1942. % Post-hoc tests (if needed)
  1943. timeResults = multcompare(rm, 'Time', 'By', 'Condition');
  1944. disp(timeResults);
  1945. % Post-hoc test for Condition at each Time point
  1946. rm = fitrm(T, 'Time1-Time20 ~ Condition', 'WithinDesign', table(categorical(1:20)', 'VariableNames', {'Time'}));
  1947. timeResults = multcompare(rm, 'Condition', 'By', 'Time');
  1948. disp(timeResults);
  1949. %% SW_MW Ratios
  1950. %%
  1951. for s = 1:20
  1952. stimtrials_L23_WT(:,:,s) = temp_L23_WT(:,beglocs(s):beglocs(s)+94);
  1953. stimtrials_L23_WT_septa(:,:,s) = temp_L23_WT_septa(:,beglocs(s):beglocs(s)+94);
  1954. stimtrials_L23_WT_neigh(:,:,s) = temp_L23_WT_neigh(:,beglocs(s):beglocs(s)+94);
  1955. end
  1956. tempB = []; tempS = []; tempN = [];
  1957. for ii = 1:size(noBase_stimtrials_L23_WT,1)
  1958. for jj = 1:20
  1959. tempB(ii,jj) = trapz(1:94,stimtrials_L23_WT(ii,1:94,jj));
  1960. end
  1961. end
  1962. for ii = 1:size(noBase_stimtrials_L23_WT_septa,1)
  1963. for jj = 1:20
  1964. tempS(ii,jj) = trapz(1:94,stimtrials_L23_WT_septa(ii,1:94,jj));
  1965. end
  1966. end
  1967. for ii = 1:size(noBase_stimtrials_L23_WT_neigh,1)
  1968. for jj = 1:20
  1969. tempN(ii,jj) = trapz(1:94,stimtrials_L23_WT_neigh(ii,1:94,jj));
  1970. end
  1971. end
  1972. figure , errorbar((1:20)+rand(1,20)/5,mean(tempB),std(temp,[],1)/sqrt(size(noBase_stimtrials_L23_WT,1)/20),'Color',colorBarrel,'LineWidth',4);
  1973. hold on , errorbar((1:20)+rand(1,20)/5,mean(tempS),std(temp3,[],1)/sqrt(size(noBase_stimtrials_L23_WT_septa,1)/20),'Color',colorSepta,'LineWidth',4);
  1974. hold on , errorbar((1:20)+rand(1,20)/5,mean(tempN),std(temp2,[],1)/sqrt(size(noBase_stimtrials_L23_WT_neigh,1)/20),'Color',colorNeigh,'LineWidth',4);
  1975. legend({'Barrel','Septa','Neighbour'},'FontSize',20);
  1976. axis([0.5 20.5 0 1.1]);
  1977. yticks([0 0.05 0.1 0.15 0.20]); yticklabels({'0','0.05','0.10','0.15','0.20'});
  1978. xticks([1 5 10 15 20]); ylabel('MUA'); xlabel('Pulse Number');
  1979. set(gca,'FontSize',24); set(gca,'TickDir','out');
  1980. exportgraphics(gcf,fullfile(saveFolder,'L23_WT_BSN.png'),"Resolution",600);
  1981. %% Average of Everything
  1982. m1 = squeeze(mean(mean(stimtrials_L4_WT(:,:,1:20),3),1));
  1983. m1 = m1 - m1(1); m1 = m1/max(m1);
  1984. m2 = squeeze(mean(mean(stimtrials_L4_WT_septa(:,:,1:20),3),1));
  1985. m2 = m2 - m2(1); m2 = m2/max(m2);
  1986. m3 = squeeze(mean(mean(stimtrials_L4_WT_neigh(:,:,1:20),3),1));
  1987. m3 = m3 - m3(1); m3 = m3/max(m3);
  1988. figure , plot(m1,'Color',colorBarrel,'LineWidth',4);
  1989. hold on, plot(m2,'Color',colorSepta,'LineWidth',4);
  1990. hold on, plot(m3,'Color',colorNeigh,'LineWidth',4);
  1991. m1ko = squeeze(mean(mean(stimtrials_L4_KO(:,:,1:20),3),1));
  1992. m1ko = m1ko - m1ko(1); m1ko = m1ko/max(m1ko);
  1993. m2ko = squeeze(mean(mean(stimtrials_L4_KO_septa(:,:,1:20),3),1));
  1994. m2ko = m2ko - m2ko(1); m2ko = m2ko/max(m2ko);
  1995. m3ko = squeeze(mean(mean(stimtrials_L4_KO_neigh(:,:,1:20),3),1));
  1996. m3ko = m3ko - m3ko(1); m3ko = m3ko/max(m3ko);
  1997. figure , plot(m1ko,'Color',colorBarrelKO,'LineWidth',4);
  1998. hold on, plot(m2ko,'Color',colorSeptaKO,'LineWidth',4);
  1999. hold on, plot(m3ko,'Color',colorNeighKO,'LineWidth',4);
  2000. %% T-SNE PLOTS December 2024
  2001. dataset1 = stimtrials_L4_WT(:,1:45,:);
  2002. dataset2 = stimtrials_L4_WT_septa(:,1:45,:);
  2003. dataset3 = stimtrials_L4_WT_neigh(:,1:45,:);
  2004. dataset4 = stimtrials_L4_KO(:,1:45,:);
  2005. dataset5 = stimtrials_L4_KO_septa(:,1:45,:);
  2006. dataset6 = stimtrials_L4_KO_neigh(:,1:45,:);
  2007. ds1 = []; ds2 = []; ds3 = []; ds4 = []; ds5 = []; ds6 = [];
  2008. ch = 1;
  2009. for h = 1:20:size(dataset1,1)
  2010. temp1 = mean(dataset1(h:h+19,:,:),1);
  2011. ds1(ch,:) = temp1(:);
  2012. ch = ch + 1;
  2013. end
  2014. ch = 1;
  2015. for h = 1:20:size(dataset2,1)
  2016. temp2 = mean(dataset2(h:h+19,:,:),1);
  2017. ds2(ch,:) = temp2(:);
  2018. ch = ch + 1;
  2019. end
  2020. ch = 1;
  2021. for h = 1:20:size(dataset3,1)
  2022. temp3 = mean(dataset3(h:h+19,:,:),1);
  2023. ds3(ch,:) = temp3(:);
  2024. ch = ch + 1;
  2025. end
  2026. ch = 1;
  2027. for h = 1:20:size(dataset4,1)
  2028. temp4 = mean(dataset4(h:h+19,:,:),1);
  2029. ds4(ch,:) = temp4(:);
  2030. ch = ch + 1;
  2031. end
  2032. ch = 1;
  2033. for h = 1:20:size(dataset5,1)
  2034. temp5 = mean(dataset5(h:h+19,:,:),1);
  2035. ds5(ch,:) = temp5(:);
  2036. ch = ch + 1;
  2037. end
  2038. ch = 1;
  2039. for h = 1:20:size(dataset6,1)
  2040. temp6 = mean(dataset6(h:h+19,:,:),1);
  2041. ds6(ch,:) = temp6(:);
  2042. ch = ch + 1;
  2043. end
  2044. Y = tsne([ds1; ds2; ds3; ds4; ds5; ds6],...
  2045. 'Algorithm','barneshut','Perplexity',3,'NumPCAComponents',2,'Exaggeration',6);
  2046. genotype = [ones(1,size(ds1,1)) 2*ones(1,size(ds2,1)) 3*ones(1,size(ds3,1))...
  2047. 4*ones(1,size(ds4,1)) 5*ones(1,size(ds5,1)) 6*ones(1,size(ds6,1))];
  2048. figure; gscatter(Y(:,1),Y(:,2),genotype);
  2049. %%
  2050. m1 = squeeze(mean(mean(stimtrials_MW_L4_WT_septa(:,:,1:20),3),1));
  2051. m1 = m1 - m1(1); m1 = m1/max(m1);
  2052. m2 = squeeze(mean(mean(stimtrials_MW_L4_KO_septa(:,:,1:20),3),1));
  2053. m2 = m2 - m2(1); m2 = m2/max(m2);
  2054. figure , plot(m1,'Color',colorSepta,'LineWidth',4);
  2055. hold on, plot(m2,'Color',colorSepta/2,'LineWidth',4);
  2056. %% L2/3 WT
  2057. temp = [];
  2058. temp2 = [];
  2059. temp3 = [];
  2060. for ii = 1:size(stimtrials_L23_WT,1)
  2061. for jj = 1:20
  2062. temp(ii,jj) = max(stimtrials_L23_WT(ii,1:25,jj));
  2063. end
  2064. end
  2065. for ii = 1:size(stimtrials_L23_WT_neigh,1)
  2066. for jj = 1:20
  2067. temp2(ii,jj) = max(stimtrials_L23_WT_neigh(ii,1:25,jj));
  2068. end
  2069. end
  2070. for ii = 1:size(stimtrials_L23_WT_septa,1)
  2071. for jj = 1:20
  2072. temp3(ii,jj) = max(stimtrials_L23_WT_septa(ii,1:25,jj));
  2073. end
  2074. end
  2075. figure , errorbar((1:20)+rand(1,20)/5,mean(temp) ,std(temp,[],1)/sqrt(size(stimtrials_L23_WT,1)/20),'Color',colorBarrel,'LineWidth',4);
  2076. hold on , errorbar((1:20)+rand(1,20)/5,mean(temp3),std(temp3,[],1)/sqrt(size(stimtrials_L23_WT_septa,1)/20),'Color',colorSepta,'LineWidth',4);
  2077. hold on , errorbar((1:20)+rand(1,20)/5,mean(temp2),std(temp2,[],1)/sqrt(size(stimtrials_L23_WT_neigh,1)/20),'Color',colorNeigh,'LineWidth',4);
  2078. legend({'Barrel','Septa','Neighbour'},'FontSize',20);
  2079. axis([0.5 20.5 0 0.245]);
  2080. yticks([0 0.05 0.1 0.15 0.20]); yticklabels({'0','0.05','0.10','0.15','0.20'});
  2081. xticks([1 5 10 15 20]); ylabel('MUA'); xlabel('Pulse Number');
  2082. set(gca,'FontSize',24); set(gca,'TickDir','out');
  2083. exportgraphics(gcf,fullfile(saveFolder,'L23_WT_BSN.png'),"Resolution",600);
  2084. figure , bar(mean(temp_L23_WT),5,'FaceColor',color1,'LineWidth',15); set(gca,'visible','off');
  2085. hold on, bar(mean(temp_L23_WT_neigh),5,'FaceColor',color2,'LineWidth',15);
  2086. hold on, bar(mean(temp_L23_WT_septa),5,'FaceColor',color3,'LineWidth',15);
  2087. exportgraphics(gcf,fullfile(saveFolder,'L23_WT_BSN_spikes.png'),"Resolution",600);
  2088. % First Pulse
  2089. t1 = mean(reshape(temp(:,1),20,length(temp(:,20))/20),1);
  2090. t2 = mean(reshape(temp2(:,1),20,length(temp2(:,20))/20),1);
  2091. t3 = mean(reshape(temp3(:,1),20,length(temp3(:,20))/20),1);
  2092. clc;
  2093. ranksum(t1,t2)
  2094. ranksum(t1,t3)
  2095. ranksum(t2,t3)
  2096. figure; set(gcf,'Position',[1200 100 300 500]); hold on;
  2097. bar(1, mean(t1), 'FaceColor', color1, 'EdgeColor', 'none', 'BarWidth', 0.6);
  2098. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  2099. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',color1/2);
  2100. bar(2, mean(t2), 'FaceColor', color2, 'EdgeColor', 'none', 'BarWidth', 0.6);
  2101. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  2102. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',color2/2);
  2103. bar(3, mean(t3), 'FaceColor', color3, 'EdgeColor', 'none', 'BarWidth', 0.6);
  2104. plot([3 3],[mean(t3)-std(t3)/sqrt(length(t3)) mean(t3)+std(t3)/sqrt(length(t3))],'LineWidth',5,'Color','k');
  2105. plot(3*ones(1,length(t3))-0.1+rand(1,length(t3))/5,t3,'Marker','.','MarkerSize',38,'LineStyle','none','Color',color3/2);
  2106. % legend({'Barrel','Neighbour','Septa'},'FontSize',24);
  2107. axis([0.5 3.5 0 0.45]);
  2108. yticks([0 0.05 0.1 0.15 0.20 0.25 0.30 0.35 0.40]); yticklabels({'0' '0.05' '0.10' '0.15' '0.20' '0.25' '0.30' '0.35' '0.40'});
  2109. yticks([0 0.05 0.1 0.15 0.20 0.25 0.30 0.35 0.40]); yticklabels({'0' '0.05' '0.10' '0.15' '0.20' '0.25' '0.30' '0.35' '0.40'}); xticks([1 2 3]); xticklabels({'B' 'N' 'S'}); ylabel('MUA'); %xlabel('Pulse Number');
  2110. set(gca,'FontSize',24); set(gca,'TickDir','out');
  2111. exportgraphics(gcf,fullfile(saveFolder,'L23_WT_BSN_stat_first_pulse.png'),"Resolution",600);
  2112. % Second Pulse
  2113. t1 = mean(reshape(temp(:,2),20,length(temp(:,20))/20),1);
  2114. t2 = mean(reshape(temp2(:,2),20,length(temp2(:,20))/20),1);
  2115. t3 = mean(reshape(temp3(:,2),20,length(temp3(:,20))/20),1);
  2116. clc;
  2117. ranksum(t1,t2)
  2118. ranksum(t1,t3)
  2119. ranksum(t2,t3)
  2120. figure; set(gcf,'Position',[1200 100 300 500]); hold on;
  2121. bar(1, mean(t1), 'FaceColor', color1, 'EdgeColor', 'none', 'BarWidth', 0.6);
  2122. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  2123. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',color1/2);
  2124. bar(2, mean(t2), 'FaceColor', color2, 'EdgeColor', 'none', 'BarWidth', 0.6);
  2125. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  2126. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',color2/2);
  2127. bar(3, mean(t3), 'FaceColor', color3, 'EdgeColor', 'none', 'BarWidth', 0.6);
  2128. plot([3 3],[mean(t3)-std(t3)/sqrt(length(t3)) mean(t3)+std(t3)/sqrt(length(t3))],'LineWidth',5,'Color','k');
  2129. plot(3*ones(1,length(t3))-0.1+rand(1,length(t3))/5,t3,'Marker','.','MarkerSize',38,'LineStyle','none','Color',color3/2);
  2130. plot([1 2],[0.27 0.27],'LineWidth',3,'Color','k');
  2131. text(1.5,0.271,'***','HorizontalAlignment','center','FontSize',64);
  2132. % plot([1 3],[0.27 0.27],'LineWidth',3,'Color','k');
  2133. % text(2,0.271,'*','HorizontalAlignment','center','FontSize',64);
  2134. % legend({'Barrel','Neighbour','Septa'},'FontSize',24);
  2135. axis([0.5 3.5 0 0.3]);
  2136. yticks([0 0.05 0.1 0.15 0.20 0.25 0.30 0.35 0.40]); yticklabels({'0' '0.05' '0.10' '0.15' '0.20' '0.25' '0.30' '0.35' '0.40'}); xticks([1 2 3]); xticklabels({'B' 'N' 'S'}); ylabel('MUA'); %xlabel('Pulse Number');
  2137. set(gca,'FontSize',24); set(gca,'TickDir','out');
  2138. exportgraphics(gcf,fullfile(saveFolder,'L23_WT_BSN_stat_second_pulse.png'),"Resolution",600);
  2139. % Third Pulse
  2140. t1 = mean(reshape(temp(:,3),20,length(temp(:,20))/20),1);
  2141. t2 = mean(reshape(temp2(:,3),20,length(temp2(:,20))/20),1);
  2142. t3 = mean(reshape(temp3(:,3),20,length(temp3(:,20))/20),1);
  2143. clc;
  2144. ranksum(t1,t2)
  2145. ranksum(t1,t3)
  2146. ranksum(t2,t3)
  2147. figure; set(gcf,'Position',[1200 100 300 500]); hold on;
  2148. bar(1, mean(t1), 'FaceColor', color1, 'EdgeColor', 'none', 'BarWidth', 0.6);
  2149. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  2150. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',color1/2);
  2151. bar(2, mean(t2), 'FaceColor', color2, 'EdgeColor', 'none', 'BarWidth', 0.6);
  2152. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  2153. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',color2/2);
  2154. bar(3, mean(t3), 'FaceColor', color3, 'EdgeColor', 'none', 'BarWidth', 0.6);
  2155. plot([3 3],[mean(t3)-std(t3)/sqrt(length(t3)) mean(t3)+std(t3)/sqrt(length(t3))],'LineWidth',5,'Color','k');
  2156. plot(3*ones(1,length(t3))-0.1+rand(1,length(t3))/5,t3,'Marker','.','MarkerSize',38,'LineStyle','none','Color',color3/2);
  2157. plot([1 2],[0.27 0.27],'LineWidth',3,'Color','k');
  2158. text(1.5,0.271,'***','HorizontalAlignment','center','FontSize',64);
  2159. % plot([1 3],[0.27 0.27],'LineWidth',3,'Color','k');
  2160. % text(2,0.271,'*','HorizontalAlignment','center','FontSize',64);
  2161. % legend({'Barrel','Neighbour','Septa'},'FontSize',24);
  2162. axis([0.5 3.5 0 0.3]);
  2163. yticks([0 0.05 0.1 0.15 0.20 0.25 0.30 0.35 0.40]); yticklabels({'0' '0.05' '0.10' '0.15' '0.20' '0.25' '0.30' '0.35' '0.40'}); xticks([1 2 3]); xticklabels({'B' 'N' 'S'}); ylabel('MUA'); %xlabel('Pulse Number');
  2164. set(gca,'FontSize',24); set(gca,'TickDir','out');
  2165. exportgraphics(gcf,fullfile(saveFolder,'L23_WT_BSN_stat_second_pulse.png'),"Resolution",600);
  2166. % Last Pulse
  2167. t1 = mean(reshape(temp(:,20),20,length(temp(:,20))/20),1);
  2168. t2 = mean(reshape(temp2(:,20),20,length(temp2(:,20))/20),1);
  2169. t3 = mean(reshape(temp3(:,20),20,length(temp3(:,20))/20),1);
  2170. clc;
  2171. ranksum(t1,t2)
  2172. ranksum(t1,t3)
  2173. ranksum(t2,t3)
  2174. figure; set(gcf,'Position',[1200 100 300 500]); hold on;
  2175. bar(1, mean(t1), 'FaceColor', color1, 'EdgeColor', 'none', 'BarWidth', 0.6);
  2176. plot([1 1],[mean(t1)-std(t1)/sqrt(length(t1)) mean(t1)+std(t1)/sqrt(length(t1))],'LineWidth',5,'Color','k');
  2177. plot(ones(1,length(t1))-0.1+rand(1,length(t1))/5,t1,'Marker','.','MarkerSize',38,'LineStyle','none','Color',color1/2);
  2178. bar(2, mean(t2), 'FaceColor', color2, 'EdgeColor', 'none', 'BarWidth', 0.6);
  2179. plot([2 2],[mean(t2)-std(t2)/sqrt(length(t2)) mean(t2)+std(t2)/sqrt(length(t2))],'LineWidth',5,'Color','k');
  2180. plot(2*ones(1,length(t2))-0.1+rand(1,length(t2))/5,t2,'Marker','.','MarkerSize',38,'LineStyle','none','Color',color2/2);
  2181. bar(3, mean(t3), 'FaceColor', color3, 'EdgeColor', 'none', 'BarWidth', 0.6);
  2182. plot([3 3],[mean(t3)-std(t3)/sqrt(length(t3)) mean(t3)+std(t3)/sqrt(length(t3))],'LineWidth',5,'Color','k');
  2183. plot(3*ones(1,length(t3))-0.1+rand(1,length(t3))/5,t3,'Marker','.','MarkerSize',38,'LineStyle','none','Color',color3/2);
  2184. plot([1 2],[0.25 0.25],'LineWidth',3,'Color','k');
  2185. text(1.5,0.251,'***','HorizontalAlignment','center','FontSize',64);
  2186. plot([1 3],[0.27 0.27],'LineWidth',3,'Color','k');
  2187. text(2,0.271,'*','HorizontalAlignment','center','FontSize',64);
  2188. % legend({'Barrel','Neighbour','Septa'},'FontSize',24);
  2189. axis([0.5 3.5 0 0.3]);
  2190. yticks([0 0.05 0.1 0.15 0.20 0.25 0.30 0.35 0.40]); yticklabels({'0' '0.05' '0.10' '0.15' '0.20' '0.25' '0.30' '0.35' '0.40'}); xticks([1 2 3]); xticklabels({'B' 'N' 'S'}); ylabel('MUA'); %xlabel('Pulse Number');
  2191. set(gca,'FontSize',24); set(gca,'TickDir','out');
  2192. exportgraphics(gcf,fullfile(saveFolder,'L23_WT_BSN_stat_last_pulse.png'),"Resolution",600);
  2193. t1_sw = mean(reshape(temp(:,1),20,length(temp(:,20))/20),1);
  2194. t2_sw = mean(reshape(temp2(:,1),20,length(temp2(:,20))/20),1);
  2195. t3_sw = mean(reshape(temp3(:,1),20,length(temp3(:,20))/20),1);
  2196. t1_mw = 100-100*mean(reshape(temp(:,20),20,length(temp(:,20))/20),1)./t1_sw;
  2197. t2_mw = 100-100*mean(reshape(temp2(:,20),20,length(temp2(:,20))/20),1)./t2_sw;
  2198. t3_mw = 100-100*mean(reshape(temp3(:,20),20,length(temp3(:,20))/20),1)./t3_sw;
  2199. signrank(t1_sw,t1_mw)
  2200. signrank(t2_sw,t2_mw)
  2201. signrank(t3_sw,t3_mw)
  2202. figure; set(gcf,'Position',[1200 100 450 400]); hold on;
  2203. bar(1, mean(t1_mw), 'FaceColor', color1, 'EdgeColor', 'none', 'BarWidth', 0.6);
  2204. plot([1 1],[mean(t1_mw)-std(t1_mw)/sqrt(length(t1_mw)) mean(t1_mw)+std(t1_mw)/sqrt(length(t1_mw))],'LineWidth',5,'Color','k');
  2205. plot(ones(1,length(t1_mw))-0.1+rand(1,length(t1_mw))/5,t1_mw,'Marker','.','MarkerSize',38,'LineStyle','none','Color',color1/2);
  2206. bar(2, mean(t2_mw), 'FaceColor', color2, 'EdgeColor', 'none', 'BarWidth', 0.6);
  2207. plot([2 2],[mean(t2_mw)-std(t2_mw)/sqrt(length(t2_mw)) mean(t2_mw)+std(t2_mw)/sqrt(length(t2_mw))],'LineWidth',5,'Color','k');
  2208. plot(2*ones(1,length(t2_mw))-0.1+rand(1,length(t2_mw))/5,t2_mw,'Marker','.','MarkerSize',38,'LineStyle','none','Color',color2/2);
  2209. bar(3, mean(t3_mw), 'FaceColor', color3, 'EdgeColor', 'none', 'BarWidth', 0.6);
  2210. plot([3 3],[mean(t3_mw)-std(t3_mw)/sqrt(length(t3_mw)) mean(t3_mw)+std(t3_mw)/sqrt(length(t3_mw))],'LineWidth',5,'Color','k');
  2211. plot(3*ones(1,length(t3_mw))-0.1+rand(1,length(t3_mw))/5,t3_mw,'Marker','.','MarkerSize',38,'LineStyle','none','Color',color3/2);
  2212. text(1,30,'***','HorizontalAlignment','center','FontSize',52,'Color','w');
  2213. text(2,30,'***','HorizontalAlignment','center','FontSize',52,'Color','w');
  2214. text(3,30,'**','HorizontalAlignment','center','FontSize',52,'Color','w');
  2215. % legend({'Barrel','Neighbour','Septa'},'FontSize',24);
  2216. axis([0.5 3.5 0 100]);
  2217. yticks(0:20:100);
  2218. xticks([1 2 3]); xticklabels({'B' 'N' 'S'}); ylabel('%Adaptation'); %xlabel('Pulse Number');
  2219. set(gca,'FontSize',36); set(gca,'TickDir','out');
  2220. exportgraphics(gcf,fullfile(saveFolder,'L23_WT_BSN_stat_Adaptation.png'),"Resolution",600);
  2221. %%
  2222. allPred_WT_L23 = [];
  2223. for stimNum = 1:20
  2224. d_WT = stimtrials_L23_WT(:,:,stimNum);
  2225. d_WT_Septa = stimtrials_L23_WT_septa(:,:,stimNum);
  2226. d_WT_Neigh = stimtrials_L23_WT_neigh(:,:,stimNum);
  2227. y1 = ones(1,size(d_WT,1));
  2228. y2 = 2*ones(1,size(d_WT_Septa,1));
  2229. y3 = 3*ones(1,size(d_WT_Neigh,1));
  2230. labelVector = repelem([{'Barrel'}, {'Septa'}, {'Neighbor'}],...
  2231. [size(d_WT,1) size(d_WT_Septa,1) size(d_WT_Neigh,1)])';
  2232. Y = labelVector;
  2233. X = [d_WT; d_WT_Septa; d_WT_Neigh];
  2234. tmp = templateEnsemble('GentleBoost',100,templateTree('surrogate','on'));
  2235. opt = statset('UseParallel',true);
  2236. ecoc = fitcecoc(X,Y,'Coding','onevsall','Learners',tmp,...
  2237. 'Prior','uniform','Options',opt);
  2238. cvecoc = crossval(ecoc,'Options',opt);
  2239. Yhat = kfoldPredict(cvecoc,'Options',opt);
  2240. figure;
  2241. ConfMat = confusionchart(Y,Yhat,'Title',sprintf('Pulse Number: %d',stimNum), ...
  2242. 'RowSummary','row-normalized', ...
  2243. 'ColumnSummary','column-normalized');
  2244. ConfMat.InnerPosition = [0.20 0.15 0.75 0.75];
  2245. ConfMat.FontSize = 24;
  2246. saveas(gcf, fullfile(saveFolder,sprintf('L23_WT_BSN_Decode_%d.png',stimNum),"Resolution",600));
  2247. close all;
  2248. allPred_WT_L23(:,:,stimNum) = confusionmat(Y,Yhat);
  2249. end
  2250. allPred_KO_L23 = [];
  2251. for stimNum = 1:20
  2252. d_WT = stimtrials_L23_KO(:,:,stimNum);
  2253. d_WT_Septa = stimtrials_L23_KO_septa(:,:,stimNum);
  2254. d_WT_Neigh = stimtrials_L23_KO_neigh(:,:,stimNum);
  2255. y1 = ones(1,size(d_WT,1));
  2256. y2 = 2*ones(1,size(d_WT_Septa,1));
  2257. y3 = 3*ones(1,size(d_WT_Neigh,1));
  2258. labelVector = repelem([{'Barrel'}, {'Septa'}, {'Neighbor'}],...
  2259. [size(d_WT,1) size(d_WT_Septa,1) size(d_WT_Neigh,1)])';
  2260. Y = labelVector;
  2261. X = [d_WT; d_WT_Septa; d_WT_Neigh];
  2262. tmp = templateEnsemble('GentleBoost',100,templateTree('surrogate','on'));
  2263. opt = statset('UseParallel',true);
  2264. ecoc = fitcecoc(X,Y,'Coding','onevsall','Learners',tmp,...
  2265. 'Prior','uniform','Options',opt);
  2266. cvecoc = crossval(ecoc,'Options',opt);
  2267. Yhat = kfoldPredict(cvecoc,'Options',opt);
  2268. figure;
  2269. ConfMat = confusionchart(Y,Yhat,'Title',sprintf('Pulse Number: %d',stimNum), ...
  2270. 'RowSummary','row-normalized', ...
  2271. 'ColumnSummary','column-normalized');
  2272. ConfMat.InnerPosition = [0.20 0.15 0.75 0.75];
  2273. ConfMat.FontSize = 24;
  2274. saveas(gcf, fullfile(saveFolder,sprintf('L23_KO_BSN_Decode_%d.png',stimNum),"Resolution",600));
  2275. close all;
  2276. allPred_KO_L23(:,:,stimNum) = confusionmat(Y,Yhat);
  2277. end
  2278. allPred_WT_L4 = [];
  2279. for stimNum = 1:20
  2280. d_WT = stimtrials_L4_WT(:,:,stimNum);
  2281. d_WT_Septa = stimtrials_L4_WT_septa(:,:,stimNum);
  2282. d_WT_Neigh = stimtrials_L4_WT_neigh(:,:,stimNum);
  2283. y1 = ones(1,size(d_WT,1));
  2284. y2 = 2*ones(1,size(d_WT_Septa,1));
  2285. y3 = 3*ones(1,size(d_WT_Neigh,1));
  2286. labelVector = repelem([{'Barrel'}, {'Septa'}, {'Neighbor'}],...
  2287. [size(d_WT,1) size(d_WT_Septa,1) size(d_WT_Neigh,1)])';
  2288. Y = labelVector;
  2289. X = [d_WT; d_WT_Septa; d_WT_Neigh];
  2290. tmp = templateEnsemble('GentleBoost',100,templateTree('surrogate','on'));
  2291. opt = statset('UseParallel',true);
  2292. ecoc = fitcecoc(X,Y,'Coding','onevsall','Learners',tmp,...
  2293. 'Prior','uniform','Options',opt);
  2294. cvecoc = crossval(ecoc,'Options',opt);
  2295. Yhat = kfoldPredict(cvecoc,'Options',opt);
  2296. figure;
  2297. ConfMat = confusionchart(Y,Yhat,'Title',sprintf('Pulse Number: %d',stimNum), ...
  2298. 'RowSummary','row-normalized', ...
  2299. 'ColumnSummary','column-normalized');
  2300. ConfMat.InnerPosition = [0.20 0.15 0.75 0.75];
  2301. ConfMat.FontSize = 24;
  2302. saveas(gcf, fullfile(saveFolder,sprintf('L4_WT_BSN_Decode_%d.png',stimNum),"Resolution",600));
  2303. close all;
  2304. allPred_WT_L4(:,:,stimNum) = confusionmat(Y,Yhat);
  2305. end
  2306. allPred_KO_L4 = [];
  2307. for stimNum = 1:20
  2308. d_WT = stimtrials_L4_KO(:,:,stimNum);
  2309. d_WT_Septa = stimtrials_L4_KO_septa(:,:,stimNum);
  2310. d_WT_Neigh = stimtrials_L4_KO_neigh(:,:,stimNum);
  2311. y1 = ones(1,size(d_WT,1));
  2312. y2 = 2*ones(1,size(d_WT_Septa,1));
  2313. y3 = 3*ones(1,size(d_WT_Neigh,1));
  2314. labelVector = repelem([{'Barrel'}, {'Septa'}, {'Neighbor'}],...
  2315. [size(d_WT,1) size(d_WT_Septa,1) size(d_WT_Neigh,1)])';
  2316. Y = labelVector;
  2317. X = [d_WT; d_WT_Septa; d_WT_Neigh];
  2318. tmp = templateEnsemble('GentleBoost',100,templateTree('surrogate','on'));
  2319. opt = statset('UseParallel',true);
  2320. ecoc = fitcecoc(X,Y,'Coding','onevsall','Learners',tmp,...
  2321. 'Prior','uniform','Options',opt);
  2322. cvecoc = crossval(ecoc,'Options',opt);
  2323. Yhat = kfoldPredict(cvecoc,'Options',opt);
  2324. figure;
  2325. ConfMat = confusionchart(Y,Yhat,'Title',sprintf('Pulse Number: %d',stimNum), ...
  2326. 'RowSummary','row-normalized', ...
  2327. 'ColumnSummary','column-normalized');
  2328. ConfMat.InnerPosition = [0.20 0.15 0.75 0.75];
  2329. ConfMat.FontSize = 24;
  2330. saveas(gcf, fullfile(saveFolder,sprintf('L4_KO_BSN_Decode_%d.png',stimNum),"Resolution",600));
  2331. close all;
  2332. allPred_KO_L4(:,:,stimNum) = confusionmat(Y,Yhat);
  2333. end
  2334. allPred_WT_L5 = [];
  2335. for stimNum = 1:20
  2336. d_WT = stimtrials_L5_WT(:,:,stimNum);
  2337. d_WT_Septa = stimtrials_L5_WT_septa(:,:,stimNum);
  2338. d_WT_Neigh = stimtrials_L5_WT_neigh(:,:,stimNum);
  2339. y1 = ones(1,size(d_WT,1));
  2340. y2 = 2*ones(1,size(d_WT_Septa,1));
  2341. y3 = 3*ones(1,size(d_WT_Neigh,1));
  2342. labelVector = repelem([{'Barrel'}, {'Septa'}, {'Neighbor'}],...
  2343. [size(d_WT,1) size(d_WT_Septa,1) size(d_WT_Neigh,1)])';
  2344. Y = labelVector;
  2345. X = [d_WT; d_WT_Septa; d_WT_Neigh];
  2346. tmp = templateEnsemble('GentleBoost',100,templateTree('surrogate','on'));
  2347. opt = statset('UseParallel',true);
  2348. ecoc = fitcecoc(X,Y,'Coding','onevsall','Learners',tmp,...
  2349. 'Prior','uniform','Options',opt);
  2350. cvecoc = crossval(ecoc,'Options',opt);
  2351. Yhat = kfoldPredict(cvecoc,'Options',opt);
  2352. figure;
  2353. ConfMat = confusionchart(Y,Yhat,'Title',sprintf('Pulse Number: %d',stimNum), ...
  2354. 'RowSummary','row-normalized', ...
  2355. 'ColumnSummary','column-normalized');
  2356. ConfMat.InnerPosition = [0.20 0.15 0.75 0.75];
  2357. ConfMat.FontSize = 24;
  2358. saveas(gcf, fullfile(saveFolder,sprintf('L5_WT_BSN_Decode_%d.png',stimNum),"Resolution",600));
  2359. close all;
  2360. allPred_WT_L5(:,:,stimNum) = confusionmat(Y,Yhat);
  2361. end
  2362. allPred_KO_L5 = [];
  2363. for stimNum = 1:20
  2364. d_WT = stimtrials_L5_KO(:,:,stimNum);
  2365. d_WT_Septa = stimtrials_L5_KO_septa(:,:,stimNum);
  2366. d_WT_Neigh = stimtrials_L5_KO_neigh(:,:,stimNum);
  2367. y1 = ones(1,size(d_WT,1));
  2368. y2 = 2*ones(1,size(d_WT_Septa,1));
  2369. y3 = 3*ones(1,size(d_WT_Neigh,1));
  2370. labelVector = repelem([{'Barrel'}, {'Septa'}, {'Neighbor'}],...
  2371. [size(d_WT,1) size(d_WT_Septa,1) size(d_WT_Neigh,1)])';
  2372. Y = labelVector;
  2373. X = [d_WT; d_WT_Septa; d_WT_Neigh];
  2374. tmp = templateEnsemble('GentleBoost',100,templateTree('surrogate','on'));
  2375. opt = statset('UseParallel',true);
  2376. ecoc = fitcecoc(X,Y,'Coding','onevsall','Learners',tmp,...
  2377. 'Prior','uniform','Options',opt);
  2378. cvecoc = crossval(ecoc,'Options',opt);
  2379. Yhat = kfoldPredict(cvecoc,'Options',opt);
  2380. figure;
  2381. ConfMat = confusionchart(Y,Yhat,'Title',sprintf('Pulse Number: %d',stimNum), ...
  2382. 'RowSummary','row-normalized', ...
  2383. 'ColumnSummary','column-normalized');
  2384. ConfMat.InnerPosition = [0.20 0.15 0.75 0.75];
  2385. ConfMat.FontSize = 24;
  2386. saveas(gcf, fullfile(saveFolder,sprintf('L5_KO_BSN_Decode_%d.png',stimNum),"Resolution",600));
  2387. close all;
  2388. allPred_KO_L5(:,:,stimNum) = confusionmat(Y,Yhat);
  2389. end
  2390. figure , plot(allPred_WT_L23(:));
  2391. hold on, plot(allPred_KO_L23(:));
  2392. figure; hold on;
  2393. for i = 1:9
  2394. plot(allPred_WT_L23(i,:));
  2395. end
  2396. figure , plot(squeeze(allPred_WT_L23(1,1,:))/allPred_WT_L23(1,1,1),'Color',colorBarrel,'LineWidth',3);
  2397. hold on, plot(squeeze(allPred_WT_L23(2,2,:))/allPred_WT_L23(2,2,1),'Color',colorNeigh ,'LineWidth',3);
  2398. hold on, plot(squeeze(allPred_WT_L23(3,3,:))/allPred_WT_L23(3,3,1),'Color',colorSepta ,'LineWidth',3);
  2399. figure , plot(squeeze(allPred_KO_L23(1,1,:))/allPred_KO_L23(1,1,1),'Color',colorBarrelKO,'LineWidth',3);
  2400. hold on, plot(squeeze(allPred_KO_L23(2,2,:))/allPred_KO_L23(2,2,1),'Color',colorNeighKO ,'LineWidth',3);
  2401. hold on, plot(squeeze(allPred_KO_L23(3,3,:))/allPred_KO_L23(3,3,1),'Color',colorSeptaKO ,'LineWidth',3);
  2402. %%
  2403. [Y2, scores] = kfoldPredict(cvecoc,'Options',opt);
  2404. %% plot ROCs
  2405. figure; hold on;
  2406. for i = 1:length(ecoc.ClassNames)
  2407. [xr, yr, ~, auc] = perfcurve(Y2,scores(:, i), ecoc.ClassNames(i));
  2408. auc
  2409. plot(xr, yr, 'linewidth', 1);
  2410. legends{i} = sprintf('AUC for %s class: %.3f', ecoc.ClassNames(i), auc);
  2411. end
  2412. legend(legends, 'location', 'southeast')
  2413. line([0 1], [0 1], 'linestyle', ':', 'color', 'k');
  2414. xlabel('FPR'), ylabel('TPR')
  2415. title('ROC for Iris Classification (1 vs Others)')
  2416. axis square
  2417. [~,score_nb] = resubPredict(ecoc);
  2418. mdlSVM = fitPosterior(ecoc);
  2419. [Xnb,Ynb,Tnb,AUCnb] = perfcurve(Y,score_nb(:,ecoc.ClassNames),'true');
  2420. [X,Y,T,AUC] = perfcurve(species(51:end,:),scores,'virginica');
  2421. figure , plot(squeeze(allPred_WT(1,1,:)),'Color',colorBarrel,'LineWidth',3);
  2422. hold on, plot(squeeze(allPred_WT(2,2,:)),'Color',colorSepta,'LineWidth',3);
  2423. hold on, plot(squeeze(allPred_WT(3,3,:)),'Color',colorNeigh,'LineWidth',3);
  2424. figure , plot(squeeze(allPred_KO(1,1,:)),'Color',colorBarrelKO,'LineWidth',3);
  2425. hold on, plot(squeeze(allPred_KO(2,2,:)),'Color',colorSeptaKO,'LineWidth',3);
  2426. hold on, plot(squeeze(allPred_KO(3,3,:)),'Color',colorNeighKO,'LineWidth',3);
  2427. %%
  2428. figure , plot(squeeze(mean(norm_stimtrials_L23_WT(:,:,1),1)),'LineWidth',2);
  2429. hold on, plot(squeeze(mean(norm_stimtrials_L23_WT_septa(:,:,1),1)),'LineWidth',2);
  2430. hold on, plot(squeeze(mean(norm_stimtrials_L23_WT_neigh(:,:,1),1)),'LineWidth',2);
  2431. figure , plot(squeeze(mean(norm_stimtrials_L23_WT(:,:,2),1)),'LineWidth',2);
  2432. hold on, plot(squeeze(mean(norm_stimtrials_L23_WT_septa(:,:,2),1)),'LineWidth',2);
  2433. hold on, plot(squeeze(mean(norm_stimtrials_L23_WT_neigh(:,:,2),1)),'LineWidth',2);
  2434. figure , plot(squeeze(mean(norm_stimtrials_L23_KO(:,:,1),1)),'LineWidth',2);
  2435. hold on, plot(squeeze(mean(norm_stimtrials_L23_KO_septa(:,:,1),1)),'LineWidth',2);
  2436. hold on, plot(squeeze(mean(norm_stimtrials_L23_KO_neigh(:,:,1),1)),'LineWidth',2);
  2437. figure , plot(squeeze(mean(norm_stimtrials_L23_KO(:,:,2),1)),'LineWidth',2);
  2438. hold on, plot(squeeze(mean(norm_stimtrials_L23_KO_septa(:,:,2),1)),'LineWidth',2);
  2439. hold on, plot(squeeze(mean(norm_stimtrials_L23_KO_neigh(:,:,2),1)),'LineWidth',2);
  2440. %%
  2441. figure , imagesc(squeeze(mean(norm_stimtrials_L23_WT,1))',[0 0.5]); colormap hot;
  2442. hold on, imagesc(squeeze(mean(norm_stimtrials_L23_WT_septa,1))',[0 0.5]); colormap hot;
  2443. hold on, imagesc(squeeze(mean(norm_stimtrials_L23_WT_neigh,1))',[0 0.5]); colormap hot;
  2444. figure, imagesc(squeeze(mean(norm_stimtrials_L23_KO,1))'-squeeze(mean(norm_stimtrials_L23_WT,1))',[-0.25 0.25]); colormap hot;
  2445. figure, imagesc(squeeze(mean(norm_stimtrials_L4_KO,1))'-squeeze(mean(norm_stimtrials_L4_WT,1))',[-0.25 0.25]); colormap hot;
  2446. figure, imagesc(squeeze(mean(norm_stimtrials_L5_KO,1))'-squeeze(mean(norm_stimtrials_L5_WT,1))',[-0.25 0.25]); colormap hot;
  2447. figure, imagesc((squeeze(mean(norm_stimtrials_L23_KO,1))'-squeeze(mean(norm_stimtrials_L23_WT,1))')...
  2448. -(squeeze(mean(norm_stimtrials_L4_KO,1))'-squeeze(mean(norm_stimtrials_L4_WT,1))'),[-0.25 0.25]); colormap hot;
  2449. gprMdl = fitrgp((1:96)',squeeze(mean(norm_stimtrials_L23_KO(:,:,1),1)),'Basis','linear',...
  2450. 'FitMethod','exact','PredictMethod','exact');
  2451. ypred = resubPredict(gprMdl);
  2452. figure;
  2453. plot(1:96,squeeze(mean(norm_stimtrials_L23_KO(:,:,1),1))','b.');
  2454. hold on;
  2455. plot(1:96,ypred,'r','LineWidth',1.5);

Source Code 3.m, no license · at the source

Overview

Authors: Ali Özgür Argunşah1,2, Tevye Jason Stachniak1,2,3, Jenq-Wei Yang1,2, Linbi Cai1,2, Alexander van der Bourg1,2, Rahel Kastli1,2,4, Theofanis Karayannis1,2,5
  1. Laboratory of Neural Circuit Assembly, Brain Research Institute, University of Zurich Winterthurerstrasse, Zurich, Switzerland
  2. Neuroscience Center Zurich, University of Zurich and ETH Zurich, Winterthurerstrasse, Zurich, Switzerland
  3. Division of Biomedical Sciences, Faculty of Medicine, Memorial University of Newfoundland, St. John's, Canada
  4. Department of Stem Cell & Regenerative Biology, Harvard University, Cambridge, United States
  5. University Research Priority Program (URPP), Adaptive Brain Circuits in Development and Learning, University of Zurich, Zurich, Switzerland
Institutions: University of Zurich (Switzerland); ETH Zurich (Switzerland); Memorial University of Newfoundland (Canada); Harvard University (United States)
Journal: eLife, volume 14, article RP107099
Dates: published online 18 August 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.7554/elife.107099 · PMID 42610441 · PMCID PMC13485306 · OpenAlex W4411340734
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: mouse (organism), systems (subfield)
Methods: Spectral & time-frequency, Statistics, Smoothing, state filtering, decompositions, Machine learning, Evoked potentials, fMRI & imaging, Single-unit activity, calcium imaging
Keywords: Mouse
MeSH: Somatosensory Cortex*, Touch Perception*, Vibrissae*, Animals, Interneurons, Mice, Mice, Knockout (* major topic)
Topic: Neural dynamics and brain function (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Funding: European Research Council (10.3030/679175, 679175); Swiss National Science Foundation (S-41260-01-01)
Citations: cited by 1 paper (Europe PMC); 80 references in the paper
Research resources: C57BL6J RRID:IMSR_JAX:000664, Ai14 RRID:IMSR_JAX:007914, VIP-IRES-Cre RRID:IMSR_JAX:010908, SST-IRES-Cre RRID:IMSR_JAX:013044, MATLAB RRID:SCR_001622, Fiji RRID:SCR_002285, Imaris RRID:SCR_007370, Icy RRID:SCR_010587, ScanImage RRID:SCR_014307, MC Rack RRID:SCR_014955, Agarose (type III-A) RRID:SCR_028585

Abstract

Mice, like humans, enhance tactile perception through repeated sampling of spatially segregated sensory inputs. In the whisker system, individual whisker identity is preserved along the whisker-brainstem-thalamus-cortex pathway, culminating in distinct cortical domains: barrels and septa. Using simultaneous in vivo recordings from barrel and septal domains, we identify a progressive divergence in spiking activity during repeated single- and multi-whisker stimulation. While the multi- to single-whisker response ratio remains stable in barrels, it increases progressively in septa, suggesting recruitment of local inhibitory circuits. Genetic fate mapping and tissue clearing revealed distinct laminar and regional distributions of SST+ and VIP+ interneurons in barrel and septal domains. Calcium imaging showed that both interneuron types respond to whisker stimulation, but SST+ interneurons were preferentially recruited during repeated multi-whisker stimulation. Deletion of Elfn1, a regulator of excitatory synaptic dynamics onto SST+ interneurons, abolished the progressive increase in septal multi- to single-whisker response ratios. Temporal decoding analyses further demonstrated a loss of barrel-septa functional segregation in Elfn1 knockout mice. Finally, viral tracing combined with whole-brain clearing revealed distinct projection patterns from barrels and septa to secondary somatosensory (S2) and motor (M1) cortices. Together, these findings support a model in which Elfn1-dependent recruitment of SST+ interneurons contributes to preferential multi-whisker integration and functional specialization within the mouse somatosensory cortex.

Reproduced under the paper's license (CC BY), from the paper cited above.

Repositories

Its files are read in the Code ↔ Paper reader above, with 3 matches between paragraphs and lines of code.

supp:PMC13485306/elife-107099-code1.zip

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Languages: MATLAB (1)
Size: 1 file, 1 script
Software Heritage: not checked
Found in: the supplementary material
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
  • 27 September 2026: the link answers (HTTP 200)
1 file

supp:PMC13485306/elife-107099-code2.zip

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Languages: MATLAB (1)
Size: 1 file, 1 script
Software Heritage: not checked
Found in: the supplementary material
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
  • 27 September 2026: the link answers (HTTP 200)
1 file

supp:PMC13485306/elife-107099-code3.zip

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Languages: MATLAB (1)
Size: 1 file, 1 script
Software Heritage: not checked
Found in: the supplementary material
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
  • 27 September 2026: the link answers (HTTP 200)
1 file

supp:PMC13485306/elife-107099-code5.zip

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Languages: MATLAB (1)
Size: 1 file, 1 script
Software Heritage: not checked
Found in: the supplementary material
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
  • 27 September 2026: the link answers (HTTP 200)
1 file

supp:PMC13485306/elife-107099-code6.zip

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Languages: MATLAB (1)
Size: 1 file, 1 script
Software Heritage: not checked
Found in: the supplementary material
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
  • 27 September 2026: the link answers (HTTP 200)
1 file

The paper's code and data availability statement is in the Data section.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 5 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 5 scripts, each with its path and the digest of its content;
  • 3 matches between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

Datasets cited

Data availability

All data generated and analyzed during this study are available in the Dryad Digital Repository at https://doi.org/10.5061/dryad.4qrfj6qt8. Custom MATLAB scripts used for data processing, statistical analysis, decoding, and figure generation are provided as Supplementary Source Code files.

The following dataset was generated:

Argunşah A, Stachniak T, Yang J, Cai L, van der Bourg A, Kastli R, Karayannis T. 2026. Data from: Local inhibitory dynamics underpin temporal integration and functional segregation between barrels and septa in the mouse barrel cortex. Dryad Digital Repository.

Reproduced under the paper's license (CC BY), from the paper cited above.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 1, 27 September 2026: the first record

Recorded: type, language, journal, volume, pages, dates, 7 authors, 1 keyword, 7 MeSH terms, 2 funders, 80 references, 11 RRIDs.

Cite

This paper

Argunşah, A. Ö., Stachniak, T. J., Yang, J.-W., Cai, L., van der Bourg, A., Kastli, R., & Karayannis, T. (2026). Local inhibitory dynamics underpin temporal integration and functional segregation between barrels and septa in the mouse barrel cortex. eLife, 14, RP107099. https://doi.org/10.7554/elife.107099

BibTeX

@article{argunsah2026local,
author = {Argunşah, Ali Özgür and Stachniak, Tevye Jason and Yang, Jenq-Wei and Cai, Linbi and van der Bourg, Alexander and Kastli, Rahel and Karayannis, Theofanis},
title = {{Local inhibitory dynamics underpin temporal integration and functional segregation between barrels and septa in the mouse barrel cortex}},
journal = {eLife},
year = {2026},
month = aug,
volume = {14},
pages = {RP107099},
publisher = {eLife Sciences Publications, Ltd},
issn = {2050-084X},
doi = {10.7554/elife.107099},
url = {https://doi.org/10.7554/elife.107099},
pmid = {42610441},
pmcid = {PMC13485306}
}

RIS

TY - JOUR
AU - Argunşah, Ali Özgür
AU - Stachniak, Tevye Jason
AU - Yang, Jenq-Wei
AU - Cai, Linbi
AU - van der Bourg, Alexander
AU - Kastli, Rahel
AU - Karayannis, Theofanis
TI - Local inhibitory dynamics underpin temporal integration and functional segregation between barrels and septa in the mouse barrel cortex
T2 - eLife
J2 - Elife
PY - 2026
DA - 2026/08/18
VL - 14
SP - RP107099
SN - 2050-084X
PB - eLife Sciences Publications, Ltd
DO - 10.7554/elife.107099
UR - https://doi.org/10.7554/elife.107099
LA - en
ER -

CSL-JSON

{
"id": "10.7554/elife.107099",
"type": "article-journal",
"title": "Local inhibitory dynamics underpin temporal integration and functional segregation between barrels and septa in the mouse barrel cortex",
"container-title": "eLife",
"author": [
{
"family": "Argunşah",
"given": "Ali Özgür"
},
{
"family": "Stachniak",
"given": "Tevye Jason"
},
{
"family": "Yang",
"given": "Jenq-Wei"
},
{
"family": "Cai",
"given": "Linbi"
},
{
"family": "van der Bourg",
"given": "Alexander"
},
{
"family": "Kastli",
"given": "Rahel"
},
{
"family": "Karayannis",
"given": "Theofanis"
}
],
"container-title-short": "Elife",
"volume": "14",
"page": "RP107099",
"DOI": "10.7554/elife.107099",
"PMID": "42610441",
"PMCID": "PMC13485306",
"ISSN": "2050-084X",
"publisher": "eLife Sciences Publications, Ltd",
"URL": "https://doi.org/10.7554/elife.107099",
"language": "en",
"issued": {
"date-parts": [
[
2026,
8,
18
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.34133/research.1295
A Corticotectal Pathway Regulates Vibrissal Somatosensory-Mediated Predatory Hunting Learning.
Journal: Research (Washington, D.C.)
In common: 6 references
[2] doi:10.3389/fnins.2026.1605209 [code]
Spiking neural networks provide accurate and time-efficient models for whisker stimulus classification of the awake mouse.
Journal: Frontiers in neuroscience
In common: Signal Processing Toolbox, mouse, 4 references
[3] doi:10.1038/s42003-026-10418-2 [code]
Cortical PV and VIP interneurons similarly influence SST neuron output despite distinct unitary properties.
Journal: Communications biology
In common: mouse, 5 references
[4] doi:10.1038/s41467-026-73622-y [code]
Contextual gating of whisker-evoked responses by frontal cortex supports flexible decision making.
Journal: Nature communications
In common: Signal Processing Toolbox, Statistics and Machine Learning Toolbox, mouse, 3 references
[5] doi:10.1038/s41467-026-71331-0 [code]
A multimodal approach for visualizing and identifying electrophysiological cell types in vivo.
Journal: Nature communications
In common: mouse, 4 references
[6] doi:10.1371/journal.pcbi.1014164 [code]
'Backpropagation and the brain' realized in cortical error neuron microcircuits.
Journal: PLoS computational biology
In common: 4 references
[7] doi:10.1016/j.crmeth.2026.101481 [code]
A hybrid micro-ECoG for functionally targeted multi-site and multi-scale investigation.
Journal: Cell reports methods
In common: Signal Processing Toolbox, Statistics and Machine Learning Toolbox, systems, 2 references
[8] doi:10.1371/journal.pbio.3003789 [code]
Encoding performance of cortical neurons critically depends on their morphological and neurophysiological properties.
Journal: PLoS biology
In common: systems, mouse, 3 references
[9] doi:10.1038/s41467-026-77800-w [code]
Learning reorganizes dendritic and stabilizes axon initial segment inhibitory synapses in CA1 pyramidal neurons.
Journal: Nature communications
In common: mouse, author Ali Öztürk Argunşah
[10] doi:10.1038/s41586-026-10877-x [code]
Human brain organoids record the passage of time over multiple years.
Journal: Nature
In common: author Rahel Kastli

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.

Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.