Browse Source

gin commit from DESKTOP-593CF0Q

New files: 1
Modified files: 15
jiyunshin 3 years ago
parent
commit
133b7857ee

+ 1 - 19
codes/Behavioral analysis/Fig1NormLearningScoreAllData.m

@@ -1,9 +1,4 @@
-load('CtrlDreaddCumValsNew.mat', 'untrained','pre_norm_last', 'post_norm_last','Ctrl','Exp')
 
-
-%%
-%%                                                 % Mean
-%dci  = std(data)*tinv(0.975,size(data,1)-1);                        % Confidence Intervals
 xt = [1:5];                                                         % X-Ticks
 
 lb = [xt'-ones(5,1)*0.2,  xt'+ones(5,1)*0.2]; % Long Bar X
@@ -32,21 +27,8 @@ xlim([0.5 5.5])
 ylim([-1 1])
 set(gca,'YTick', [-1:0.5:1])
 
-%% Statistics
-[h, p] = swtest(Ctrl)
-[h, p] = swtest(Exp)
-
-
-% Parametric
-group = [ones(20,1); ones(12,1)+1; ones(5,1)+2];
-[p,tbl,stats] = anova1([Ctrl; Exp ; untrained],group,'off')
-
-c = multcompare(stats,'CType', 'bonferroni')
-
-
-[h p] =ttest2(Ctrl, Exp)
+%% Non-parametric Statistics
 
-%% non-parametric
 [p,tbl,stats] = kruskalwallis([Ctrl; Exp ; untrained],group,'off')
 
 c = multcompare(stats,'CType', 'dunn-sidak')

+ 0 - 2
codes/Behavioral analysis/Fig1PlotTotalCumSumVals.m

@@ -1,6 +1,4 @@
-load('CtrlDreaddCumValsNew.mat', 'Control_cumvals', 'Exp_cumvals','Naive_cumvals' )
 
-%%
 figure
 errorbar(nanmean(Control_cumvals,2),nanstd(Control_cumvals,[],2)/sqrt(20),'k')
 hold on

+ 0 - 23
codes/Behavioral analysis/Fig3CtrlBacSST.m

@@ -1,21 +1,4 @@
-load('Figure3Data.mat')
 
-%%
-SST_cumvals = nan(150,size(SSTCumVals,1));
-for i = 1:size(SSTCumVals,1)
-    cumvals = SSTCumVals{i};
-    if size(cumvals,1) < 150
-        SST_cumvals(1:size(cumvals,1),i) = cumvals;
-    else
-        SST_cumvals(:,i) = cumvals(1:150);
-    end
-end
-
-%%
-BacL1_cumvals = BacL1_cumvals(1:100,:);
-SST_cumvals = SST_cumvals(1:100,:);
-
-%%
 figure
 errorbar(nanmean(Control_cumvals,2),nanstd(Control_cumvals,[],2)/sqrt(11),'k')
 
@@ -57,12 +40,6 @@ set(gca, 'XTick',1:3, 'XTickLabel', {'Ctrl','Baclofen', 'SST'})
 ylabel('Normalized learning score')
 xlim([0.5 3.5])
 
