-
Notifications
You must be signed in to change notification settings - Fork 0
/
Normalized_Intensity.m
89 lines (73 loc) · 2.16 KB
/
Normalized_Intensity.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
%file to create normalized intensity over time
clear; clc;
name = 'ARL Near and Far Analysis\Human Primary\Human Primary AVI\Run 2\Human Primary 20nM Far Late';
intfilename = [name 'int.xlsx'];
[intensity,txt,raw] = xlsread(intfilename) ;
Sig = intensity;
Normalsig = Sig;
Ncell=length(Sig(1,:));
Nfrm=length(Sig(:,1));
for x=1:Ncell % normalize signals to delta F/Fo, Fo is the minium value for that cell
m=min(Sig(:,x));
Sig(:,x)=(Sig(:,x)-m)/m;
end
figure
plot(Sig)
hold on
plot(mean(Sig,2),'k','LineWidth',3)
title('Intensity over time')
xlabel('Frames')
ylabel('Intensity (F/Fo)')
xlim([0 Nfrm])
figure
plot(mean(Sig,2))
title('mean intensity over time')
xlabel('Frames')
ylabel('Intensity (F/Fo)')
xlim([0 Nfrm])
for x=1:Nfrm % normalize signals to delta F/Fo, Fo is the minium value for that cell
m=min(Normalsig(x,:));
Normalsig(x,:)=(Normalsig(x,:)-m)/m;
end
figure
plot(Normalsig)
hold on
plot(mean(Normalsig,2),'k','LineWidth',3)
title('Normalized Intenisty over time')
xlabel('Frames')
ylabel('Intensity ((F/Fo - min)/min)')
xlim([0 Nfrm])
figure
plot(mean(Normalsig,2))
title('Normalized mean intensity over time')
xlabel('Frames')
ylabel('Normalized Intensity ((F/Fo - min)/min)')
xlim([0 Nfrm])
%{
rng=max(max(Normalsig)); %generate heatmap of cell activity, each row is activity of one cell
HeatMap(Normalsig','colormap',jet(1000),'DisplayRange',rng,'Symmetric',false) %1000
PK=zeros(Nfrm,Ncell);
%Npt=40; %500
Npt = 15;
Aucor=zeros(Npt+1,Ncell);
for x=1:Ncell % find peaks in each trace and setup locations to 1 in PK
[pks,locs]=findpeaks(Normalsig(:,x),'MinPeakProminence',0.4); %1, set lower for more events
PK(locs,x)=1;
if sum(PK(:,x)) > 10 %if excessive events are detected in one cell, the cell is considered null.
PK(:,x)= 0;
end
Aucor(:,x)=autocorr(Normalsig(:,x),Npt);
end
PK1=sum(PK,1);
PK1 = PK1';
disp('for loop 2 done');
plt=PK; %plot indentified events, each column is one cell
for x=1:Ncell
plt(:,x)=plt(:,x)+x;
end
figure
plot(plt)
title('Detected Events')
xlabel('Frames')
ylabel('Cells')
%}