-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_supplemental_figure_localization_precisions_fig1.m
123 lines (98 loc) · 3.27 KB
/
create_supplemental_figure_localization_precisions_fig1.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
function create_supplemental_figure_localization_precisions_fig1()
% Computes histograms of the localization precision for all subpanels in
% Fig1
%
% Recreates Suppl. Figure 2
%
% This file is part of the supplementary software for "DNA-PAINT MINFLUX
% nanoscopy", 2021 by Lynn M. Ostersehlt, Daniel C. Jans, Anna Wittek,
% Jan Keller-Findeisen, Steffen J. Sahl, Stefan W. Hell, and Stefan Jakobs
fprintf('calculates localization precision histograms for Minflux data in Fig 1&2\n');
if ~exist('get_root_folder.m', 'file')
initialize();
end
% determine file locations
root_folder = get_root_folder();
figure_folder = [root_folder, filesep, 'results', filesep, 'precisions'];
% create figure
fig = figure();
fig.Position = [100, 100, 1200, 1400];
% 2D data from Fig1
data_folder = [root_folder, filesep, 'data', filesep, '2D', filesep];
T = 5;
% iterate over all subpanels
panels = {'a', 'b', 'c', 'd', 'e', 'f'};
for i = 1 : numel(panels)
panel = panels{i};
% load Minflux file
files = dir([data_folder, sprintf('Fig1%s*_Minflux.mat', panel)]);
assert(numel(files) == 1);
file = [data_folder, files(1).name];
minflux = load(file);
minflux = minflux.minflux;
% calculate extended statistics
minflux = calculate_extended_statistics(minflux);
% sigma_r (see Supplement for definitions)
s = minflux.combined.std_xyz(minflux.combined.n >= T, :);
sr = sqrt((s(:, 1).^2 + s(:, 2).^2)/2);
med = median(sr);
% display histogram
ax = subplot(4,3,i);
histogram(sr, 0:0.4:12);
hold on;
plot(med*[1,1], ylim(), 'r-', 'LineWidth', 1.3);
xlim([0, 12]);
xticks(0:4:12);
xlabel('\sigma_r (nm)');
ylabel('occurence');
title(sprintf('median \\sigma_r=%.1f nm', med));
grid on;
box on;
ax.FontSize = 12;
end
% 3D data from Fig2
data_folder = [root_folder, filesep, 'data', filesep, '3D', filesep];
names = {'GFP', 'Mic60', 'ATP5B'};
for i = 1 : numel(names)
% load Minflux file
file_name = sprintf('Fig2_U2OS_Tom70-Dreiklang_%s_AB_Minflux3D.mat', names{i});
file = [data_folder, file_name];
minflux = load(file);
minflux = minflux.minflux;
% calculate extended statistics
minflux = calculate_extended_statistics(minflux);
% sigma_r, sigma_z (see Supplement for definitions)
s = minflux.combined.std_xyz(minflux.combined.n >= T, :);
sr = sqrt((s(:, 1).^2 + s(:, 2).^2)/2);
med = median(sr);
sz = s(:, 3);
medz = median(sz);
% display sr histogram
ax = subplot(4,3,6+i);
histogram(sr, 0:0.4:12);
hold on;
plot(med*[1,1], ylim(), 'r-', 'LineWidth', 1.3);
xlim([0, 12]);
xticks(0:4:12);
xlabel('\sigma_r (nm)');
ylabel('occurence');
title(sprintf('median \\sigma_r=%.1f nm', med));
grid on;
box on;
ax.FontSize = 12;
% display sz histogram
ax = subplot(4,3,9+i);
histogram(sz, 0:0.4:12);
hold on;
plot(medz*[1,1], ylim(), 'r-', 'LineWidth', 1.3);
xlim([0, 12]);
xticks(0:4:12);
xlabel('\sigma_z (nm)');
ylabel('occurence');
title(sprintf('median \\sigma_z=%.1f nm', medz));
grid on;
box on;
ax.FontSize = 12;
end
exportgraphics(fig, [figure_folder, filesep, 'Localization_precision_histograms_Fig12.png']);
end