SFig5D-F.m 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  1. % plot FTCs and histograms for all data
  2. close all;
  3. clear;
  4. % FT curves and the respective classification to pure tones
  5. aw=load('class_FT-aw'); aw=aw.class_FT;
  6. int=load('class_FT-int'); int=int.class_FT;
  7. chi=load('class_FT-chi'); chi=chi.class_FT;
  8. pt=load('class_FT-pt'); pt=pt.class_FT;
  9. pair=load('class_FT-pair'); pair=pair.class_FT;
  10. % classification in response to natural sounds
  11. intN=load('all_data.mat'); intN=intN.all_di;
  12. chiN=load('chi_data.mat'); chiN=chiN.all_di;
  13. ptN=load('pt_data.mat'); ptN=ptN.all_di;
  14. pairN=load('pair_data.mat'); pairN=pairN.all_di;
  15. % classification lists
  16. awN=intN(intN(:,3)==0,1:2);
  17. intN=intN(intN(:,3)==1,1:2);
  18. chiN=chiN(chiN(:,3)==0,1:2);
  19. ptN=ptN(ptN(:,3)==2,1:2);
  20. pairN=pairN(pairN(:,3)==0,1:2);
  21. %% create matrix to plot stack bar plots and FTC of one classification
  22. class_to_plot=0;
  23. % awake data set
  24. combi_aw=zeros(5,3); % rows: natural class / cols: FTC class
  25. ftc_class_aw=nan(100,18); % rows: units / cols: FTC
  26. n_units=aw(:,1);
  27. n=numel(n_units);
  28. k=1;
  29. for i = 1:n
  30. unit=n_units(i);
  31. class_=awN(awN(:,1)==unit,2)+1;
  32. ftc_=aw(aw(:,1)==unit,2);
  33. if class_~= 0
  34. combi_aw(class_,ftc_)=combi_aw(class_,ftc_)+1;
  35. end
  36. if class_-1 == class_to_plot
  37. ftc_class_aw(k,:)=aw(aw(:,1)==unit,2:19);
  38. k=k+1;
  39. end
  40. end
  41. % anesthetized data set
  42. combi_int=zeros(5,3); % rows: class / cols: FTC
  43. ftc_class_int=nan(100,18); % rows: units / cols: FTC
  44. n_units=int(:,1);
  45. n=numel(n_units);
  46. k=1;
  47. for i = 1:n
  48. unit=n_units(i);
  49. class_=intN(intN(:,1)==unit,2)+1;
  50. ftc_=int(int(:,1)==unit,2);
  51. if class_~= 0
  52. combi_int(class_,ftc_)=combi_int(class_,ftc_)+1;
  53. end
  54. if class_-1 == class_to_plot
  55. ftc_class_int(k,:)=int(int(:,1)==unit,2:19);
  56. k=k+1;
  57. end
  58. end
  59. % paired chimeras data set
  60. combi_chi=zeros(5,3); % rows: class / cols: FTC
  61. ftc_class_chi=nan(100,18); % rows: units / cols: FTC
  62. n_units=chi(:,1);
  63. n=numel(n_units);
  64. k=1;
  65. for i = 1:n
  66. unit=n_units(i);
  67. class_=chiN(chiN(:,1)==unit,2)+1;
  68. ftc_=chi(chi(:,1)==unit,2);
  69. if class_~= 0
  70. combi_chi(class_,ftc_)=combi_chi(class_,ftc_)+1;
  71. end
  72. if class_-1 == class_to_plot
  73. ftc_class_chi(k,:)=chi(chi(:,1)==unit,2:19);
  74. k=k+1;
  75. end
  76. end
  77. % pure tones data set
  78. combi_pt=zeros(5,3); % rows: class / cols: FTC
  79. ftc_class_pt=nan(100,18); % rows: units / cols: FTC
  80. n_units=ptN(:,1);
  81. n=numel(n_units);
  82. k=1;
  83. for i = 1:n
  84. unit=n_units(i);
  85. class_=ptN(ptN(:,1)==unit,2)+1;
  86. ftc_=pt(pt(:,1)==unit,2);
  87. if class_~= 0
  88. combi_pt(class_,ftc_)=combi_pt(class_,ftc_)+1;
  89. end
  90. if class_-1 == class_to_plot
  91. ftc_class_pt(k,:)=pt(pt(:,1)==unit,2:19);
  92. k=k+1;
  93. end
  94. end
  95. % all data sets together for anesthetized data
  96. combi=combi_int+combi_pt; % +combi_chi %rows: natural class / cols: FTC class
  97. ftc_class=[ftc_class_int;ftc_class_chi;ftc_class_pt];
  98. ftc_class = ftc_class(any(~isnan(ftc_class),2),:);
  99. %% plotting # units awake and anesthetized
  100. red =[0.8500 0.3250 0.0980];
  101. blue=[0 0.4470 0.7410];
  102. yellow=[0.9294 0.6941 0.1255];
  103. dataset=combi_aw;
  104. figure(1); set(gcf, 'Position', [200, 200, 320, 180])
  105. subplot(121)
  106. b=bar(dataset([2,3,4,5,1],[3,1,2]),'stacked', 'FaceColor','flat');
  107. b(1).CData =yellow; % multipeaked
  108. b(2).CData=blue; % LF tuned
  109. b(3).CData=red; % HF tuned
  110. ylabel('# of units')
  111. xticklabels({'ech','com','ech>com','com>ech','ech=com'})
  112. set(gca, 'box', 'off')
  113. set(gca, 'Color','none')
  114. set(gca,'linewidth',1);set(gca,'fontsize',8);
  115. legend('multi.','LF','HF','Location','northwest','box','off');
  116. dataset=combi;
  117. subplot(122)
  118. b=bar(dataset([2,3,4,5,1],[3,1,2]),'stacked', 'FaceColor','flat');
  119. b(1).CData =yellow; % multipeaked
  120. b(2).CData=blue; % LF tuned
  121. b(3).CData=red; % HF tuned
  122. xticklabels({'ech','com','ech>com','com>ech','ech=com'})
  123. ylim([0 50])
  124. set(gca, 'box', 'off')
  125. set(gca, 'Color','none')
  126. set(gca,'linewidth',1);set(gca,'fontsize',8);
  127. % exportgraphics(gcf,'E:\Users\User\Desktop\delay paper\anesthetized\figures_paper\class_FTC_numb.pdf',...
  128. % 'Resolution',300','ContentType','vector','BackgroundColor','none')
  129. %% plotting 'equally responsive' neurons % of FTC
  130. dataset_an=combi;
  131. dataset_aw=combi_aw;
  132. combi_class=[dataset_aw(1,[3,1,2]);dataset_an(1,[3,1,2])];
  133. combi_class=combi_class./(sum(combi_class,2))*100;
  134. figure(2); set(gcf, 'Position', [200, 200, 60, 180])
  135. b=bar(combi_class,'stacked', 'FaceColor','flat');
  136. b(1).CData =yellow; % multipeaked
  137. b(2).CData=blue; % LF tuned
  138. b(3).CData=red; % HF tuned
  139. ylabel('% of units')
  140. xticklabels({'awake','anesthetized'})
  141. xlim([0.2 2.8])
  142. set(gca, 'box', 'off')
  143. set(gca, 'Color','none')
  144. set(gca,'linewidth',1);set(gca,'fontsize',8);
  145. % legend('multi.','LF','HF','Location','northwest','box','off');
  146. % exportgraphics(gcf,'E:\Users\User\Desktop\delay paper\anesthetized\figures_paper\class_FTC_perc.pdf',...
  147. % 'Resolution',300','ContentType','vector','BackgroundColor','none')
  148. %% plotting FTCs
  149. dataset=ftc_class_aw;
  150. lf_=dataset(:,1)==1;
  151. hf_=dataset(:,1)==2;
  152. mf_=dataset(:,1)==3;
  153. x=10:5:90;
  154. figure(3); set(gcf, 'Position', [200, 200, 300, 180])
  155. subplot(221)
  156. A=dataset(lf_,2:18);
  157. % plot(x,A','color',[0.6 0.6 0.6]); hold on
  158. y=[nanmean(A,1)-nanstd(A,1)/sqrt(size(A,1)); nanmean(A,1); nanmean(A,1)+nanstd(A,1)/sqrt(size(A,1))];
  159. px=[x,fliplr(x)];
  160. py=[y(1,:), fliplr(y(3,:))];
  161. patch(px,py,1,'FaceColor',blue,'EdgeColor','none'); hold on
  162. plot(x,y(2,:),'Color',blue);
  163. alpha(.2);
  164. xlim([8 92])
  165. % ylim([-0.05 1.05])
  166. text(50,0.75,['n=' num2str(size(A,1))],'fontsize',8)
  167. % ylabel('Norm. response')
  168. % title('\fontsize{8}LF-tuned','FontWeight', 'Normal')
  169. set(gca, 'box', 'off')
  170. set(gca, 'Color','none')
  171. set(gca,'linewidth',1);set(gca,'fontsize',8);
  172. subplot(222)
  173. A=dataset(mf_,2:18);
  174. % plot(x,A','color',[0.6 0.6 0.6]); hold on
  175. y=[nanmean(A,1)-nanstd(A,1)/sqrt(size(A,1)); nanmean(A,1); nanmean(A,1)+nanstd(A,1)/sqrt(size(A,1))];
  176. px=[x,fliplr(x)];
  177. py=[y(1,:), fliplr(y(3,:))];
  178. patch(px,py,1,'FaceColor',yellow,'EdgeColor','none'); hold on
  179. plot(x,y(2,:),'Color',yellow);
  180. alpha(.2);
  181. xlim([8 92])
  182. % ylim([-0.05 1.05])
  183. text(50,0.75,['n=' num2str(size(A,1))],'fontsize',8)
  184. % title('\fontsize{8}multipeaked','FontWeight', 'Normal')
  185. set(gca, 'box', 'off')
  186. set(gca, 'Color','none')
  187. set(gca,'linewidth',1);set(gca,'fontsize',8);
  188. dataset=ftc_class;
  189. lf_=dataset(:,1)==1;
  190. hf_=dataset(:,1)==2;
  191. mf_=dataset(:,1)==3;
  192. x=10:5:90;
  193. subplot(223)
  194. A=dataset(lf_,2:18);
  195. % plot(x,A','color',[0.6 0.6 0.6]); hold on
  196. y=[nanmean(A,1)-nanstd(A,1)/sqrt(size(A,1)); nanmean(A,1); nanmean(A,1)+nanstd(A,1)/sqrt(size(A,1))];
  197. px=[x,fliplr(x)];
  198. py=[y(1,:), fliplr(y(3,:))];
  199. patch(px,py,1,'FaceColor',blue,'EdgeColor','none'); hold on
  200. plot(x,y(2,:),'Color',blue);
  201. alpha(.2);
  202. xlim([8 92])
  203. % ylim([-0.05 1.05])
  204. xlabel('Freq. (kHz)')
  205. text(50,0.75,['n=' num2str(size(A,1))],'fontsize',8)
  206. % ylabel('Norm. response')
  207. % title('\fontsize{8}LF-tuned','FontWeight', 'Normal')
  208. set(gca, 'box', 'off')
  209. set(gca, 'Color','none')
  210. set(gca,'linewidth',1);set(gca,'fontsize',8);
  211. subplot(224)
  212. A=dataset(mf_,2:18);
  213. % plot(x,A','color',[0.6 0.6 0.6]); hold on
  214. y=[nanmean(A,1)-nanstd(A,1)/sqrt(size(A,1)); nanmean(A,1); nanmean(A,1)+nanstd(A,1)/sqrt(size(A,1))];
  215. px=[x,fliplr(x)];
  216. py=[y(1,:), fliplr(y(3,:))];
  217. patch(px,py,1,'FaceColor',yellow,'EdgeColor','none'); hold on
  218. plot(x,y(2,:),'Color',yellow);
  219. alpha(.2);
  220. xlim([8 92])
  221. % ylim([-0.05 1.05])
  222. xlabel('Freq. (kHz)')
  223. text(50,0.75,['n=' num2str(size(A,1))],'fontsize',8)
  224. % title('\fontsize{8}multipeaked','FontWeight', 'Normal')
  225. set(gca, 'box', 'off')
  226. set(gca, 'Color','none')
  227. set(gca,'linewidth',1);set(gca,'fontsize',8);
  228. % exportgraphics(gcf,'E:\Users\User\Desktop\delay paper\anesthetized\figures_paper\FTC_all_eq.pdf',...
  229. % 'Resolution',300','ContentType','vector','BackgroundColor','none')
  230. %% plotting modulation of anesthesia on FTCs - different preparations
  231. lf_=ftc_class_aw(:,1)==1;
  232. mf_=ftc_class_aw(:,1)==3;
  233. x=10:5:90;
  234. aw_lf=ftc_class_aw(lf_,2:18);
  235. aw_mf=ftc_class_aw(mf_,2:18);
  236. lf_=ftc_class(:,1)==1;
  237. mf_=ftc_class(:,1)==3;
  238. an_lf=ftc_class(lf_,2:18);
  239. an_mf=ftc_class(mf_,2:18);
  240. ef_sizes_mf=nan(1,17);
  241. ef_sizes_lf=nan(1,17);
  242. sign_mf=nan(1,17);
  243. sign_lf=nan(1,17);
  244. for f=1:17
  245. ef_size_mf = CliffDelta(an_mf(:,f),aw_mf(:,f));
  246. ef_size_lf = CliffDelta(an_lf(:,f),aw_lf(:,f));
  247. ef_sizes_mf(1,f)=ef_size_mf;
  248. ef_sizes_lf(1,f)=ef_size_lf;
  249. [p1,h1] = ranksum(an_mf(:,f),aw_mf(:,f));
  250. [p2,h2] = ranksum(an_lf(:,f),aw_lf(:,f));
  251. sign_mf(1,f)=h1;
  252. sign_lf(1,f)=h2;
  253. end
  254. figure(4); set(gcf, 'Position', [200, 200, 320, 110])
  255. t=tiledlayout(1,2,'TileSpacing','compact');
  256. ax1 = nexttile;
  257. A=aw_lf;
  258. y=[nanmean(A,1)-nanstd(A,1)/sqrt(size(A,1)); nanmean(A,1); nanmean(A,1)+nanstd(A,1)/sqrt(size(A,1))];
  259. px=[x,fliplr(x)];
  260. py=[y(1,:), fliplr(y(3,:))];
  261. patch(px,py,1,'FaceColor',blue,'EdgeColor','none'); hold on
  262. plot(x,y(2,:),'Color',blue);
  263. alpha(.2);
  264. A=an_lf;
  265. y=[nanmean(A,1)-nanstd(A,1)/sqrt(size(A,1)); nanmean(A,1); nanmean(A,1)+nanstd(A,1)/sqrt(size(A,1))];
  266. px=[x,fliplr(x)];
  267. py=[y(1,:), fliplr(y(3,:))];
  268. patch(px,py,1,'FaceColor',red,'EdgeColor','none'); hold on
  269. plot(x,y(2,:),'Color',red);
  270. alpha(.2);
  271. hold on
  272. for f=1:17
  273. if sign_lf(1,f)==1
  274. plot(x(f),1,'k*','MarkerSize',3)
  275. end
  276. end
  277. xlabel('freq. (kHz)')
  278. ylabel('norm. response')
  279. set(gca, 'box', 'off')
  280. set(gca, 'Color','none')
  281. set(gca,'linewidth',1);set(gca,'fontsize',8);
  282. ax2 = nexttile;
  283. A=aw_mf;
  284. y=[nanmean(A,1)-nanstd(A,1)/sqrt(size(A,1)); nanmean(A,1); nanmean(A,1)+nanstd(A,1)/sqrt(size(A,1))];
  285. px=[x,fliplr(x)];
  286. py=[y(1,:), fliplr(y(3,:))];
  287. patch(px,py,1,'FaceColor',blue,'EdgeColor','none'); hold on
  288. plot(x,y(2,:),'Color',blue);
  289. alpha(.2);
  290. A=an_mf;
  291. y=[nanmean(A,1)-nanstd(A,1)/sqrt(size(A,1)); nanmean(A,1); nanmean(A,1)+nanstd(A,1)/sqrt(size(A,1))];
  292. px=[x,fliplr(x)];
  293. py=[y(1,:), fliplr(y(3,:))];
  294. patch(px,py,1,'FaceColor',red,'EdgeColor','none'); hold on
  295. plot(x,y(2,:),'Color',red);
  296. alpha(.2);
  297. hold on
  298. for f=1:17
  299. if sign_mf(1,f)==1
  300. plot(x(f),1,'k*','MarkerSize',3)
  301. end
  302. end
  303. xlabel('freq. (kHz)')
  304. set(gca, 'box', 'off')
  305. set(gca, 'Color','none')
  306. set(gca,'linewidth',1);set(gca,'fontsize',8);
  307. linkaxes([ax1 ax2],'xy')
  308. xlim([8 92])
  309. % exportgraphics(gcf,'E:\Users\User\Desktop\delay paper\anesthetized\figures_paper\modulation_ftc_prep.pdf',...
  310. % 'Resolution',300','ContentType','vector','BackgroundColor','none')