Skip to content

Commit 83fcadf

Browse files
authored
Merge pull request #158 from RNA-FRETools/blinknbleach-stats
Blinking detection and statistics + other improvements
2 parents 48fe9ba + 5dc868b commit 83fcadf

455 files changed

Lines changed: 19273 additions & 84115 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

MASH-FRET/source/GUI/figure_MASH_CloseRequestFcn.m

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ function figure_MASH_CloseRequestFcn(obj, evd)
1818
if isfield(h, 'figure_optBg') && ishandle(h.figure_optBg)
1919
delete(h.figure_optBg)
2020
end
21+
if isfield(h, 'figure_pbStats') && ishandle(h.figure_pbStats)
22+
delete(h.figure_pbStats)
23+
end
2124
if isfield(h, 'figure_dummy') && ~isempty(h.figure_dummy) && ...
2225
ishandle(h.figure_dummy)
2326
delete(h.figure_dummy)
@@ -28,21 +31,35 @@ function figure_MASH_CloseRequestFcn(obj, evd)
2831

2932
p = h.param;
3033
if ~isempty(p.proj) && isfield(p.ttPr,'defProjPrm')
31-
% remove background intensities
32-
for c = 1:size(p.ttPr.defProjPrm.mol{3}{3},2)
33-
for l = 1:size(p.ttPr.defProjPrm.mol{3}{3},1)
34-
p.ttPr.defProjPrm.mol{3}{3}{l,c}(3) = 0;
34+
35+
for nChan = 1:size(p.ttPr.defProjPrm,2)
36+
for nExc = 1:size(p.ttPr.defProjPrm,1)
37+
if ~isfield(p.ttPr.defProjPrm{nExc,nChan},'mol')
38+
continue
39+
end
40+
41+
% remove background intensities
42+
for c = 1:size(p.ttPr.defProjPrm{nExc,nChan}.mol{3}{3},2)
43+
for l = 1:size(p.ttPr.defProjPrm{nExc,nChan}.mol{3}{3},1)
44+
p.ttPr.defProjPrm{nExc,nChan}.mol{3}{3}{l,c}(3) = 0;
45+
end
46+
end
47+
48+
% remove discretisation results
49+
p.ttPr.defProjPrm{nExc,nChan}.mol{3}{4} = [];
3550
end
3651
end
3752

38-
% remove discretisation results
39-
p.ttPr.defProjPrm.mol{3}{4} = [];
40-
p.folderRoot = p.proj{p.curr_proj}.folderRoot;
53+
% make path to test file root folder absolute
54+
p.folderRoot = maketestfilepathabsolute(...
55+
p.proj{p.curr_proj}.folderRoot);
4156
end
4257
p = rmfield(p,{'proj','curr_proj'});
4358
[mfile_path,o,o] = fileparts(which('MASH'));
4459
save([mfile_path filesep 'default_param.ini'], '-struct', 'p');
4560

46-
setContPan('closing MASH-FRET ...','process',obj);
61+
setContPan('deleting MASH-FRET window...','process',obj);
4762

4863
delete(obj);
64+
65+
disp('MASH-FRET succesfully closed, goodbye!');

MASH-FRET/source/GUI/mod-trace-processing/buildPanelScrollTP.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
ttl5 = 'Cross-talks';
1313
ttl6 = 'Factor corrections';
1414
ttl7 = 'Denoising';
15-
ttl8 = 'Photobleaching';
15+
ttl8 = 'Photobleaching/blinking';
1616
ttl9 = 'Find states';
1717

1818
% parents
@@ -22,7 +22,7 @@
2222
pospan = get(h_pan,'position');
2323
wpan0 = pospan(3);
2424
hpan1 = p.mgpan+htxt0+hpop0+p.mg/fact+htxt0+hpop0+p.mg/fact+htxt0+hedit0+...
25-
p.mg+hedit0+p.mg;
25+
p.mg+htxt0+hedit0+p.mg;
2626
hpan2 = p.mgpan+3*htxt0+p.mg/fact+htxt0+p.mg/fact+htxt0+hpop0+p.mg;
2727
hpan3 = p.mgpan+htxt0+hpop0+p.mg/fact+htxt0+hedit0+p.mg/fact+hedit0+...
2828
p.mg/fact+hedit0+p.mg;

