123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382 |
- % plot FTCs and histograms for all data
- close all;
- clear;
- % FT curves and the respective classification to pure tones
- aw=load('class_FT-aw'); aw=aw.class_FT;
- int=load('class_FT-int'); int=int.class_FT;
- chi=load('class_FT-chi'); chi=chi.class_FT;
- pt=load('class_FT-pt'); pt=pt.class_FT;
- pair=load('class_FT-pair'); pair=pair.class_FT;
- % classification in response to natural sounds
- intN=load('all_data.mat'); intN=intN.all_di;
- chiN=load('chi_data.mat'); chiN=chiN.all_di;
- ptN=load('pt_data.mat'); ptN=ptN.all_di;
- pairN=load('pair_data.mat'); pairN=pairN.all_di;
- % classification lists
- awN=intN(intN(:,3)==0,1:2);
- intN=intN(intN(:,3)==1,1:2);
- chiN=chiN(chiN(:,3)==0,1:2);
- ptN=ptN(ptN(:,3)==2,1:2);
- pairN=pairN(pairN(:,3)==0,1:2);
- %% create matrix to plot stack bar plots and FTC of one classification
- class_to_plot=0;
- % awake data set
- combi_aw=zeros(5,3); % rows: natural class / cols: FTC class
- ftc_class_aw=nan(100,18); % rows: units / cols: FTC
- n_units=aw(:,1);
- n=numel(n_units);
- k=1;
- for i = 1:n
- unit=n_units(i);
- class_=awN(awN(:,1)==unit,2)+1;
- ftc_=aw(aw(:,1)==unit,2);
- if class_~= 0
- combi_aw(class_,ftc_)=combi_aw(class_,ftc_)+1;
- end
- if class_-1 == class_to_plot
- ftc_class_aw(k,:)=aw(aw(:,1)==unit,2:19);
- k=k+1;
- end
- end
- % anesthetized data set
- combi_int=zeros(5,3); % rows: class / cols: FTC
- ftc_class_int=nan(100,18); % rows: units / cols: FTC
- n_units=int(:,1);
- n=numel(n_units);
- k=1;
- for i = 1:n
- unit=n_units(i);
- class_=intN(intN(:,1)==unit,2)+1;
- ftc_=int(int(:,1)==unit,2);
- if class_~= 0
- combi_int(class_,ftc_)=combi_int(class_,ftc_)+1;
- end
- if class_-1 == class_to_plot
- ftc_class_int(k,:)=int(int(:,1)==unit,2:19);
- k=k+1;
- end
- end
- % paired chimeras data set
- combi_chi=zeros(5,3); % rows: class / cols: FTC
- ftc_class_chi=nan(100,18); % rows: units / cols: FTC
- n_units=chi(:,1);
- n=numel(n_units);
- k=1;
- for i = 1:n
- unit=n_units(i);
- class_=chiN(chiN(:,1)==unit,2)+1;
- ftc_=chi(chi(:,1)==unit,2);
- if class_~= 0
- combi_chi(class_,ftc_)=combi_chi(class_,ftc_)+1;
- end
- if class_-1 == class_to_plot
- ftc_class_chi(k,:)=chi(chi(:,1)==unit,2:19);
- k=k+1;
- end
- end
- % pure tones data set
- combi_pt=zeros(5,3); % rows: class / cols: FTC
- ftc_class_pt=nan(100,18); % rows: units / cols: FTC
- n_units=ptN(:,1);
- n=numel(n_units);
- k=1;
- for i = 1:n
- unit=n_units(i);
- class_=ptN(ptN(:,1)==unit,2)+1;
- ftc_=pt(pt(:,1)==unit,2);
- if class_~= 0
- combi_pt(class_,ftc_)=combi_pt(class_,ftc_)+1;
- end
- if class_-1 == class_to_plot
- ftc_class_pt(k,:)=pt(pt(:,1)==unit,2:19);
- k=k+1;
- end
- end
- % all data sets together for anesthetized data
- combi=combi_int+combi_pt; % +combi_chi %rows: natural class / cols: FTC class
- ftc_class=[ftc_class_int;ftc_class_chi;ftc_class_pt];
- ftc_class = ftc_class(any(~isnan(ftc_class),2),:);
- %% plotting # units awake and anesthetized
- red =[0.8500 0.3250 0.0980];
- blue=[0 0.4470 0.7410];
- yellow=[0.9294 0.6941 0.1255];
- dataset=combi_aw;
- figure(1); set(gcf, 'Position', [200, 200, 320, 180])
- subplot(121)
- b=bar(dataset([2,3,4,5,1],[3,1,2]),'stacked', 'FaceColor','flat');
- b(1).CData =yellow; % multipeaked
- b(2).CData=blue; % LF tuned
- b(3).CData=red; % HF tuned
- ylabel('# of units')
- xticklabels({'ech','com','ech>com','com>ech','ech=com'})
- set(gca, 'box', 'off')
- set(gca, 'Color','none')
- set(gca,'linewidth',1);set(gca,'fontsize',8);
- legend('multi.','LF','HF','Location','northwest','box','off');
- dataset=combi;
- subplot(122)
- b=bar(dataset([2,3,4,5,1],[3,1,2]),'stacked', 'FaceColor','flat');
- b(1).CData =yellow; % multipeaked
- b(2).CData=blue; % LF tuned
- b(3).CData=red; % HF tuned
- xticklabels({'ech','com','ech>com','com>ech','ech=com'})
- ylim([0 50])
- set(gca, 'box', 'off')
- set(gca, 'Color','none')
- set(gca,'linewidth',1);set(gca,'fontsize',8);
- % exportgraphics(gcf,'E:\Users\User\Desktop\delay paper\anesthetized\figures_paper\class_FTC_numb.pdf',...
- % 'Resolution',300','ContentType','vector','BackgroundColor','none')
- %% plotting 'equally responsive' neurons % of FTC
- dataset_an=combi;
- dataset_aw=combi_aw;
- combi_class=[dataset_aw(1,[3,1,2]);dataset_an(1,[3,1,2])];
- combi_class=combi_class./(sum(combi_class,2))*100;
- figure(2); set(gcf, 'Position', [200, 200, 60, 180])
- b=bar(combi_class,'stacked', 'FaceColor','flat');
- b(1).CData =yellow; % multipeaked
- b(2).CData=blue; % LF tuned
- b(3).CData=red; % HF tuned
- ylabel('% of units')
- xticklabels({'awake','anesthetized'})
- xlim([0.2 2.8])
- set(gca, 'box', 'off')
- set(gca, 'Color','none')
- set(gca,'linewidth',1);set(gca,'fontsize',8);
- % legend('multi.','LF','HF','Location','northwest','box','off');
- % exportgraphics(gcf,'E:\Users\User\Desktop\delay paper\anesthetized\figures_paper\class_FTC_perc.pdf',...
- % 'Resolution',300','ContentType','vector','BackgroundColor','none')
- %% plotting FTCs
- dataset=ftc_class_aw;
- lf_=dataset(:,1)==1;
- hf_=dataset(:,1)==2;
- mf_=dataset(:,1)==3;
- x=10:5:90;
- figure(3); set(gcf, 'Position', [200, 200, 300, 180])
- subplot(221)
- A=dataset(lf_,2:18);
- % plot(x,A','color',[0.6 0.6 0.6]); hold on
- y=[nanmean(A,1)-nanstd(A,1)/sqrt(size(A,1)); nanmean(A,1); nanmean(A,1)+nanstd(A,1)/sqrt(size(A,1))];
- px=[x,fliplr(x)];
- py=[y(1,:), fliplr(y(3,:))];
- patch(px,py,1,'FaceColor',blue,'EdgeColor','none'); hold on
- plot(x,y(2,:),'Color',blue);
- alpha(.2);
- xlim([8 92])
- % ylim([-0.05 1.05])
- text(50,0.75,['n=' num2str(size(A,1))],'fontsize',8)
- % ylabel('Norm. response')
- % title('\fontsize{8}LF-tuned','FontWeight', 'Normal')
- set(gca, 'box', 'off')
- set(gca, 'Color','none')
- set(gca,'linewidth',1);set(gca,'fontsize',8);
- subplot(222)
- A=dataset(mf_,2:18);
- % plot(x,A','color',[0.6 0.6 0.6]); hold on
- y=[nanmean(A,1)-nanstd(A,1)/sqrt(size(A,1)); nanmean(A,1); nanmean(A,1)+nanstd(A,1)/sqrt(size(A,1))];
- px=[x,fliplr(x)];
- py=[y(1,:), fliplr(y(3,:))];
- patch(px,py,1,'FaceColor',yellow,'EdgeColor','none'); hold on
- plot(x,y(2,:),'Color',yellow);
- alpha(.2);
- xlim([8 92])
- % ylim([-0.05 1.05])
- text(50,0.75,['n=' num2str(size(A,1))],'fontsize',8)
- % title('\fontsize{8}multipeaked','FontWeight', 'Normal')
- set(gca, 'box', 'off')
- set(gca, 'Color','none')
- set(gca,'linewidth',1);set(gca,'fontsize',8);
- dataset=ftc_class;
- lf_=dataset(:,1)==1;
- hf_=dataset(:,1)==2;
- mf_=dataset(:,1)==3;
- x=10:5:90;
- subplot(223)
- A=dataset(lf_,2:18);
- % plot(x,A','color',[0.6 0.6 0.6]); hold on
- y=[nanmean(A,1)-nanstd(A,1)/sqrt(size(A,1)); nanmean(A,1); nanmean(A,1)+nanstd(A,1)/sqrt(size(A,1))];
- px=[x,fliplr(x)];
- py=[y(1,:), fliplr(y(3,:))];
- patch(px,py,1,'FaceColor',blue,'EdgeColor','none'); hold on
- plot(x,y(2,:),'Color',blue);
- alpha(.2);
- xlim([8 92])
- % ylim([-0.05 1.05])
- xlabel('Freq. (kHz)')
- text(50,0.75,['n=' num2str(size(A,1))],'fontsize',8)
- % ylabel('Norm. response')
- % title('\fontsize{8}LF-tuned','FontWeight', 'Normal')
- set(gca, 'box', 'off')
- set(gca, 'Color','none')
- set(gca,'linewidth',1);set(gca,'fontsize',8);
- subplot(224)
- A=dataset(mf_,2:18);
- % plot(x,A','color',[0.6 0.6 0.6]); hold on
- y=[nanmean(A,1)-nanstd(A,1)/sqrt(size(A,1)); nanmean(A,1); nanmean(A,1)+nanstd(A,1)/sqrt(size(A,1))];
- px=[x,fliplr(x)];
- py=[y(1,:), fliplr(y(3,:))];
- patch(px,py,1,'FaceColor',yellow,'EdgeColor','none'); hold on
- plot(x,y(2,:),'Color',yellow);
- alpha(.2);
- xlim([8 92])
- % ylim([-0.05 1.05])
- xlabel('Freq. (kHz)')
- text(50,0.75,['n=' num2str(size(A,1))],'fontsize',8)
- % title('\fontsize{8}multipeaked','FontWeight', 'Normal')
- set(gca, 'box', 'off')
- set(gca, 'Color','none')
- set(gca,'linewidth',1);set(gca,'fontsize',8);
- % exportgraphics(gcf,'E:\Users\User\Desktop\delay paper\anesthetized\figures_paper\FTC_all_eq.pdf',...
- % 'Resolution',300','ContentType','vector','BackgroundColor','none')
- %% plotting modulation of anesthesia on FTCs - different preparations
- lf_=ftc_class_aw(:,1)==1;
- mf_=ftc_class_aw(:,1)==3;
- x=10:5:90;
- aw_lf=ftc_class_aw(lf_,2:18);
- aw_mf=ftc_class_aw(mf_,2:18);
- lf_=ftc_class(:,1)==1;
- mf_=ftc_class(:,1)==3;
- an_lf=ftc_class(lf_,2:18);
- an_mf=ftc_class(mf_,2:18);
- ef_sizes_mf=nan(1,17);
- ef_sizes_lf=nan(1,17);
- sign_mf=nan(1,17);
- sign_lf=nan(1,17);
- for f=1:17
- ef_size_mf = CliffDelta(an_mf(:,f),aw_mf(:,f));
- ef_size_lf = CliffDelta(an_lf(:,f),aw_lf(:,f));
- ef_sizes_mf(1,f)=ef_size_mf;
- ef_sizes_lf(1,f)=ef_size_lf;
- [p1,h1] = ranksum(an_mf(:,f),aw_mf(:,f));
- [p2,h2] = ranksum(an_lf(:,f),aw_lf(:,f));
- sign_mf(1,f)=h1;
- sign_lf(1,f)=h2;
- end
- figure(4); set(gcf, 'Position', [200, 200, 320, 110])
- t=tiledlayout(1,2,'TileSpacing','compact');
- ax1 = nexttile;
- A=aw_lf;
- y=[nanmean(A,1)-nanstd(A,1)/sqrt(size(A,1)); nanmean(A,1); nanmean(A,1)+nanstd(A,1)/sqrt(size(A,1))];
- px=[x,fliplr(x)];
- py=[y(1,:), fliplr(y(3,:))];
- patch(px,py,1,'FaceColor',blue,'EdgeColor','none'); hold on
- plot(x,y(2,:),'Color',blue);
- alpha(.2);
- A=an_lf;
- y=[nanmean(A,1)-nanstd(A,1)/sqrt(size(A,1)); nanmean(A,1); nanmean(A,1)+nanstd(A,1)/sqrt(size(A,1))];
- px=[x,fliplr(x)];
- py=[y(1,:), fliplr(y(3,:))];
- patch(px,py,1,'FaceColor',red,'EdgeColor','none'); hold on
- plot(x,y(2,:),'Color',red);
- alpha(.2);
- hold on
- for f=1:17
- if sign_lf(1,f)==1
- plot(x(f),1,'k*','MarkerSize',3)
- end
- end
- xlabel('freq. (kHz)')
- ylabel('norm. response')
- set(gca, 'box', 'off')
- set(gca, 'Color','none')
- set(gca,'linewidth',1);set(gca,'fontsize',8);
- ax2 = nexttile;
- A=aw_mf;
- y=[nanmean(A,1)-nanstd(A,1)/sqrt(size(A,1)); nanmean(A,1); nanmean(A,1)+nanstd(A,1)/sqrt(size(A,1))];
- px=[x,fliplr(x)];
- py=[y(1,:), fliplr(y(3,:))];
- patch(px,py,1,'FaceColor',blue,'EdgeColor','none'); hold on
- plot(x,y(2,:),'Color',blue);
- alpha(.2);
- A=an_mf;
- y=[nanmean(A,1)-nanstd(A,1)/sqrt(size(A,1)); nanmean(A,1); nanmean(A,1)+nanstd(A,1)/sqrt(size(A,1))];
- px=[x,fliplr(x)];
- py=[y(1,:), fliplr(y(3,:))];
- patch(px,py,1,'FaceColor',red,'EdgeColor','none'); hold on
- plot(x,y(2,:),'Color',red);
- alpha(.2);
- hold on
- for f=1:17
- if sign_mf(1,f)==1
- plot(x(f),1,'k*','MarkerSize',3)
- end
- end
- xlabel('freq. (kHz)')
- set(gca, 'box', 'off')
- set(gca, 'Color','none')
- set(gca,'linewidth',1);set(gca,'fontsize',8);
- linkaxes([ax1 ax2],'xy')
- xlim([8 92])
- % exportgraphics(gcf,'E:\Users\User\Desktop\delay paper\anesthetized\figures_paper\modulation_ftc_prep.pdf',...
- % 'Resolution',300','ContentType','vector','BackgroundColor','none')
|