File size: 14,156 Bytes
03a0748
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
%% Plot Figure 3 and 4: Step 3: Plot Time-Frequnecy Results and tf-ROIs bar plots and Correlation Analysis
clear; clc; close all;

cwd = pwd; 
addpath(cwd);

datalocation = [cwd '\ALL_DATA\ALL_Processed_Data\'];   % Data are here

% cd(datalocation);



% % sort all subject groups

[~, ~, groupTable] = xlsread([ cwd '\Patients_MS.xlsx'],'ALL_GROUP');

groupIDs = cell2mat(groupTable(2:end,:) );



% % load clinical scores for correlation analysis

[~, ~, groupInfo] = xlsread([ cwd '\Patients_MS.xlsx'],'Ped_Subjs');



CTLids    = groupIDs(:,1); CTLids   (isnan(CTLids))    = [];

PD_NFZids = groupIDs(:,2); PD_NFZids(isnan(PD_NFZids)) = [];

PD_FZids  = groupIDs(:,3); PD_FZids(isnan(PD_FZids))   = [];

clear groupIDs



% % Import all analysis results here to plot

%  #################### CONTROLS #####################################

for n = 1:length(CTLids)

    

    disp([datalocation,'Control',num2str(CTLids(n)),'_ANALYZED.mat']);

    load([datalocation,'Control',num2str(CTLids(n)),'_ANALYZED.mat']);    

 

    CTL.POWER(n,:,:,:,:)   = MainOuts.POWER;

    clear MainOuts

end



% % #################### PD NON-FREEZERS #############################

for n = 1:length(PD_NFZids)

    disp([datalocation,'PD',num2str(PD_NFZids(n)),'_ANALYZED.mat']);

    load([datalocation,'PD',num2str(PD_NFZids(n)),'_ANALYZED.mat']);    

    

    NFZ.POWER(n,:,:,:,:)   = MainOuts.POWER;

    clear MainOuts 

end



% % #################### PD FREEZERS #################################

for n = 1:length(PD_FZids)

    disp([datalocation,'PD',num2str(PD_FZids(n)),'_ANALYZED.mat']);

    load([datalocation,'PD',num2str(PD_FZids(n)),'_ANALYZED.mat']);    

    

    FZ.POWER(n,:,:,:,:)   = MainOuts.POWER;

    clear MainOuts

end





%% Time-FREQUENCY POWER

tx2disp=-500:2:2000;

XLIM = [-500 2000];



min_freq = 1.0233;    max_freq = 50;    num_freqs=50;

frex = logspace(log10(min_freq),log10(max_freq),num_freqs); 



CONDI = 1; % 1=GO cue;

CHANI(1)   = find(strcmpi('Cz',{chanlocs.labels}));



% % %%%%%% POWER

% % % POWER Statistics: NFZ-CTL and FZ-CTL

YLIM = [1 50];





figure('rend','painters','pos',[10 10 1000 600])

ch=1;

CTLPOWER = CTL.POWER(:,CHANI(ch),:,:,CONDI);  

NFZPOWER = NFZ.POWER(:,CHANI(ch),:,:,CONDI);  

FZPOWER  = FZ. POWER(:,CHANI(ch),:,:,CONDI);



%%%% TF plots

clim = [-6 6];

subplot(2,3,1); imagesc(tx2disp,[], squeeze(mean(CTLPOWER,1)) ); axis xy; hold on; colormap jet; 

plot([0 0],YLIM,'k:'); title('Controls (CTL)'); set(gca,'xlim',XLIM,'ylim',YLIM,'clim',clim,'YTick',1:4:length(frex),'YTickLabel',round(frex(1:4:end))); colorbar



subplot(2,3,2); imagesc(tx2disp,[], squeeze(mean(NFZPOWER,1)) ); axis xy; hold on; colormap jet; 

plot([0 0],YLIM,'k:'); title('PDFOG- (NFZ)'); set(gca,'xlim',XLIM,'ylim',YLIM,'clim',clim,'YTick',1:4:length(frex),'YTickLabel',round(frex(1:4:end)));colorbar



subplot(2,3,3); imagesc(tx2disp,[], squeeze(mean(FZPOWER,1)) ); axis xy; hold on; colormap jet; 

plot([0 0],YLIM,'k:'); title('PDFOG+ (FZ)'); set(gca,'xlim',XLIM,'ylim',YLIM,'clim',clim,'YTick',1:4:length(frex),'YTickLabel',round(frex(1:4:end)));colorbar



%%%% TF with ttest2: runthreshold2 

clim = [-3 3];

subplot(2,3,4); imagesc(tx2disp,[], squeeze(mean(NFZPOWER,1)) - squeeze(mean(CTLPOWER,1)) ); axis xy; hold on; colormap jet; 

[Corrected_P] = Run_Thresh_2D_AS(squeeze(NFZPOWER) , squeeze(CTLPOWER),'between');

contour(tx2disp,1:50,Corrected_P,'k','linewidth',2); clear thresh ; plot([0 0],YLIM,'k:'); title('NFZ-CTL'); set(gca,'xlim',XLIM,'ylim',YLIM,'clim',clim,'YTick',1:4:length(frex),'YTickLabel',round(frex(1:4:end))); colorbar

clear Corrected_P



subplot(2,3,5); imagesc(tx2disp,[], squeeze(mean(FZPOWER,1)) - squeeze(mean(CTLPOWER,1)) ); axis xy; hold on; colormap jet; 

[Corrected_P] = Run_Thresh_2D_AS( squeeze(FZPOWER) , squeeze(CTLPOWER),'between');

contour(tx2disp,1:50,Corrected_P,'k','linewidth',2); clear thresh ; plot([0 0],YLIM,'k:'); title('FZ-CTL');set(gca,'xlim',XLIM,'ylim',YLIM,'clim',clim,'YTick',1:4:length(frex),'YTickLabel',round(frex(1:4:end)));colorbar

clear Corrected_P



subplot(2,3,6); imagesc(tx2disp,[], squeeze(mean(FZPOWER,1)) - squeeze(mean(NFZPOWER,1)) ); axis xy; hold on; colormap jet; 

[Corrected_P] = Run_Thresh_2D_AS( squeeze(FZPOWER) , squeeze(NFZPOWER),'between');

contour(tx2disp,1:50,Corrected_P,'k','linewidth',2); clear thresh ; plot([0 0],YLIM,'k:'); title('FZ-NFZ');set(gca,'xlim',XLIM,'ylim',YLIM,'clim',clim,'YTick',1:4:length(frex),'YTickLabel',round(frex(1:4:end)));colorbar

clear Corrected_P



clear CTLPOWER NFZPOWER FZPOWER



suptitle ('Figure 3A and 3B : Cz: GoCue-locked POWER Difference');



%% % Save power values for frequency bands values for correlation analysis

ExpPOWER.CTL{ch} = CTL.POWER(:,CHANI(ch),:,:,CONDI);

ExpPOWER.NFZ{ch} = NFZ.POWER(:,CHANI(ch),:,:,CONDI);

ExpPOWER.FZ{ch}  = FZ. POWER(:,CHANI(ch),:,:,CONDI);



ExpPOWER.groups  = groupTable;

% % save POW_CTLNFZFZ_Subjs.mat ExpPOWER % save for correlation analysis



% % %%%% Define: Delta and Beta for pedaling Initiation

SubjIDs = cell2mat(ExpPOWER.groups(2:end,:) );

ch = 1;



% Theta Frequnecy band: pedaling Initiation

fqidx1 = max(find(frex <=3.5) ) ;   fqidx2 =  max(find(frex <=7.5) );

tmidx1 = find(round(tx2disp)==0); tmidx2 = find(round(tx2disp)==400);



% Beta Frequnecy band: pedaling execution

fqidx3 = max(find(frex <=12.5) );   fqidx4 =  max(find(frex <=30) );

tmidx3 = find(round(tx2disp)==400); tmidx4 = find(round(tx2disp)==2000);



% pedaling Initiation (0-400 ms)

powCTL_GI.Te(:,ch) = squeeze(mean(mean(ExpPOWER.CTL{ch}(:,:,fqidx1:fqidx2,tmidx1:tmidx2),3),4 ));  powCTL_GI.Be(:,ch) = squeeze(mean(mean(ExpPOWER.CTL{ch}(:,:,fqidx3:fqidx4,tmidx1:tmidx2),3),4 ));

powNFZ_GI.Te(:,ch) = squeeze(mean(mean(ExpPOWER.NFZ{ch}(:,:,fqidx1:fqidx2,tmidx1:tmidx2),3),4 ));  powNFZ_GI.Be(:,ch) = squeeze(mean(mean(ExpPOWER.NFZ{ch}(:,:,fqidx3:fqidx4,tmidx1:tmidx2),3),4 ));

powFZ_GI.Te(:,ch)  = squeeze(mean(mean(ExpPOWER.FZ{ch} (:,:,fqidx1:fqidx2,tmidx1:tmidx2),3),4 ));  powFZ_GI.Be(:,ch)  = squeeze(mean(mean(ExpPOWER.FZ{ch} (:,:,fqidx3:fqidx4,tmidx1:tmidx2),3),4 ));



powCTL_GI.Te(:,2) = SubjIDs(:,1);   powCTL_GI.Be(:,2) = SubjIDs(:,1); 

powNFZ_GI.Te(:,2) = SubjIDs(:,2);   powNFZ_GI.Be(:,2) = SubjIDs(:,2);

powFZ_GI.Te(:,2) =  SubjIDs(:,3);   powFZ_GI.Be(:,2) =  SubjIDs(:,3); 



%%% pedaling (0-2000 ms)

powCTL_ped.Te(:,ch) = squeeze(mean(mean(ExpPOWER.CTL{ch}(:,:,fqidx1:fqidx2,tmidx1:tmidx4),3),4 ));  powCTL_ped.Be(:,ch) = squeeze(mean(mean(ExpPOWER.CTL{ch}(:,:,fqidx3:fqidx4,tmidx1:tmidx4),3),4 ));

powNFZ_ped.Te(:,ch) = squeeze(mean(mean(ExpPOWER.NFZ{ch}(:,:,fqidx1:fqidx2,tmidx1:tmidx4),3),4 ));  powNFZ_ped.Be(:,ch) = squeeze(mean(mean(ExpPOWER.NFZ{ch}(:,:,fqidx3:fqidx4,tmidx1:tmidx4),3),4 ));

powFZ_ped.Te(:,ch)  = squeeze(mean(mean(ExpPOWER.FZ{ch} (:,:,fqidx1:fqidx2,tmidx1:tmidx4),3),4 ));  powFZ_ped.Be(:,ch)  = squeeze(mean(mean(ExpPOWER.FZ{ch} (:,:,fqidx3:fqidx4,tmidx1:tmidx4),3),4 ));



powCTL_ped.Te(:,2) = SubjIDs(:,1);   powCTL_ped.Be(:,2) = SubjIDs(:,1); 

powNFZ_ped.Te(:,2) = SubjIDs(:,2);   powNFZ_ped.Be(:,2) = SubjIDs(:,2);

powFZ_ped.Te(:,2)  = SubjIDs(:,3);   powFZ_ped.Be(:,2)  = SubjIDs(:,3); 



% % Topo plots

figure('rend','painters','pos',[10 10 800 500])

pvl = 0.01;



[~,P,~,~]= ttest2( mean(mean(FZ.POWER(:,:,fqidx1:fqidx2,tmidx1:tmidx2,CONDI,1),3),4), mean(mean(CTL.POWER(:,:,fqidx1:fqidx2,tmidx1:tmidx2,CONDI,1),3),4)  ); 

P(P>=pvl)=NaN; P(P<pvl)=1; P(isnan(P))=0; 

subplot(221); topoplot( mean(mean(squeeze(mean(FZ.POWER(:,:,fqidx1:fqidx2,tmidx1:tmidx2,CONDI),1 )),2),3) - mean(mean(squeeze(mean(CTL.POWER(:,:,fqidx1:fqidx2,tmidx1:tmidx2,CONDI),1 )),2),3),...

    chanlocs,'maplimits',[-4 4],'electrodes','on','emarker2', {find(P),'d','k',5,1});    title('Theta; PDFOG+ - Controls'); clear P; colormap jet; 



[~,P,~,~]= ttest2( mean(mean(FZ.POWER(:,:,fqidx1:fqidx2,tmidx1:tmidx2,CONDI,1),3),4), mean(mean(NFZ.POWER(:,:,fqidx1:fqidx2,tmidx1:tmidx2,CONDI,1),3),4)  ); 

P(P>=pvl)=NaN; P(P<pvl)=1; P(isnan(P))=0; 

subplot(222); topoplot( mean(mean(squeeze(mean(FZ.POWER(:,:,fqidx1:fqidx2,tmidx1:tmidx2,CONDI),1 )),2),3) - mean(mean(squeeze(mean(NFZ.POWER(:,:,fqidx1:fqidx2,tmidx1:tmidx2,CONDI),1 )),2),3),...

    chanlocs,'maplimits',[-4 4],'electrodes','on','emarker2', {find(P),'d','k',5,1});    title('Theta; PDFOG+ - PDFOG-'); clear P; colormap jet; 



[~,P,~,~]= ttest2( mean(mean(FZ.POWER(:,:,fqidx3:fqidx4,tmidx1:tmidx2,CONDI,1),3),4), mean(mean(CTL.POWER(:,:,fqidx3:fqidx4,tmidx1:tmidx2,CONDI,1),3),4)  ); 

P(P>=pvl)=NaN; P(P<pvl)=1; P(isnan(P))=0;  

subplot(223); topoplot( mean(mean(squeeze(mean(FZ.POWER(:,:,fqidx3:fqidx4,tmidx1:tmidx2,CONDI),1 )),2),3) - mean(mean(squeeze(mean(CTL.POWER(:,:,fqidx3:fqidx4,tmidx1:tmidx2,CONDI),1 )),2),3),...

    chanlocs,'maplimits',[-1 1],'electrodes','on','emarker2', {find(P),'d','k',5,1});    title('Beta; PDFOG+ - Controls'); clear P; colormap jet; 



[~,P,~,~]= ttest2( mean(mean(FZ.POWER(:,:,fqidx3:fqidx4,tmidx1:tmidx2,CONDI,1),3),4), mean(mean(NFZ.POWER(:,:,fqidx3:fqidx4,tmidx1:tmidx2,CONDI,1),3),4)  ); 

P(P>=pvl)=NaN; P(P<pvl)=1; P(isnan(P))=0;  

subplot(224); topoplot( mean(mean(squeeze(mean(FZ.POWER(:,:,fqidx3:fqidx4,tmidx1:tmidx2,CONDI),1 )),2),3) - mean(mean(squeeze(mean(NFZ.POWER(:,:,fqidx3:fqidx4,tmidx1:tmidx2,CONDI),1 )),2),3),...

    chanlocs,'maplimits',[-1 1],'electrodes','on','emarker2', {find(P),'d','k',5,1});    title('Beta; PDFOG+ - PDFOG-'); clear P; colormap jet; 



suptitle('Figure 3E and 3F : Topo plots (Theta and beta power; 0-400 ms time window)'); 



%% % Plot selcted band for boxplot with scatter plot to see each values

%%%% for pedaling ROIs

ThetabandBox1Ped = [powCTL_ped.Te(:,1); powNFZ_ped.Te(:,1); powFZ_ped.Te(:,1) ];

BetabandBox2Ped = [powCTL_ped.Be(:,1); powNFZ_ped.Be(:,1); powFZ_ped.Be(:,1) ];



%%%% group data

nCTL = length(powCTL_ped.Te(:,1));

nNFZ = length(powNFZ_ped.Te(:,1));

nFZ  = length(powFZ_ped.Te(:,1));



for nn = 1:nCTL

    bandMdVar1{nn,1} = sprintf('%s', 'CTL');    
    bandMdVar1{nn,2} =1 ; 
end 
for nn = nCTL+1: nNFZ+ nNFZ
    bandMdVar1{nn,1} = sprintf('%s', 'NFZ');  
    bandMdVar1{nn,2}=2; 
end

for nn = nCTL+nNFZ+1:nCTL+nNFZ+nFZ
    bandMdVar1{nn,1} = sprintf('%s', 'FZ');  
    bandMdVar1{nn,2}=3; 
end

figure('rend','painters','pos',[10 10 800 900]);

%%%%% for Pedaling Initiation tf-ROIs
ThetabandBox1GI = [powCTL_GI.Te(:,1); powNFZ_GI.Te(:,1); powFZ_GI.Te(:,1) ];
BetabandBox2GI = [powCTL_GI.Be(:,1); powNFZ_GI.Be(:,1); powFZ_GI.Be(:,1) ];

subplot(221);
boxplot(ThetabandBox1GI,bandMdVar1(:,1), 'OutlierSize',12);  hold on;
gscatter( cell2mat(bandMdVar1(:,2)) , ThetabandBox1GI, bandMdVar1(:,1), 'kgr'); hold off; ylabel('POWER (dB)'); title('0-400 ms: Theta power'); ylim([-2 6]);

subplot(222);
boxplot(BetabandBox2GI,bandMdVar1(:,1), 'OutlierSize',12);  hold on;
gscatter( cell2mat(bandMdVar1(:,2)) , BetabandBox2GI, bandMdVar1(:,1), 'kgr'); hold off; ylabel('POWER (dB)'); title('0-400 ms: Beta power');ylim([-6 3]);

%%%%% for Pedaling Execuation tf-ROIs
subplot(223);
boxplot(ThetabandBox1Ped,bandMdVar1(:,1), 'OutlierSize',12);  hold on;
gscatter( cell2mat(bandMdVar1(:,2)) , ThetabandBox1Ped, bandMdVar1(:,1), 'kgr'); hold off; ylabel('POWER (dB)'); title('0-2000 ms: Theta power'); ylim([-2 6]);

subplot(224);
boxplot(BetabandBox2Ped,bandMdVar1(:,1), 'OutlierSize',12);  hold on;
gscatter( cell2mat(bandMdVar1(:,2)) , BetabandBox2Ped, bandMdVar1(:,1), 'kgr'); hold off; ylabel('POWER (dB)'); title('0-2000 ms: Beta power'); ylim([-6 3]);

suptitle('Figure 3C and 3D : Theta and Beta tf-ROI power');

%% ############################################################ Figure 4 ###############################################
% % Correlation Analysis with Power values

groupIDs = cell2mat(groupInfo(2:end,2:end) );

idx1 = find(groupIDs(:,1)==1); idx2 = find(groupIDs(:,1)==2); idx3 = find(groupIDs(:,1)==3);
CTLids = groupIDs(idx1,:);
NFZids = groupIDs(idx2,:);
FZids  = groupIDs(idx3,:);

MOCA = groupIDs([idx2; idx3],3);
FOG  = groupIDs([idx2; idx3],4);
UPDRS  = groupIDs([idx2; idx3],5);

Clinical_Score = [MOCA FOG UPDRS];
% % % correlation Type
corrType = 'Spearman';

% % % Correlation Analysis: Organize all Data

%%%% for pedaling Initiation: 0-400 ms
Thetadata = [powNFZ_GI.Te(:,1); powFZ_GI.Te(:,1) ];
Betadata =  [powNFZ_GI.Be(:,1); powFZ_GI.Be(:,1) ];

POWER_BANDS = [Thetadata Betadata]; 

for var = 1:2
    figure('rend','painters','pos',[10 10 400 900]);
    % with FOG scores
    subplot(311); SS = plot( FOG, POWER_BANDS(:,var), 'k+');hold on;  
    [R,P] = corr( FOG, POWER_BANDS(:,var),'type',corrType);  set(SS, 'MarkerSize', 8, 'LineWidth', 2);   l = lsline ; set(l,'LineWidth', 2); hold off;
    xlabel('FOG Score', 'FontSize', 10); set(gca, 'FontSize', 10, 'YMinorTick','on','XMinorTick','on'); 
    title(['\color{black} rho=' num2str(R,'%3.2f'),';  P=' num2str(P,'%3.3f')]); clear SS R P l; xlim([min(FOG)-1 max(FOG)+1]); 

    % with UPDRS III
    subplot(312); SS = plot( UPDRS, POWER_BANDS(:,var), 'k+');hold on;  
    [R,P] = corr( UPDRS, POWER_BANDS(:,var),'type',corrType);  set(SS, 'MarkerSize', 8, 'LineWidth', 2);   l = lsline ; set(l,'LineWidth', 2); hold off;
    xlabel('UPDRS Score', 'FontSize', 10);  set(gca, 'FontSize', 10, 'YMinorTick','on','XMinorTick','on'); 
    title(['\color{black} rho=' num2str(R,'%3.2f'),';  P=' num2str(P,'%3.3f')]); clear SS R P l; xlim([min(UPDRS)-1 max(UPDRS)+1]);
    
    % with MOCA
    subplot(313); SS = plot( MOCA, POWER_BANDS(:,var), 'k+');hold on;  
    [R,P] = corr( MOCA, POWER_BANDS(:,var),'type',corrType);  set(SS, 'MarkerSize', 8, 'LineWidth', 2);   l = lsline ; set(l,'LineWidth', 2); hold off;
    xlabel('MOCA Score', 'FontSize', 10);  set(gca, 'FontSize', 10, 'YMinorTick','on','XMinorTick','on'); 
    title(['\color{black} rho=' num2str(R,'%3.2f'),';  P=' num2str(P,'%3.3f')]); clear SS R P l; xlim([min(MOCA)-1 max(MOCA)+1]); 

    if var ==1
        suptitle('Figure 4A: Correlation against Theta band values')
    elseif var ==2
        suptitle('Figure 4B: Correlation against Beta band values')
    end
    
end