MASH-FRET/source/GUI/mod-trace-processing/buildPanelTPphotobleaching.m

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,32 @@
2727
wedit0 = 40;
2828
fact = 5;
2929
str0 = 'method';
30-
str1 = 'stop';
30+
str1 = 'cutoff';
3131
str2 = {'Manual','Threshold'};
32-
str3 = 'Clip';
33-
str4 = 'Split';
32+
str4 = 'Stats';
3433
str5 = 'data';
3534
str6 = 'Select the data to process';
3635
str7 = 'all';
37-
ttstr0 = wrapHtmlTooltipString('Select a photobleaching <b>detection method</b>.');
38-
ttstr1 = wrapHtmlTooltipString('<b>Cutoff time/frame:</b> position on the x-axis where photobleaching was detected; the cutoff is shown by a cyan vertical bar in top and bottom plots.');
39-
ttstr2 = wrapHtmlTooltipString('<b>Clip traces</b> to cutoff time/frame: when activated, data points beyond the cutoff position are ignored.');
40-
ttstr3 = wrapHtmlTooltipString('<b>Split trace in two</b> at cutoff position: the molecule will be duplicated in the molecule list and will be given a starting point set to the cutoff position, whereas the original trace will be clip at the cutoff position.');
41-
ttstr4 = wrapHtmlTooltipString('<b>Select data</b> to analyze for photobleaching detection.');
42-
ttstr5 = wrapHtmlTooltipString('Apply current photobleaching settings to all molecules.');
36+
ttstr0 = wrapHtmlTooltipString('Select a photobleaching <b>detection method</b>: <b>Manual</b> when the photobleaching cutoff is defined by the user (blinking detection is not available), <b>Threshold</b> when the photobleaching cutoff and blink-off events are automatically detected on discretized trajectories using a relative intensity threshold.');
37+
ttstr1 = wrapHtmlTooltipString('<b>Global cutoff time point:</b> time point at which the first photobleaching event was detected; the cutoff is shown by a solid vertical bar in trajectory. The "Clip" option in panel Plot uses this time point to rescale the time axis.');
38+
ttstr3 = wrapHtmlTooltipString('<b>Bleaching and blinking statistics</b>: opens a tool to visualize and fit survival or blinking time distributions.');
39+
ttstr4 = wrapHtmlTooltipString('<b>Select an emitter</b> to configure <b>Threshold</b> photobleaching/blinking detection for.');
40+
ttstr5 = wrapHtmlTooltipString('Apply current photobleaching/blinking settings to all molecules.');
41+
ttstr6 = wrapHtmlTooltipString('<b>Emitter''s cutoff time point</b>: time point at which photobleaching was detected for this particular emitter; the cutoff is shown by a dotted vertical bar in trajectory plots.');
42+
ttstr7 = wrapHtmlTooltipString('<b>Data threshold</b>: data value (relative to max. signal value) below which the discretized trajectory is considered to be in the <b>"off" state</b>. The "off" state is represented with a gray-background in the trajectory plots. <b>Photobleaching</b> cutoff is determined when the discretized data dwells 100%% of the remaining time in the "off" state.');
43+
ttstr8 = wrapHtmlTooltipString('<b>Minimum bleaching time</b>: minimum duration for the last "off" dwell time to be considered as photobleaching instead of blinking.');
4344

4445
% parents
4546
h_fig = h.figure_MASH;
4647
h_pan = h.uipanel_TP_photobleaching;
4748

4849
% dimensions
4950
pospan = get(h_pan,'position');
50-
wcb0 = getUItextWidth(str3,p.fntun,p.fntsz1,'normal',p.tbl)+p.wbox;
5151
wbut0 = getUItextWidth(str4,p.fntun,p.fntsz1,'normal',p.tbl)+p.wbrd;
5252
wbut1 = getUItextWidth(str7,p.fntun,p.fntsz1,'normal',p.tbl)+p.wbrd;
53-
wpop1 = pospan(3)-2*p.mg-4*p.mg/fact-3*wedit0-wbut1;
54-
wpop0 = pospan(3)-2*p.mg-3*p.mg/fact-wedit0-wcb0-wbut0;
53+
wpop2 = pospan(3)-2*p.mg-4*p.mg/fact-3*wedit0-wbut1;
54+
wpop0 = getUItextWidth(str2{2},p.fntun,p.fntsz1,'normal',p.tbl)+p.warr;
55+
wedit1 = pospan(3)-2*p.mg-2*p.mg/fact-wpop0-wbut0;
5556

5657
% GUI
5758
x = p.mg;
@@ -65,7 +66,7 @@
6566

6667
h.text_photobl_stop = uicontrol('style','text','parent',h_pan,'units',...
6768
p.posun,'fontunits',p.fntun,'fontsize',p.fntsz1,'position',...
68-
[x,y,wedit0,htxt0],'string',str1);
69+
[x,y,wedit1,htxt0],'string',str1);
6970

