-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvisualizeAllTimeSeriesSession3rd.m
109 lines (85 loc) · 4.99 KB
/
visualizeAllTimeSeriesSession3rd.m
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
% This program is intended to extract
%
%
% time series of BOLD signals from session3(anesthesia)
%
%
% by Hiro Taiyo Hamada, Araya Inc.
%close all; clear all;
addpath(fullfile(pwd, '/programs'))
% Anesthesia1st
datapath_session3rd = fullfile(pwd, '/data/session3');
listing_tph = makeList(datapath_session3rd , '*TPH*');
listing_cont = makeList(datapath_session3rd , '*WT*');
%% TPHSKK
% blue
timeseries_TPHB = extGroupTSROI(listing_tph, 'blue', 'tph');
% Yellow
timeseries_TPHY = extGroupTSROI(listing_tph, 'yellow', 'tph');
BOLDresponse_tphb = extBOLDresponse(timeseries_TPHB);
BOLDresponse_tphy = extBOLDresponse(timeseries_TPHY);
%% control
% blue
timeseries_CNTB = extGroupTSROI(listing_cont, 'blue', 'cont');
% yellow
timeseries_CNTY = extGroupTSROI(listing_cont, 'yellow', 'cont');
BOLDresponse_contb = extBOLDresponse(timeseries_CNTB);
BOLDresponse_conty = extBOLDresponse(timeseries_CNTY);
% load ROI.name.
roipath = fullfile(pwd, '/ROIs');
[ROIname] = ExtROIname(roipath);
% result path
% result path
resultpath_tph_session3 = fullfile(pwd, '/figures/FigureS5/session3/TPH');
resultpath_cont_session3 = fullfile(pwd, '/figures/FigureS5/session3/CONT');
resultpath_vsb_session3 = fullfile(pwd, '/figures/FigureS5/session3/TPHvsCont_blue');
resultpath_vsy_session3 = fullfile(pwd, '/figures/FigureS5/session3/TPHvsCont_yellow');
mkdir(resultpath_tph_session3);
mkdir(resultpath_cont_session3);
mkdir(resultpath_vsb_session3);
mkdir(resultpath_vsy_session3);
stim = 1:5;
% visualize and save the tph group
colors = {'g', 'b'};
[AUC_TPH_B_session3, AUC_TPH_Y_session3, meanTIME_TPH_B_session3, meanTIME_TPH_Y_session3, maxTIMES_TPH_B_session3, maxTIMES_TPH_Y_session3, Pvalus_TPH_BvsY_session3] = visualizeBOLDresponses(BOLDresponse_tphb, BOLDresponse_tphy, ROIname, resultpath_tph_session3,colors, 'same', stim);
% visualize and save the cont group
colors = {'k', 'r'};
[AUC_CONT_B_session3, AUC_CONT_Y_session3, meanTIME_CONT_B_session3, meanTIME_CONT_Y_session3, maxTIMES_CONT_B_session3, maxTIMES_CONT_Y_session3, Pvalus_CONT_BvsY_session3] = notvisualizeBOLDresponses(BOLDresponse_contb, BOLDresponse_conty, ROIname, resultpath_cont_session3, colors, 'same', stim);
% visualize and save the tph vs cont, blue stimulation
colors = {'r', 'b'};
[AUC_TPH_B_session3, AUC_CONT_B_session3, meanTIME_TPH_B_session3, meanTIME_CONT_B_session3, maxTIMES_TPH_B_session3, maxTIMES_CONT_B_session3, Pvalus_TPHvsCONT_b_session3] = notvisualizeBOLDresponses(BOLDresponse_tphb, BOLDresponse_contb, ROIname, resultpath_vsb_session3, colors, 'different', stim);
% visualize and save the cont group
colors = {'k', 'g'};
[AUC_TPH_Y_session3, AUC_CONT_Y_session3, meanTIME_TPH_Y_session3, meanTIME_CONT_Y_session3, maxTIMES_TPH_Y_session3, maxTIMES_CONT_Y_session3, Pvalus_TPHvsCONT_y_session3] = notvisualizeBOLDresponses(BOLDresponse_tphy, BOLDresponse_conty, ROIname, resultpath_vsy_session3, colors,'different', stim);
close all;
%% visualization of statistical results.
% AUC of %BOLD signals,
[sig_AUC, pvals_AUC] = ttest(AUC_TPH_B_session3 - AUC_TPH_Y_session3);
MC_pvals_AUC = fdr_bh(pvals_AUC);
% mean BOLD signals,
[sig_meanB, pvals_meanB] = ttest2(meanTIME_TPH_B_session3,meanTIME_TPH_Y_session3);
MC_pvals_meanBOLD = fdr_bh(pvals_meanB);
% Peaks BOLD signals,
[sig_peakB, pvals_peakB] = ttest(maxTIMES_TPH_B_session3 - maxTIMES_TPH_Y_session3);
MC_pvals_peakBOLD = fdr_bh(pvals_peakB);
% %BOLD signals,
[sig_AUC, pvals_AUC] = ttest(AUC_CONT_B_session3 - AUC_CONT_Y_session3);
MC_pvals_AUC = fdr_bh(pvals_AUC);
% AUC BOLD signals,
[sig_meanB, pvals_meanB] = ttest(meanTIME_CONT_B_session3 - meanTIME_CONT_Y_session3);
MC_pvals_meanBOLD = fdr_bh(pvals_meanB);
% Peaks BOLD signals,
[sig_peakB, pvals_peakB] = ttest(maxTIMES_CONT_B_session3 - maxTIMES_CONT_Y_session3);
% visualization of statistical tests on
timedur = 40;
% maxAUC and maxTIMES, B and Y, transgenic
[maxTIMES1_bsession3, maxTIMES2_ysession3, maxTIMES1id_bsession3, maxTIMES2id_ysession3, maxAUC1_bsession3, maxAUC2_ysession3, maxAUC1id_bsession3, maxAUC2nd_ysession3] = peaksearchBOLDresponses2(BOLDresponse_tphb, BOLDresponse_tphy, ROIname, timedur, stim);
% maxAUC and maxTIMES, B and Y, control
[maxTIMES1_CONTsession3, maxTIMES2_CONTsession3, maxTIMES1id_CONTsession3, maxTIMES2id_CONTsession3, maxAUC1_CONTsession3, maxAUC2_CONTsession3, maxAUC1id_CONTsession3, maxAUC2nd_CONTsession3] = peaksearchBOLDresponses2(BOLDresponse_contb, BOLDresponse_conty, ROIname, timedur, stim);
% correlation between peaks of bold and timing of BOLD,
[r_PeakandTiming_b, pval_b] = corrcoef(mean(maxTIMES1_bsession3), mean(maxTIMES1id_bsession3));
fprintf('correlation between peaks and timing: r = %f \n', r_PeakandTiming_b(1,2));
fprintf('correlation between peaks and timing: pval = %f \n', pval_b(1,2));
[r_PeakandTiming_y, pval_y] = corrcoef(mean(maxTIMES2_ysession3), mean(maxTIMES2id_ysession3));
fprintf('correlation between peaks and timing: r = %f \n', r_PeakandTiming_y(1,2));
fprintf('correlation between peaks and timing: pval = %f \n', pval_y(1,2));