-%%
-group = [ones(20,1); ones(6,1)+1; ones(6,1)+2];
-
-[p,tbl,stats] = kruskalwallis([Ctrl; BacL1; SSTNormCumSumLastVal'],group,'off')
-
-c = multcompare(stats,'CType', 'dunn-sidak')
 
 
 %%

+ 0 - 3
codes/Behavioral analysis/Fig3NormLearningScoreCtrlSST.m

@@ -1,7 +1,4 @@
-%Ctrl = [0.317596566523605; 0.281105990783410; 0.574712643678161; 0.487603305785124 ;0.461538461538462; 0.707006369426752];
-%SST = [-0.651785714285714; -0.113772455089820; -0.467032967032967; 0.166666666666667; 0.0941828254847646; 0];
 
-                                                 % Mean
 figure                                                 
 PlotAllDataPoints(Ctrl,SST)
 set(gca, 'XTickLabel', {'Ctrl','SST'})

+ 1 - 2
codes/Behavioral analysis/Supp2NormLearningScoreCtrlHPC.m

@@ -1,5 +1,4 @@
-load('SuppLidoHCCumVals.mat')
-%%
+
 xt = [1:4];                                                         % X-Ticks
 
 lb = [xt'-ones(4,1)*0.2,  xt'+ones(4,1)*0.2]; % Long Bar X

+ 3 - 10
codes/Behavioral analysis/Supp2RatCtrlPRh.m

@@ -1,5 +1,4 @@
-load('SuppLidoPRhCumVals.mat')
-%%
+
 PlotAllDataPoints3(RatCtrlNormCumSumLastVal, PRhExp, PRhPost)
 
 
@@ -14,15 +13,9 @@ set(gca, 'YTick', -1:0.5:1)
 [p2 h] = ranksum(RatCtrlNormCumSumLastVal, PRhPost)
 
 
-%text(0.8, 0.8, ['p=', num2str(p1)])
-%text(2.8, 0.8, ['p=', num2str(p2)])
-
-%% non-parametric
-group = [ones(24,1); ones(4,1)+1; ones(6,1)+2];
-
-[p,tbl,stats] = kruskalwallis([RatCtrlNormCumSumLastVal; PRhExp ; PRhPost],group,'off')
+text(0.8, 0.8, ['p=', num2str(p1)])
+text(2.8, 0.8, ['p=', num2str(p2)])
 
-c = multcompare(stats,'CType', 'dunn-sidak')
 
 
 %%

+ 1 - 26
codes/Behavioral analysis/Supp6CtrlPOm.m

@@ -1,20 +1,4 @@
-load('SuppPOmData.mat')
 
-%%
-POm_cumvals = nan(150,size(POmCumVals,1));
-for i = 1:size(POmCumVals,1)
-    cumvals = POmCumVals{i}';
-    if size(cumvals,1) < 150
-        POm_cumvals(1:size(cumvals,1),i) = cumvals;
-    else
-        POm_cumvals(:,i) = cumvals(1:150);
-    end
-end
-
-%%
-POm_cumvals = POm_cumvals(1:100,:);
-
-%%
 figure
 errorbar(nanmean(Control_cumvals,2),nanstd(Control_cumvals,[],2)/sqrt(20),'k')
 
@@ -27,16 +11,7 @@ ylabel('Cummulative Sum')
 xlabel('trial #')
 
 
-%%
-% figure
-% boundedline(1:150, nanmean(Control_cumvals,2), nanstd(Control_cumvals,[],2)/sqrt(11),'k')
-% hold on
-% boundedline(1:150, nanmean(BacL1_cumvals,2),nanstd(BacL1_cumvals,[],2)/sqrt(12),'r')
-% hold on
-% boundedline(1:150, nanmean(POm_cumvals,2),nanstd(POm_cumvals,[],2)/sqrt(5),'b')
-% 
-% ylabel('Cummulative Sum')
-% xlabel('trial #')
+
 
 %%
 for i =1:size(Control_cumvals,2)

+ 2 - 18
codes/Behavioral analysis/Supp6WTCNO.m

@@ -1,8 +1,4 @@
-load('CtrlDreaddCumValsNew.mat', 'Ctrl', 'CNO')
-%%
-Expert = Ctrl(1:3);
-WT = setdiff(Ctrl, [CNO;Expert]);
-%%
+
 
 figure
 PlotAllDataPoints3(WT, CNO, Expert)
@@ -13,22 +9,10 @@ set(gca, 'XTick',1:3, 'XTickLabel', {'WT', 'CNO','Expert'})
 ylabel('Normalized learning score')
 xlim([0.5 3.5])
 
-%%
+%% Statistics
 x = [WT; CNO; Expert];
 group  = [ones(length(WT),1); ones(length(CNO),1)+1; ones(length(Expert),1)+2]
 p = kruskalwallis(x,group)
 
 
 
-
-%%
-[p1 h] = ranksum(WT, CNO)
-
-text(1.2, 0.7, ['p = ', num2str(p1)])
-
-[p2 h] = ranksum(WT, Expert)
-text(2.2, 0.7, ['p = ', num2str(p2)])
-
-
-ylim([-0.5 1])
-set(gca,'YTick', [-0.5:0.5:1])

+ 2 - 17
codes/Electrophysiology analysis/AllCellsBurstPSTH.m

@@ -21,31 +21,16 @@ for i = 1:length(Group)
         Microstims = [Group(i).Microstims];
     end
     
-    %HighIntensity = find(Microstims(:,3) >= 40);
-    %LowIntensity = find(Microstims(:,3) < 40);
+   
     HitTimes = find(Microstims(:,2) <= 1.2 & Microstims (:,2) > 0.1);
     
     Hits = Microstims(HitTimes,1);
-    %HighStimTimes = Microstims(intersect(HighIntensity, HitTimes),1);
-    %LowStimTimes = Microstims(intersect(LowIntensity, HitTimes),1);
     
- 
-    
-    
-    %[bpsthNormHigh,numTrialsHigh edges] = RasterPSTH (HighStimTimes, BurstTimes(1:2:end), preStim, postStim, binsize,'mkplt', false );
-    %saveas(gcf, [cd, '\RasterPSTH\', cellname, 'RasterPSTHhigh.fig'])
-
-    
-    %[bpsthNormLow,numTrialsLow edges] = RasterPSTH (LowStimTimes, BurstTimes(1:2:end), preStim, postStim, binsize,'mkplt', false );
-    %saveas(gcf, [cd, '\RasterPSTH\', cellname, 'RasterPSTHlow.fig'])
     
     % Total microstim
     [bpsthNorm,numHits, edges] = RasterPSTH (Hits, BurstTimes(1:2:end), preStim, postStim, binsize,'mkplt', mkplt);
     
-    %Group(i).bpsthNormHigh= bpsthNormHigh;
-    %Group(i).numTrialsHigh = numTrialsHigh;
-    %Group(i).bpsthNormLow = bpsthNormLow;
-    %Group(i).numTrialsLow = numTrialsLow;
+    
     Group(i).bpsthNorm= bpsthNorm;
     Group(i).numHits= numHits;
     %close all

+ 3 - 51
codes/Electrophysiology analysis/FindSigModulatedBins.m

@@ -1,6 +1,4 @@
-%%
-load('PSTH data.mat', 'Control_PSTHz','Control_bPSTHz', 'Dreadd_PSTHz','Dreadd_bPSTHz', 'Control_sorted', 'Dreadd_sorted')
-%%
+
 
 % bin comparison with bonferroni correction
 % any cell having at least 2 significant bins
@@ -121,17 +119,7 @@ ylabel('Cell num')
 legend({'Modulated', 'Unmodulated'})
 title('Firing rate')
 
-%figure
-% subplot(121)
-% pie([length(CtrlModulated), length(CtrlFreqSigNum)-length(CtrlModulated)])
-% title('Control (n=37)')
-% %legend({'Modulated', 'Unmodulated'})
-% 
-% subplot(122)
-% pie([length(ExpModulated), length(ExpFreqSigNum)-length(ExpModulated)])
-% title('hM4Di (n=36)')
-% %legend({'Modulated', 'Unmodulated'})
-% 
+
 n1 = length(CtrlModulated); N1 = length(CtrlFreqSigBins);
 n2 = length(ExpModulated); N2 = length(ExpFreqSigNum);
 x1 = [repmat('a',N1,1); repmat('b',N2,1)];
@@ -139,25 +127,6 @@ x2 = [repmat(1,n1,1); repmat(2,N1-n1,1); repmat(1,n2,1); repmat(2,N2-n2,1)];
 [tbl,chi2stat,pval] = crosstab(x1,x2)
 
 
-%%
-CtrlPosModulated = find(CtrlAvgZscoreSigBin> 0);
-CtrlNegModulated = find(CtrlAvgZscoreSigBin < 0);
-
-ExpPosModulated = find(ExpAvgZscoreSigBin> 0);
-ExpNegModulated = find(ExpAvgZscoreSigBin < 0);
-
-
-figure
-bar([length(CtrlPosModulated)*100/length(CtrlFreqSigBins), length(CtrlNegModulated)*100/length(CtrlFreqSigBins), ...,
-    (length(CtrlFreqSigBins)-(length(CtrlPosModulated)+length(CtrlNegModulated)))*100/length(CtrlFreqSigBins); 
-length(ExpPosModulated)*100/length(ExpFreqSigNum), length(ExpNegModulated)*100/length(ExpFreqSigNum), ...,
-(length(ExpFreqSigBins)-(length(ExpPosModulated)+length(ExpNegModulated)))*100/length(ExpFreqSigBins)],'stacked')
-set(gca, 'xticklabel', {'Control (n=37)', 'hM4Di (n=36)'})
-ylabel('Cell num')
-legend({'Postively Modulated', 'Negatively Modulated'})
-title('Firing rate')
-
-
 %%
 figure
 PlotAllDataPoints(CtrlFreqSigNum, ExpFreqSigNum)
@@ -181,16 +150,7 @@ ylabel('Cell num')
 legend({'Modulated', 'Unmodulated'})
 title('Burst rate')
 
-% figure
-% subplot(121)
-% pie([length(CtrlModulated), CtrlBurstCellNum-length(CtrlModulated)])
-% title(['Control (n=', num2str(CtrlBurstCellNum), ')'])
-% %legend({'Modulated', 'Unmodulated'})
-% 
-% subplot(122)
-% pie([length(ExpModulated), ExpBurstCellNum-length(ExpModulated)])
-% title(['hM4Di (n=', num2str(ExpBurstCellNum), ')'])
-% %legend({'Modulated', 'Unmodulated'})
+
 
 n1 = length(CtrlModulated); N1 = CtrlBurstCellNum;
 n2 = length(ExpModulated); N2 = ExpBurstCellNum;
@@ -207,12 +167,4 @@ p = ranksum (CtrlBurstSigNum, ExpBurstSigNum)
 text(1.2, 25, ['p = ', num2str(p)])
 
 
-%%
-CtrlM = Control_PSTHz(:,Control_sorted(CtrlModulated)); %Modulated cells
-ExpM = Dreadd_PSTHz(:,Dreadd_sorted(ExpModulated));
-
-figure
-boundedline(edges(1:end-1), mean(CtrlM,2), std(CtrlM,[],2)/sqrt(length(CtrlModulated)),'k') 
-hold on
-boundedline(edges(1:end-1), mean(ExpM,2), std(ExpM,[],2)/sqrt(length(ExpModulated)),'r') 
 

+ 1 - 7
codes/Electrophysiology analysis/GetAllCellsPSTHnorm.m

@@ -30,12 +30,6 @@ for i = 1:length(CellStruct)
             AllCellsPSTHnormHit(:,i) = psthNormHit;
         end
         
-%         % Miss trials
-%         MissIdx = find(Microstims(:,2) ==-0.1);
-%         MissTimes = Microstims(MissIdx,1);
-%         if length(MissTimes) > 4 % at least 5 trials
-%         [psthNormMiss,numTrials, edges] = RasterPSTH (MissTimes, SpikeTimes, preStim, postStim, binsize,'mkplt', false );
-%         AllCellsPSTHnormMiss(:,i) = psthNormMiss;
-%         end
+%       
     end
 end

+ 0 - 12
codes/Histology analysis/Anterograde tracing/NormalizeTraces.m

@@ -1,17 +1,5 @@
 function norm_total = NormalizeTraces (totalYFP)
 
-% detrendYFP = cell(size(totalYFP,2),1);
-% for i = 1:size(totalYFP,2)
-%  lastidx= find(isnan(totalYFP(:,i))==1,1) -1;
-%  if isempty(lastidx) == 1
-%     detrendYFP{i} = detrend(totalYFP(:,i));
-%  else
-%      detrendYFP{i} = detrend(totalYFP(1:lastidx,i));
-%  end
-%  
-% end
-
-
 baseline = min(totalYFP,[],1);
 
 normfactor = max(totalYFP-baseline);

+ 0 - 13
codes/Histology analysis/Anterograde tracing/PlotYFPQuantification.m

@@ -1,17 +1,4 @@
-figure
-plot(depth,PRy03)
-hold on
-plot(depth,mean(PRy03,2),'k','linew',2)
-xlim([0 1200])
-%%
-%norm_PRy03 = bsxfun(@rdivide,PRy03, max(PRy03,[],1));
-%norm_PRy02 = bsxfun(@rdivide,PRy02, max(PRy02,[],1));
-
-RatYFP = [PRy02 PRy03];
-
-
 
-%norm_total = bsxfun(@rdivide, total, max(total,[],1));
 %% Normalization
 norm_RatYFP = NormalizeTraces (RatYFP);
 

+ 0 - 33
codes/Histology analysis/DREADD effect quantification/DreaddEffectCorticalDepth.m

@@ -1,15 +1,4 @@
-load ('CBdata.mat', 'norm_CB', 'depth')
-load('PRh axon data.mat', 'norm_MouseYFP','MouseDepth')
-%%
-samedepth = dsearchn(MouseDepth, depth);
-
 
-%% Averaging two bins in MouseYFP
-temp1 = norm_MouseYFP(1:2:end,:);
-temp2 = norm_MouseYFP(2:2:end,:);
-
-norm_MouseYFPcorr = (temp1+temp2)./2;
-norm_MouseYFPcorr(387,:) = norm_MouseYFP(772,:);
 
 %% Effect size
 effect = nanmean(norm_MouseYFPcorr,2) .* nanmean(norm_CB,2);
@@ -47,27 +36,5 @@ plot([L5 L5], yvals, 'r--')
 
 
 legend({'YFP', 'Chicago blue', 'Effect'})
-%% Quantify Area under the curve
-interval = depth(2)-depth(1);
-area = effect*interval;
-startidx = dsearchn(depth,50)+1; %MouseYFP starts from 50 um
-TotalArea = sum(area(startidx:end));
-
-LayerBoundaries = [L1; L23; L4; L5];
-LayerIdx = zeros(4,1);
-for i = 1:4
-    LayerIdx(i) = dsearchn(depth, LayerBoundaries(i));
-end
-
-
-LayerIdx = [startidx-1; LayerIdx; 387];
-
-LayerAreas = zeros(5,1);
-for i = 1:length(LayerIdx)-1
-    LayerAreas(i) = sum(area(LayerIdx(i)+1:LayerIdx(i+1)));
-end
-
-Percentage = LayerAreas./TotalArea;
-Percentage = Percentage*100
 
 

+ 0 - 13
codes/Histology analysis/hM4Di quantification/PlotAvgNormDreaddExpression.m

@@ -1,17 +1,4 @@
-load('DreaddExpressionData.mat')
-%%
-AvgJS09norm = nanmean(JS09norm,2);
-
-%%
-rf = find(JS08(:,1) == 0);
-AvgJS09norm = AvgJS08norm(rf-386:rf+386);
 
-distance = JS08(rf-386:rf+386,1);
-
-%%
-TotalAvgNorm = [AvgR002norm, AvgR003norm, AvgR004norm, AvgY754norm, AvgY755norm, AvgJS09norm, ...,
-    AvgJS12norm, AvgJS13norm, AvgJS14norm, AvgJS22norm; AvgJS08norm];
-%%
 plot(distance, TotalAvgNorm)
 xlim([-1000 1000])
 hold on

+ 36 - 0
codes/Two-photon imaging analysis/L5 dendrites/PlotTwoPhotonDendrites.m

@@ -0,0 +1,36 @@
+%% Plotting data for Fig. 3G
+
+data_ON = ON(1).avgTrace;
+for i = 2 : length(ON)
+    data_ON(i, :) = ON(i).avgTrace;
+end
+avg_ON = mean(data_ON);
+
+data_OFF = OFF(1).avgTrace;
+for i = 2 : length(OFF)
+    data_OFF(i, :) = OFF(i).avgTrace;
+end
+avg_OFF = mean(data_OFF);
+
+data_NR = NR(1).avgTrace;
+for i = 2 : length(OFF)
+    data_NR(i, :) = NR(i).avgTrace;
+end
+avg_NR = mean(data_NR);
+
+smplr = 58.62;  % image acquisition rate (Hz)
+tt = [1 : 240] / smplr - 1;   % stimulation started 1 s after the imaging start
+
+figure
+hold('on')
+plot(tt, avg_ON, 'g', 'DisplayName', 'ON')   % plotting average calcium response
+plot(tt, avg_OFF, 'b', 'DisplayName', 'OFF')
+plot(tt, avg_NR, 'k', 'DisplayName', 'NR')
+
+xlim([-1 2])
+xlabel('Time after stimualtion (s)')
+ylim([-30 60])
+ylabel('dF/F (%)')
+
+title('Average peri-stimulus Ca2+ responses in ON, OFF and NR dendrites')
+legend({'ON', 'OFF', 'NR'})