7071
x = p.mg;
7172
y = y-hpop0;
@@ -80,55 +81,51 @@
8081

8182
h.edit_photobl_stop = uicontrol('style','edit','parent',h_pan,'units',...
8283
p.posun,'fontunits',p.fntun,'fontsize',p.fntsz1,'position',...
83-
[x,y,wedit0,hedit0],'callback',{@edit_photobl_stop_Callback,h_fig},...
84+
[x,y,wedit1,hedit0],'callback',{@edit_photobl_stop_Callback,h_fig},...
8485
'tooltipstring',ttstr1);
8586

86-
x = x+wedit0+p.mg/fact;
87-
88-
h.checkbox_cutOff = uicontrol('style','checkbox','parent',h_pan,'units',...
89-
p.posun,'fontunits',p.fntun,'fontsize',p.fntsz1,'position',...
90-
[x,y,wcb0,hedit0],'string',str3,'tooltipstring',ttstr2,'callback',...
91-
{@checkbox_cutOff_Callback,h_fig});
92-
93-
x = x+wcb0+p.mg/fact;
87+
x = x+wedit1+p.mg/fact;
9488

95-
h.pushbutton_TP_pbSplit = uicontrol('style','pushbutton','parent',h_pan,...
89+
h.pushbutton_TP_pbStats = uicontrol('style','pushbutton','parent',h_pan,...
9690
'units',p.posun,'fontunits',p.fntun,'fontsize',p.fntsz1,'position',...
9791
[x,y,wbut0,hedit0],'string',str4,'tooltipstring',ttstr3,'callback',...
98-
{@pushbutton_TP_pbSplit_Callback,h_fig});
92+
{@pushbutton_TP_pbStats_Callback,h_fig});
9993

10094
x = p.mg;
10195
y = y-p.mg/fact-htxt0;
10296

10397
h.text_bleachChan = uicontrol('style','text','parent',h_pan,'units',...
10498
p.posun,'fontunits',p.fntun,'fontsize',p.fntsz1,'position',...
105-
[x,y,wpop1,htxt0],'string',str5);
99+
[x,y,wpop2,htxt0],'string',str5);
106100

107101
y = y-hpop0;
108102

109103
h.popupmenu_bleachChan = uicontrol('style','popupmenu','parent',h_pan,...
110104
'units',p.posun,'fontunits',p.fntun,'fontsize',p.fntsz1,'position',...
111-
[x,y,wpop1,hpop0],'string',str6,'tooltipstring',ttstr4,'callback',...
105+
[x,y,wpop2,hpop0],'string',str6,'tooltipstring',ttstr4,'callback',...
112106
{@popupmenu_bleachChan_Callback,h_fig});
113107

114-
x = x+wpop1+p.mg/fact;
108+
x = x+wpop2+p.mg/fact;
115109
y = y+(hpop0-hedit0)/2;
116110

117111
h.edit_photoblParam_01 = uicontrol('style','edit','parent',h_pan,'units',...
118112
p.posun,'fontunits',p.fntun,'fontsize',p.fntsz1,'position',...
119-
[x,y,wedit0,hedit0],'callback',{@edit_photoblParam_01_Callback,h_fig});
113+
[x,y,wedit0,hedit0],'tooltipstring',ttstr7,'callback',...
114+
{@edit_photoblParam_01_Callback,h_fig});
120115

121116
x = x+wedit0+p.mg/fact;
122117

123118
h.edit_photoblParam_02 = uicontrol('style','edit','parent',h_pan,'units',...
124119
p.posun,'fontunits',p.fntun,'fontsize',p.fntsz1,'position',...
125-
[x,y,wedit0,hedit0],'callback',{@edit_photoblParam_02_Callback,h_fig});
120+
[x,y,wedit0,hedit0],'tooltipstring',ttstr8,'callback',...
121+
{@edit_photoblParam_02_Callback,h_fig});
126122

127123
x = x+wedit0+p.mg/fact;
128124

129125
h.edit_photoblParam_03 = uicontrol('style','edit','parent',h_pan,'units',...
130126
p.posun,'fontunits',p.fntun,'fontsize',p.fntsz1,'position',...
131-
[x,y,wedit0,hedit0],'callback',{@edit_photoblParam_03_Callback,h_fig});
127+
[x,y,wedit0,hedit0],'callback',{@edit_photoblParam_03_Callback,h_fig},...
128+
'tooltipstring',ttstr6);
132129

133130
x = pospan(3)-p.mg-wbut1;
134131

