-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEnh_data_explain.m
117 lines (76 loc) · 2.18 KB
/
Enh_data_explain.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
%% Figures for hunchback enhancer modeling ms
%
%%
N = 200;
lambda = 20;
f = zeros(1,N+1); y = f; h = f;
for x = 0:N
f(x+1) = poisspdf(x,lambda);
y(x+1) = pdf('norm',x,lambda,sqrt(lambda));
h(x+1) = pdf('bino',x,N,lambda/N);
end
x=0:N;
figure(1); clf; plot(log(x), f,'r.');
hold on; plot(log(x),y,'y.');
figure(2); clf; plot(x,h,'r.'); set(gcf,'color','k');
set(gca,'fontsize',12);
%% Figure explaining curves from histograms.
% uses data from Plot_DotComps2_hb.m
% data = plot_miss;
x = linspace(0,1,30); % range and number of bins for histogram
xx = linspace(0,1,pts);
sigma = .1;
G = length(data);
X = cell(1,G); XX = cell(1,G); M = cell(1,G); S = cell(1,G);
for k=1:G
X{k} = x;
XX{k} =xx;
M{k} = method;
S{k} = sigma;
end
var_hist = cellfun(@nonzeros,data,'UniformOutput',false);
var_hist = cellfun(@hist,var_hist,X,'UniformOutput',false);
N_var = cellfun(@sum,var_hist,'UniformOutput',false);
dist_var = cellfun(@hist2dist,var_hist,X,XX,M,S,'UniformOutput',false);
set(gcf,'color','k'); colordef black;
figure(1); clf; hist(data{1},linspace(.0,1,30))
h = findobj(gca,'Type','patch');
set(h,'EdgeColor','w','FaceColor','r');
hold on;
y = dist_var{1}/max(dist_var{1})*22;
plot(xx,y,'color','r','LineWidth',3); hold on;
% figure(2); clf;
hist(data{3},linspace(.0,1,30))
h = findobj(gca,'Type','patch');
alpha(.5);
xlim([-.02,1]);
hold on;
y = dist_var{3}/max(dist_var{3})*6;
plot(xx,y,'color','b','LineWidth',3);
ylim([0,25]);
ylabel('number of embryos');
xlabel('fraction of missing nuclei');
%% Normalized version
figure(1); clf;
x =linspace(.0,1,30);
d1 = hist(data{1},x);
y = dist_var{1};
dN = max(y);
d1 = d1/max(d1)*dN;
bar(x,d1,'EdgeColor','w','FaceColor','r');
h = findobj(gca,'Type','patch');
set(h,'EdgeColor','w','FaceColor','r');
hold on;
plot(xx,y,'color','r','LineWidth',3); hold on;
y = dist_var{3};
dN = max(y);
d2 = hist(data{3},x);
d2 = d2/max(d2)*dN;
bar(x,d2);
h = findobj(gca,'Type','patch');
alpha(.5);
xlim([-.02,1]);
plot(xx,y,'color','b','LineWidth',3);
ylim([0,.5]);
ylabel('probability density');
xlabel('fraction of missing nuclei');