-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFig4jl_Extended_Data_Fig9lmpqr_Activity_modes_per_region.m
126 lines (107 loc) · 2.85 KB
/
Fig4jl_Extended_Data_Fig9lmpqr_Activity_modes_per_region.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Script that plots the activity modes per region from processed data.
% Inspired and adapted from Allen et al., Science, 2019
%
% Written by pielem Le Merre
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cls
format long
set(0, 'DefaultFigureRenderer', 'painters')
%%
Regions = {'ACAd','PL','ILA','ORBm'};
Genotypes = {'WT','VGlut2','NPY','Esr'};
% activity bin parameters
bin_sz = 0.1; % in seconds
pre = -2; % in seconds
post = 5; % in seconds
time_window = post-pre; % in seconds
% preallocate
load('/Users/pielem/Documents/MATLAB/Esr1_NPX_code/analysis/activity_modes/PL_activity_modes5.mat')
sb2 = nan(16,size(state.b2,2));
cc = nan(16,size(state.b2,2));
av = nan(16,size(state.b2,2));
t = linspace(pre,post,round(time_window/bin_sz));
cnt = 1;
for g = 1:numel(Genotypes)
for i = 1:numel(Regions)
region = Regions{i};
load(['/Users/pielem/Documents/MATLAB/Esr1_NPX_code/analysis/activity_modes/' region '_activity_modes5.mat'])
sb2(cnt,:) = state.b2(g,:)-state.b1(g,:);
cc(cnt,:) = cue.b2(g,:)-cue.b1(g,:);
av(cnt,:) = avs.b2(g,:)-avs.b1(g,:);
cnt = cnt + 1;
end
end
figure;
cnt = 0;
cnt2 = 0;
for g = 1:numel(Genotypes)
subplot(4,3,1+cnt)
imagesc('XData',t,'CData',flip(cc(1+cnt2:4+cnt2,:)))
caxis([-0.15, 0.15])
xlim([-1 2])
set(gca,'YTick',[1 2 3 4]);
set(gca,'YTickLabel',flip(Regions));
title('Cue')
subplot(4,3,2+cnt)
imagesc('XData',t,'CData',flip(av(1+cnt2:4+cnt2,:)))
xlim([-1 2])
caxis([-0.15, 0.15])
title('Aversive signal')
subplot(4,3,3+cnt)
imagesc('XData',t,'CData',flip(sb2(1+cnt2:4+cnt2,:)))
xlim([-1 2])
caxis([-0.15, 0.15])
title('State')
cnt = cnt + 3;
cnt2 = cnt2 + 4;
colormap(ametrine)
end
sgtitle('Activity mode: diff Block 2 - block 1')
set(gcf,'units','points','position',[500,370,1500,550])
%% State mode color map
%Esr
figure;
load('/Users/pielem/OneDrive - Karolinska Institutet/Mac/Documents/MATLAB/Esr1_NPX_code/utilities/Colormaps/purple.mat')
state_mean = nan(1,4);
for i = 1:4
state_mean(i) = mean(sb2(12+i,:),2);
end
imagesc(state_mean)
colormap(purple_cmap)
caxis([0, 0.15])
colorbar
title('Esr')
%WT
figure;
state_mean = nan(1,4);
for i = 1:4
state_mean(i) = mean(sb2(i,:),2);
end
imagesc(state_mean)
colormap(purple_cmap)
caxis([0, 0.15])
colorbar
title('WT')
%VGlut2
figure;
state_mean = nan(1,4);
for i = 1:4
state_mean(i) = mean(sb2(4+i,:),2);
end
imagesc(state_mean)
colormap(purple_cmap)
caxis([0, 0.15])
colorbar
title('VGlut2')
%NPY
figure;
state_mean = nan(1,4);
for i = 1:4
state_mean(i) = mean(sb2(8+i,:),2);
end
imagesc(state_mean)
colormap(purple_cmap)
caxis([0, 0.15])
colorbar
title('NPY')