MASH-FRET/source/GUI/mod-trace-processing/buildPanelTPplot.m

Lines changed: 43 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,33 @@
1919
% created by MH, 19.10.2019
2020

2121
% default
22+
wedit0 = 50;
2223
hedit0 = 20;
2324
htxt0 = 13;
2425
hpop0 = 22;
2526
fact = 5;
26-
str0 = 'top laser';
27-
str1 = 'top data';
28-
str2 = {'Select a laser'};
29-
str3 = {'Select a channel'};
30-
str4 = 'bottom data';
31-
str5 = {'Select a trace'};
27+
str0 = 'laser';
28+
str1 = 'channel';
29+
str2 = {'Select upon which laser illumination intensity trajectories are shown.'};
30+
str3 = {'Select for which recording channel intensity trajectories are shown'};
31+
str4 = 'ratio data';
32+
str5 = {'Select which intensity-ratio trajectories are shown.'};
3233
str6 = 'hold scale';
3334
str7 = 'min';
3435
str8 = 'max';
3536
str9 = 'x-axis:';
36-
str10 = 'hold start';
37+
str10 = 'start';
38+
str11 = 'hold';
39+
str12 = 'clip axis';
3740
ttstr0 = wrapHtmlTooltipString('Select a <b>laser wavelength</b> to show intensity-time traces from, in the top plot.');
3841
ttstr1 = wrapHtmlTooltipString('Select an <b>emission channel</b> to show ntensity-time traces from, in the top plot.');
3942
ttstr2 = wrapHtmlTooltipString('Select the <b>ratio-time traces</b> to show in the bottom plot.');
4043
ttstr3 = wrapHtmlTooltipString('<b>Hold</b> limits of intensity axis for <b>all molecules</b> to the defined intensities.');
4144
ttstr4 = wrapHtmlTooltipString('<b>Lower limit</b> of intensity axis.');
4245
ttstr5 = wrapHtmlTooltipString('<b>Upper limit</b> of intensity axis.');
43-
ttstr6 = wrapHtmlTooltipString('<b>Clip</b> time axis of traces for <b>all molecules</b> to the defined starting point: data points prior this time point will be ignored.');
44-
ttstr7 = wrapHtmlTooltipString('<b>Starting point</b> in time traces: data points below this frame will be ignored.');
46+
ttstr6 = wrapHtmlTooltipString('<b>Hold</b> starting point for <b>all molecules</b>: data points prior this time point will be ignored.');
47+
ttstr7 = wrapHtmlTooltipString('<b>Starting point</b> in time traces: data points prior this time point will be ignored.');
48+
ttstr8 = wrapHtmlTooltipString('<b>Clip traces</b> to time limits: when activated, time axis is bound to starting point and photobleaching cutoff.');
4549

4650
% parents
4751
h_fig = h.figure_MASH;
@@ -51,11 +55,12 @@
5155
pospan = get(h_pan,'position');
5256
wtxt0 = (pospan(3)-2*p.mg-p.mg/fact)/2;
5357
wtxt1 = pospan(3)-2*p.mg;
54-
wtxt3 = getUItextWidth(str9,p.fntun,p.fntsz1,'bold',p.tbl);
58+
wtxt3 = getUItextWidth(str9,p.fntun,p.fntsz1,'normal',p.tbl);
5559
wcb0 = getUItextWidth(str6,p.fntun,p.fntsz1,'normal',p.tbl)+p.wbox;
56-
wedit0 = (pospan(3)-2*p.mg-2*p.mg/fact-wcb0)/2;
57-
wcb1 = getUItextWidth(str10,p.fntun,p.fntsz1,'normal',p.tbl)+p.wbox;
58-
wedit1 = pospan(3)-2*p.mg-2*p.mg/fact-wcb1-wtxt3;
60+
wedit1 = (pospan(3)-2*p.mg-2*p.mg/fact-wcb0)/2;
61+
wcb1 = getUItextWidth(str11,p.fntun,p.fntsz1,'normal',p.tbl)+p.wbox;
62+
wcb2 = getUItextWidth(str12,p.fntun,p.fntsz1,'normal',p.tbl)+p.wbox;
63+
mgspec = pospan(3)-2*p.mg-2*p.mg/fact-wcb1-wtxt3-wedit0-wcb2;
5964

6065
% GUI
6166
x = p.mg;
@@ -98,28 +103,28 @@
98103

