%% Code to plot the figures for the elipsa manuscript D'Gama et al % written by NJY 01.03.2024 %addpath(genpath('X:\Manuscripts\Dgama etal 2023 elipsa\iScience\Revision\Raw data D'Gama etal elipsa manuscript 2024\Figure 6\')); %% LOAD THE INDIVIDUAL DATASETS FROM THE FOLDER cfg.pathData='X:\Percival\2photon data\Analysis\elipsa\light_responses\'; [ctrlON,ctrlOFF,mutON,mutOFF,time]=nj_load2pdata_v2(cfg); numCTRL=size(ctrlOFF,1)-1; numMUT=size(mutOFF,1)-1; %% SET SOME PARAMETERS FOR THE PLOTS close all clear cfg cfg.MutID='ELIPSA'; %enter the name of your mutant 'ELIPSA', this is for the title cfg.Mutcolor='c' %enter the color you want for your mutantd display, 'm'= magenta, 'c'=cyan cfg.numCTRL=numCTRL; cfg.numMUT=numMUT; cfg.label=["tel" "OT" "hind" "habenula"]; cfg.brainRegion=char('telencephalon','TeO/thalamus','Hindbrain', 'Habenula'); %% CALCULATE AVERAGE AND PLOT [averageON_ALL,averageOFF_ALL]=plot_responseALL_perfish(ctrlON,ctrlOFF,mutON,mutOFF,time,cfg); %% PLOT THE ROIS AND THE HEATMAPS OF ALL NEURONS FOR THE REPRESENTATIVE CONTROL AND MUTANT %% For CONTROL ============================================================ % Representative control: 20220308_15_02_50_2022038volelipsactrlF03 load('X:\Percival\2photon data\Analysis\elipsa\light_responses\Best representative\Control\20220308_15_02_50_2022038volelipsactrlF03\Aligned\celldetection_celldetectionpercy2detectiontimepoint\2022038volelipsactrlF03Results_CLUSTERING.mat') % Plot the ROI for the control--------------------------------------------- %colormap based on colorbrewer colorM=[166 206 227; 31 120 180; 178 223 138; 51 160 44]/256; %colormap from matplotlib cmap = getPyPlot_cMap('seismic', 128); %all figures will be the same size with a scale bar of 100um for k=1:7 figure, for i=1:4 index=results.redoneIndex==i & results.DV_DFF_XYZINDEXPLANE_rawtraces(:,5)==k; scatter(results.DV_DFF_XYZINDEXPLANE_rawtraces(index,1),results.DV_DFF_XYZINDEXPLANE_rawtraces(index,2),30 ,colorM(i,:),'o','filled'), hold on end line([10 110], [10 10],'Color','k','LineWidth',2) axis image axis off xlim([0 1536*results.metadata.voxelSize(1)]) title(results.metadata.name) end % plot the clustering with a bar for 5 min -------------------------------- % reodred the cluster so that cluster 1 is ON, cluster 2 is OFF, cluster 3 % is spontaneously active, cluster 4 and 5 is nothing idx2=results.idx; idx2(results.idx==4)=10; idx2(results.idx==2)=11; idx2(results.idx==5)=12; idx2(results.idx==1)=13; idx2(results.idx==3)=14; % x scalebar is 5 min, y scalebar is 1000 neurons figure('Position', [100 100 400 650]) imagesc(sortrows(cat(2, idx2, results.DV_DFFaveragetime ))), hold on colormap(cmap) caxis([-80 80]) %colorbar xline(results.cfg.TimeVector.ON,'k--','LineWidth',0.1) xline(results.cfg.TimeVector.OFF,'k--','LineWidth',0.1) yline(1+find(diff(sort(idx2))==1),'k--', 'LineWidth',2) xlim([500 size(results.DV_DFFaveragetime,2)+200]) ylim([0 size(results.DV_DFFaveragetime,1)+200]) line([500 round(500+results.cfg.fps*60*5)], size(results.DV_DFFaveragetime,1)+[200 200],'Color','k','LineWidth', 3) line(size(results.DV_DFFaveragetime,2)+[200 200], [0 1000],'Color','k','LineWidth',3) box off axis off ax=gca; set(ax,'XTick',[]) set(ax,'YTick',[]) %set(ax,'TickDir','out') title(results.metadata.name) %% plot a scatter of the brain areas load('X:\Percival\2photon data\Analysis\elipsa\light_responses\Best representative\Control\20220308_15_02_50_2022038volelipsactrlF03\Aligned\celldetection_celldetectionpercy2detectiontimepoint\Results_BrainRegions.mat') % introduce colorscale to be used colorM=[166 206 227; 31 120 180; 178 223 138; 51 160 44]/256; % plot 3D figure figure set(gcf, 'Position',[50 50 800 500]) hold on for k=[1,3,4,2] index=results.redoneIndex==k; scatter3(-results.positions_nodoubles(index,1),results.positions_nodoubles(index,2),-results.positions_nodoubles(index,3),30,results.redoneIndex(index,:),'filled','o'), colormap (colorM), caxis([1 4]) alpha(.8) end axis image %axis off view (-15,45) %% PLOT THE ROIS IN DIFFERENT REGION======================================== % introduce colorscale to be used colorM=[166 206 227; 31 120 180; 178 223 138; 51 160 44]/256; % plot 3D figure figure set(gcf, 'Position',[50 50 800 500]) hold on for k=[1,3,4,2] index=results.redoneIndex==k; scatter3(-results.positions_nodoubles(index,1),results.positions_nodoubles(index,2),-results.positions_nodoubles(index,3),30,results.redoneIndex(index,:),'filled','o'), colormap (colorM), caxis([1 4]) alpha(.8) end axis image %axis off view (-15,45) %% For MUTANT ============================================================ % Representative control: 20220308_15_02_50_2022038volelipsactrlF03 load('X:\Percival\2photon data\Analysis\elipsa\light_responses\Best representative\Mutant\20220308_20_38_11_2022038volelipsamutantF02\Aligned\celldetection_celldetectionpercy2detectiontimepoint\2022038volelipsamutantF02Results_CLUSTERING.mat') % Plot the ROI for the control -------------------------------------------- %colormap colorM=[166 206 227; 31 120 180; 178 223 138; 51 160 44]/256; %all figures will be the same size with a scale bar of 100um for k=1:7 figure, for i=1:4 index=results.redoneIndex==i & results.DV_DFF_XYZINDEXPLANE_rawtraces(:,5)==k; scatter(results.DV_DFF_XYZINDEXPLANE_rawtraces(index,1),results.DV_DFF_XYZINDEXPLANE_rawtraces(index,2),30 ,colorM(i,:),'o','filled'), hold on end line([10 110], [10 10],'Color','k','LineWidth',2) axis image axis off xlim([0 1536*results.metadata.voxelSize(1)]) title(results.metadata.name) end % plot the clustering with a bar for 5 min -------------------------------- % reodred the cluster so that cluster 1 is ON, cluster 2 is OFF, cluster 3 % is spontaneously active, cluster 4 and 5 is nothing idx2=results.idx; idx2(results.idx==4)=10; idx2(results.idx==3)=11; idx2(results.idx==2)=12; idx2(results.idx==1)=13; idx2(results.idx==5)=14; % x scalebar is 5 min, y scalebar is 1000 neurons figure('Position', [100 100 400 650]) imagesc(sortrows(cat(2, idx2, results.DV_DFFaveragetime ))), hold on colormap(cmap) caxis([-80 80]) %colorbar xline(results.cfg.TimeVector.ON,'k--','LineWidth',0.1) xline(results.cfg.TimeVector.OFF,'k--','LineWidth',0.1) yline(1+find(diff(sort(idx2))==1),'k--', 'LineWidth',2) xlim([500 size(results.DV_DFFaveragetime,2)+200]) ylim([0 size(results.DV_DFFaveragetime,1)+200]) line([500 round(500+results.cfg.fps*60*5)], size(results.DV_DFFaveragetime,1)+[200 200],'Color','k','LineWidth', 3) line(size(results.DV_DFFaveragetime,2)+[200 200], [0 1000],'Color','k','LineWidth',3) box off axis off ax=gca; set(ax,'XTick',[]) set(ax,'YTick',[]) %set(ax,'TickDir','out') title(results.metadata.name) %% PLOT THE SORTED RESPONSE TO LIGHT ON AND OFF STIMULUS FOR THE BEST REPRESENTATIVE EXAMPLE % ===========================================================0 %% Load data from all control and all mutants load('X:\Percival\2photon data\Analysis\elipsa\light_responses\Elipsa_All_light_response.mat') cfg.onset=465; cfg.offset=503; cfg.brainRegion=char('telencephalon','TeO/thalamus','Hindbrain', 'Habenula'); %% Plot scatter response for representative CONTROL per brain region------- %colormap from matplotlib cmap = getPyPlot_cMap('seismic', 128); %this is the ID of the right control--------------------------------------- CTRL=9; %scale the graph so that they are visible for k=1:4 sizedata(k)=size(find(ctrlON{CTRL+1,7}(:,4)==k),1); end sizeimage=[sizedata(1)/12 sizedata(2)/25 sizedata(3)/25 sizedata(4)/5]; % Plot scatter response for representative CONTROL lightON---------------- for i=CTRL for k=1:4 figure set(gcf, 'Position',[50 50 200 sizeimage(k)]) matrix=ctrlON{i+1,6}(ctrlON{i+1,7}(:,4)==k,cfg.onset-10:cfg.offset); imagesc(sortrows([mean(matrix(:,10:end),2) matrix],1,'descend')), colormap(cmap), caxis([-80 80]), hold on xlim([2 53]) xline(11,'k--','LineWidth',1) line([53 53], [0 200],'Color','k','LineWidth', 3) ylabel('neurons') title([cfg.brainRegion(k,:) ' ctrlON']) ax=gca; set(ax,'XTick',[]) set(ax,'YTick',[]) box off axis off end end % Plot scatter response for representative CONTROL lightOFF---------------- for i=CTRL for k=1:4 figure set(gcf, 'Position',[50 50 200 sizeimage(k)]) matrix=ctrlOFF{i+1,6}(ctrlOFF{i+1,7}(:,4)==k,cfg.onset-10:cfg.offset); imagesc(sortrows([mean(matrix(:,10:end),2) matrix],1,'descend')), colormap(cmap), caxis([-80 80]), hold on xlim([2 53]) xline(11,'k--','LineWidth',1) line([53 53], [0 200],'Color','k','LineWidth', 3) ylabel('neurons') title([cfg.brainRegion(k,:) ' ctrlOFF']) ax=gca; set(ax,'XTick',[]) set(ax,'YTick',[]) box off axis off end end %% Plot scatter response for representative MUTANT per brain region %colormap from matplotlib cmap = redblue; %scale the graph so that they are visible for k=1:4 sizedata(k)=size(find(ctrlON{CTRL+1,7}(:,4)==k),1); end sizeimage=[sizedata(1)/12 sizedata(2)/25 sizedata(3)/25 sizedata(4)/5]; %this is the ID of the right mutant--------------------------------------- MUT=9; % Plot scatter response for representative MUTANT lightON---------------- for i=MUT for k=1:4 figure set(gcf, 'Position',[50 50 200 sizeimage(k)]) matrix=mutON{i+1,6}(mutON{i+1,7}(:,4)==k,cfg.onset-10:cfg.offset); imagesc(sortrows([mean(matrix(:,10:end),2) matrix],1,'descend')), colormap(cmap), caxis([-80 80]), hold on xlim([2 53]) xline(11,'k--','LineWidth',1) line([53 53], [0 200],'Color','k','LineWidth', 3) ylabel('neurons') title([cfg.brainRegion(k,:) ' mutON']) ax=gca; set(ax,'XTick',[]) set(ax,'YTick',[]) box off axis off end end % Plot scatter response for representative MUTANT lightOFF---------------- for i=MUT for k=1:4 matrix=mutOFF{i+1,6}(mutOFF{i+1,7}(:,4)==k,cfg.onset-10:cfg.offset); imagesc(sortrows([mean(matrix(:,10:end),2) matrix],1,'descend')), colormap(cmap), caxis([-80 80]), hold on xlim([2 53]) xline(11,'k--','LineWidth',1) line([53 53], [0 200],'Color','k','LineWidth', 3) ylabel('neurons') title([cfg.brainRegion(k,:) ' mutOFF']) ax=gca; set(ax,'XTick',[]) set(ax,'YTick',[]) box off axis off end end %% plot amplitude of elipsa and control cfg.MutID='elipsa'; figure (40) set(gcf, 'Position',[100 100 400 600]) str= {[cfg.MutID ' Amplitude of ON and OFF responses, SEM']}; annotation('textbox',[0.05 0.95 0.9 0.05],'String',str, 'FontSize',14, 'FontWeight', 'bold', 'LineStyle', 'none'); subplot(2,1,1) rectangle('Position',[0 -2 60 1],'FaceColor',[0.99 0.99 0.75], 'EdgeColor',[0.99 0.99 0.75]), hold on shadedErrorBar(time,mean(averageON_ALL.ctrl,1),std(averageON_ALL.ctrl,[],1)/sqrt(size(averageON_ALL.ctrl,1)),'lineprops', 'k') shadedErrorBar(time,mean(averageON_ALL.mut,1),std(averageON_ALL.mut,[],1)/sqrt(size(averageON_ALL.mut,1)),'lineprops', cfg.Mutcolor) title(['Average ON for all cells in' num2str(cfg.numCTRL) ' ctrl and ' num2str(cfg.numMUT) ' mut fish ']) xlim([-10 60]) ylim([-5 20]) xlabel('seconds') ylabel('dF/F') subplot(2,1,2) rectangle('Position',[-10 -2 10 1],'FaceColor',[0.99 0.99 0.75], 'EdgeColor',[0.99 0.99 0.75]), hold on shadedErrorBar(time,mean(averageOFF_ALL.ctrl,1),std(averageOFF_ALL.ctrl,[],1)/sqrt(size(averageOFF_ALL.ctrl,1)),'lineprops', 'k') shadedErrorBar(time,mean(averageOFF_ALL.mut,1),std(averageOFF_ALL.mut,[],1)/sqrt(size(averageOFF_ALL.mut,1)),'lineprops', cfg.Mutcolor) title(['Average OFF for all cells in' num2str(cfg.numCTRL) ' ctrl and ' num2str(cfg.numMUT) ' mut fish ']) xlim([-10 60]) ylim([-5 30]) xlabel('seconds') ylabel('dF/F') %% amplitude cells per brain region %close all onset=465; offset=503; jj=[1,4,2,3]; %reorder so that Hb is between Tel and OT, added 14.03.2023 figure (52) for k=1:4 j=jj(k); set(gcf, 'Position',[100 100 300 400]) str= {[cfg.MutID ' Amplitude ALL cells ON, from ' num2str(time(onset)) 's to ' num2str(time(offset)) 's']}; annotation('textbox',[0.05 0.95 0.9 0.05],'String',str, 'FontSize',10, 'FontWeight', 'bold', 'LineStyle', 'none'); for i=1:cfg.numCTRL matrixC(i,:)=mean(ctrlON{i+1,6}(ctrlON{i+1,7}(:,4)==j,:),1); end for i=1:cfg.numMUT matrixM(i,:)=mean(mutON{i+1,6}(mutON{i+1,7}(:,4)==j,:),1); end toplotC=matrixC(:,onset:offset); toplotM=matrixM(:,onset:offset); swarmchart((2*k-2)+ones(cfg.numCTRL,1), mean(toplotC,2),80,'k','filled','MarkerFaceAlpha',0.5,'MarkerEdgeAlpha',0.5,'XJitterWidth',0.3), hold on line((2*k-2)+[0.6 1.4], repmat(mean(mean(toplotC,2)),1,2),'Color','k') errorbar((2*k-2)+1,mean(mean(toplotC,2)), std(mean(toplotC,2)),'Color','k') swarmchart((2*k-2)+2*ones(cfg.numMUT,1), mean(toplotM,2),80,cfg.Mutcolor,'filled','MarkerFaceAlpha',0.5,'MarkerEdgeAlpha',0.5,'XJitterWidth',0.3), hold on line((2*k-2)+[1.6 2.4], repmat(mean(mean(toplotM,2)),1,2),'Color','k') errorbar((2*k-2)+2,mean(mean(toplotM,2)), std(mean(toplotM,2)),'Color','k') %xlim([0 3]), ylim([-10 40]) ylabel('amplitude') text((2*k-2)+0.25,-5,['p= '... num2str(ranksum(mean(toplotC,2),mean(toplotM,2)),'%.4f')]); xticks([1.5 3.5 5.5 7.5]) xticklabels({'Tel', 'Hab','OT/Thal', 'Hind'}) %title([cfg.brainRegion(k,:) 'ON response']) clear toplotC toplotM matrixC matrixM end figure (53) for k=1:4 j=jj(k); set(gcf, 'Position',[100 100 300 400]) str= {[cfg.MutID ' Amplitude ALL cells OFF, from ' num2str(time(onset)) 's to ' num2str(time(offset)) 's']}; annotation('textbox',[0.05 0.95 0.9 0.05],'String',str, 'FontSize',10, 'FontWeight', 'bold', 'LineStyle', 'none'); for i=1:cfg.numCTRL matrixC(i,:)=mean(ctrlOFF{i+1,6}(ctrlOFF{i+1,7}(:,4)==j,:),1); end for i=1:cfg.numMUT matrixM(i,:)=mean(mutOFF{i+1,6}(mutOFF{i+1,7}(:,4)==j,:),1); end toplotC=matrixC(:,onset:offset); toplotM=matrixM(:,onset:offset); swarmchart((2*k-2)+ones(cfg.numCTRL,1), mean(toplotC,2),80,'k','filled','MarkerFaceAlpha',0.5,'MarkerEdgeAlpha',0.5,'XJitterWidth',0.3), hold on line((2*k-2)+[0.6 1.4], repmat(mean(mean(toplotC,2)),1,2),'Color','k') errorbar((2*k-2)+1,mean(mean(toplotC,2)), std(mean(toplotC,2)),'Color','k') swarmchart((2*k-2)+2*ones(cfg.numMUT,1), mean(toplotM,2),80,cfg.Mutcolor,'filled','MarkerFaceAlpha',0.5,'MarkerEdgeAlpha',0.5,'XJitterWidth',0.3), hold on line((2*k-2)+[1.6 2.4], repmat(mean(mean(toplotM,2)),1,2),'Color','k') errorbar((2*k-2)+2,mean(mean(toplotM,2)), std(mean(toplotM,2)),'Color','k') %xlim([0 3]), ylim([-10 60]) ylabel('amplitude') text((2*k-2)+0.25,-5,['p= '... num2str(ranksum(mean(toplotC,2),mean(toplotM,2)),'%.4f')]); xticks([1.5 3.5 5.5 7.5]) xticklabels({'Tel', 'Hab','OT/Thal', 'Hind'}) %title([cfg.brainRegion(k,:) 'ON response']) clear toplotC toplotM matrixC matrixM end %close all %% calculate number of responding cells per region %close all NumCtrl=[]; NumMut=[]; jj=[1,4,2,3]; %reorder so that Hb is between Tel and OT, added 14.03.2023 % calculate responding cells per brain region for k=1:cfg.numCTRL for ik=1:4; %there are four brain region j=jj(ik); NumCtrl.ON.activated(k,ik)=length(find(ctrlON{k+1, 4}(:,4)==j))/sum(ctrlON{k+1, 7}(:,4)==j)*100; NumCtrl.OFF.activated(k,ik)=length(find(ctrlOFF{k+1, 4}(:,4)==j))/sum(ctrlOFF{k+1, 7}(:,4)==j)*100; NumCtrl.ON.inhibited(k,ik)=length(find(ctrlON{k+1, 5}(:,4)==j))/sum(ctrlON{k+1, 7}(:,4)==j)*100; NumCtrl.OFF.inhibited(k,ik)=length(find(ctrlOFF{k+1, 5}(:,4)==j))/sum(ctrlOFF{k+1, 7}(:,4)==j)*100; end end for k=1:cfg.numMUT for ik=1:4; %there are four brain region j=jj(ik); NumMut.ON.activated(k,ik)=length(find(mutON{k+1, 4}(:,4)==j))/sum(mutON{k+1, 7}(:,4)==j)*100; NumMut.OFF.activated(k,ik)=length(find(mutOFF{k+1, 4}(:,4)==j))/sum(mutOFF{k+1, 7}(:,4)==j)*100; NumMut.ON.inhibited(k,ik)=length(find(mutON{k+1, 5}(:,4)==j))/sum(mutON{k+1, 7}(:,4)==j)*100; NumMut.OFF.inhibited(k,ik)=length(find(mutOFF{k+1, 5}(:,4)==j))/sum(mutOFF{k+1, 7}(:,4)==j)*100; end end figure (57), set(gcf, 'Position',[100 100 300 400]) toplotC=NumCtrl.ON.activated; toplotM=NumMut.ON.activated; swarmchart(repmat([1 2 3 4], cfg.numCTRL,1), toplotC,80,'k','filled','MarkerFaceAlpha',0.5,'MarkerEdgeAlpha',0.5,'XJitterWidth',0.3), hold on for ii=1:4 errorbar(ii,mean(toplotC(:,ii)), std(toplotC(:,ii)),'Color','k', 'Marker','_') end swarmchart(repmat([1.5 2.5 3.5 4.5], cfg.numMUT,1), toplotM,80,cfg.Mutcolor,'filled','MarkerFaceAlpha',0.5,'MarkerEdgeAlpha',0.5,'XJitterWidth',0.3), hold on for ii=1:4 errorbar(ii+0.5,mean(toplotM(:,ii)), std(toplotM(:,ii)),'Color','k', 'Marker','_') end xlim([0 5]), ylim([-10 80]) ylabel('% of responding cells') for i=1:4 p(i)=ranksum(toplotC(:,i),toplotM(:,i)); end text(0,-5,num2str(['Tel:' sprintf('%.3f',p(1))... ' Hb:' sprintf('%.3f',p(2)) ' OT:' sprintf('%.3f',p(3))... ' Hind:' sprintf('%.3f',p(4))])) xticks([1.25 2.25 3.25 4.25]) xticklabels({'Tel', 'Hab','OT', 'Hind'}) title('ON activated') clear toplotC toplotM p hold off figure (58) set(gcf, 'Position',[100 100 300 400]) str= {[cfg.MutID ' % ON inhibited']}; toplotC=NumCtrl.ON.inhibited; toplotM=NumMut.ON.inhibited; swarmchart(repmat([1 2 3 4], cfg.numCTRL,1), toplotC,80,'k','filled','MarkerFaceAlpha',0.5,'MarkerEdgeAlpha',0.5,'XJitterWidth',0.3), hold on for ii=1:4 errorbar(ii,mean(toplotC(:,ii)), std(toplotC(:,ii)),'Color','k', 'Marker','_') end swarmchart(repmat([1.5 2.5 3.5 4.5], cfg.numMUT,1), toplotM,80,cfg.Mutcolor,'filled','MarkerFaceAlpha',0.5,'MarkerEdgeAlpha',0.5,'XJitterWidth',0.3), hold on for ii=1:4 errorbar(ii+0.5,mean(toplotM(:,ii)), std(toplotM(:,ii)),'Color','k', 'Marker','_') end xlim([0 5]), ylim([-2 10]) ylabel('% of responding cells') for i=1:4 p(i)=ranksum(toplotC(:,i),toplotM(:,i)); end text(0,-1,num2str(['Tel:' sprintf('%.3f',p(1))... ' Hb:' sprintf('%.3f',p(2)) ' OT:' sprintf('%.3f',p(3))... ' Hind:' sprintf('%.3f',p(4))])) xticks([1.25 2.25 3.25 4.25]) xticklabels({'Tel', 'Hab','OT', 'Hind'}) title('ON inhibited') clear toplotC toplotM p hold off figure (59) set(gcf, 'Position',[100 100 300 400]) str= {[cfg.MutID ' % OFF activated']}; toplotC=NumCtrl.OFF.activated; toplotM=NumMut.OFF.activated; swarmchart(repmat([1 2 3 4], cfg.numCTRL,1), toplotC,80,'k','filled','MarkerFaceAlpha',0.5,'MarkerEdgeAlpha',0.5,'XJitterWidth',0.3), hold on for ii=1:4 errorbar(ii,mean(toplotC(:,ii)), std(toplotC(:,ii)),'Color','k', 'Marker','_') end swarmchart(repmat([1.5 2.5 3.5 4.5], cfg.numMUT,1), toplotM,80,cfg.Mutcolor,'filled','MarkerFaceAlpha',0.5,'MarkerEdgeAlpha',0.5,'XJitterWidth',0.3), hold on for ii=1:4 errorbar(ii+0.5,mean(toplotM(:,ii)), std(toplotM(:,ii)),'Color','k', 'Marker','_') end xlim([0 5]), ylim([-10 80]) ylabel('% of responding cells') for i=1:4 p(i)=ranksum(toplotC(:,i),toplotM(:,i)); end text(0,-5,num2str(['Tel:' sprintf('%.3f',p(1))... ' Hb:' sprintf('%.3f',p(2)) ' OT:' sprintf('%.3f',p(3))... ' Hind:' sprintf('%.3f',p(4))])) xticks([1.25 2.25 3.25 4.25]) xticklabels({'Tel', 'Hab','OT', 'Hind'}) title('OFF activated') clear toplotC toplotM p hold off figure (60) set(gcf, 'Position',[100 100 300 400]) str= {[cfg.MutID ' % OFF inhibited']}; toplotC=NumCtrl.OFF.inhibited; toplotM=NumMut.OFF.inhibited; swarmchart(repmat([1 2 3 4], cfg.numCTRL,1), toplotC,80,'k','filled','MarkerFaceAlpha',0.5,'MarkerEdgeAlpha',0.5,'XJitterWidth',0.3), hold on for ii=1:4 errorbar(ii,mean(toplotC(:,ii)), std(toplotC(:,ii)),'Color','k', 'Marker','_') end swarmchart(repmat([1.5 2.5 3.5 4.5], cfg.numMUT,1), toplotM,80,cfg.Mutcolor,'filled','MarkerFaceAlpha',0.5,'MarkerEdgeAlpha',0.5,'XJitterWidth',0.3), hold on for ii=1:4 errorbar(ii+0.5,mean(toplotM(:,ii)), std(toplotM(:,ii)),'Color','k', 'Marker','_') end xlim([-0 5]), ylim([-2 25]) ylabel('% of responding cells') for i=1:4 p(i)=ranksum(toplotC(:,i),toplotM(:,i)); end text(0,-1,num2str(['Tel:' sprintf('%.3f',p(1))... ' Hb:' sprintf('%.3f',p(2)) ' OT:' sprintf('%.3f',p(3))... ' Hind:' sprintf('%.3f',p(4))])) xticks([1.25 2.25 3.25 4.25]) xticklabels({'Tel', 'Hab','OT', 'Hind'}) title('OFF inhibited') clear toplotC toplotM p hold off