%% 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)=NaN; P(P=pvl)=NaN; P(P=pvl)=NaN; P(P