99104
h.edit_plot_minint = uicontrol('style','edit','parent',h_pan,...
100105
'units',p.posun,'fontunits',p.fntun,'fontsize',p.fntsz1,'position',...
101-
[x,y,wedit0,hedit0],'tooltipstring',ttstr4,'callback',...
106+
[x,y,wedit1,hedit0],'tooltipstring',ttstr4,'callback',...
102107
{@edit_plot_minint_Callback,h_fig});
103108

104109
y = y+hedit0;
105110

106111
h.text_plot_minint = uicontrol('style','text','parent',h_pan,...
107112
'units',p.posun,'fontunits',p.fntun,'fontsize',p.fntsz1,'position',...
108-
[x,y,wedit0,htxt0],'string',str7);
113+
[x,y,wedit1,htxt0],'string',str7);
109114

110-
x = x+wedit0+p.mg/fact;
115+
x = x+wedit1+p.mg/fact;
111116
y = y-hedit0;
112117

113118
h.edit_plot_maxint = uicontrol('style','edit','parent',h_pan,...
114119
'units',p.posun,'fontunits',p.fntun,'fontsize',p.fntsz1,'position',...
115-
[x,y,wedit0,hedit0],'tooltipstring',ttstr5,'callback',...
120+
[x,y,wedit1,hedit0],'tooltipstring',ttstr5,'callback',...
116121
{@edit_plot_maxint_Callback,h_fig});
117122

118123
y = y+hedit0;
119124

120125
h.text_plot_maxint = uicontrol('style','text','parent',h_pan,...
121126
'units',p.posun,'fontunits',p.fntun,'fontsize',p.fntsz1,'position',...
122-
[x,y,wedit0,htxt0],'string',str8);
127+
[x,y,wedit1,htxt0],'string',str8);
123128

124129
x = p.mg;
125130
y = y-hedit0-p.mg/fact-htxt0;
@@ -136,24 +141,37 @@
136141
{@popupmenu_plotBottom_Callback,h_fig});
137142

138143
x = p.mg;
139-
y = y-p.mg-hedit0+(hedit0-htxt0)/2;
144+
y = y-p.mg-htxt0-hedit0+(hedit0-htxt0)/2;
140145

141146
h.text_TP_xaxis = uicontrol('style','text','parent',h_pan,'units',p.posun,...
142147
'fontunits',p.fntun,'fontsize',p.fntsz1,'fontweight','bold','position',...
143148
[x,y,wtxt3,htxt0],'string',str9,'horizontalalignment','left');
144149

145150
x = x+wtxt3+p.mg/fact;
146-
y = y-(hedit0-htxt0)/2;
151+
y = y-(hedit0-htxt0)/2+hedit0;
152+
153+
h.text_TP_plot_start = uicontrol('style','text','parent',h_pan,'units',...
154+
p.posun,'fontunits',p.fntun,'fontsize',p.fntsz1,'position',...
155+
[x,y,wedit0,htxt0],'string',str10);
156+
157+
y = y-hedit0;
158+
159+
h.edit_photobl_start = uicontrol('style','edit','parent',h_pan,'units',...
160+
p.posun,'fontunits',p.fntun,'fontsize',p.fntsz1,'position',...
161+
[x,y,wedit0,hedit0],'callback',{@edit_photobl_start_Callback,h_fig},...
162+
'tooltipstring',ttstr7);
163+
164+
x = x+wedit0+p.mg/fact;
147165

148166
h.checkbox_photobl_fixStart = uicontrol('style','checkbox','parent',h_pan,...
149167
'units',p.posun,'fontunits',p.fntun,'fontsize',p.fntsz1,'position',...
150-
[x,y,wcb1,hedit0],'string',str10,'tooltipstring',ttstr6,'callback',...
168+
[x,y,wcb1,hedit0],'string',str11,'tooltipstring',ttstr6,'callback',...
151169
{@checkbox_photobl_fixStart_Callback,h_fig});
152170

153-
x = x+wcb1+p.mg/fact;
171+
x = x+wcb1+mgspec;
154172

155-
h.edit_photobl_start = uicontrol('style','edit','parent',h_pan,'units',...
173+
h.checkbox_cutOff = uicontrol('style','checkbox','parent',h_pan,'units',...
156174
p.posun,'fontunits',p.fntun,'fontsize',p.fntsz1,'position',...
157-
[x,y,wedit1,hedit0],'callback',{@edit_photobl_start_Callback,h_fig},...
158-
'tooltipstring',ttstr7);
175+
[x,y,wcb2,hedit0],'string',str12,'tooltipstring',ttstr8,'callback',...
176+
{@checkbox_cutOff_Callback,h_fig});
159177

0 commit comments

Comments
 (0)