
%% from Kan, Enos, Korkmazhan et al., 2020; Part 2

%this code uses output from u-track software (Jaqaman et al., 2008)
%Many bits of code here are adopted from Mathworks tutorials/posts and
%forums like GitHub

%need to make empty megapoolwnt and megapoolcontrol as below and run single files for each pool to accumulate into the megapools.
%% plotting mega pools
megapoolwnt=[];
megapoolcontrol=[];

%before proceeding, need to accumulate into megapoolwnt and megapoolcontrol
%the corresponding pools by running Part 1 for each pool.
%%

figure
histogram(megapoolwnt,'Normalization','pdf','FaceAlpha',0.3,'EdgeColor','none','FaceColor',1.7*[0.25 0.25 0.25]);
hold on
histogram(megapoolcontrol,'Normalization','pdf','FaceAlpha',0.4,'EdgeColor','none','FaceColor',0.8*[0.25 0.25 0.25]);
legend('Wnt3A','Control','FontSize',25,'Location','North')
xlim([0 30])
set(findall(gca,'-property','FontSize'),'FontSize',20,'FontWeight','bold')
ylabel('Probability Density','FontSize',20,'FontWeight','bold') 
xlabel('Numbers of molecules','FontSize',20,'FontWeight','bold') 
%ratio to single GFP
hold off
axes('Position',[.30 .5 .20 .28])
box on
histogram(megapoolwnt,'Normalization','pdf','FaceAlpha',0.3,'EdgeColor','none','FaceColor',1.7*[0.25 0.25 0.25]);
set(gca, 'YScale', 'log')
set(findall(gca,'-property','FontSize'),'FontSize',20,'FontWeight','bold')
hold off
axes('Position',[.54 .5 .20 .28])
box on
histogram(megapoolcontrol,'Normalization','pdf','FaceAlpha',0.4,'EdgeColor','none','FaceColor',0.8*[0.25 0.25 0.25]);
set(gca, 'YScale', 'log')
set(findall(gca,'-property','FontSize'),'FontSize',20,'FontWeight','bold')
%set(findall(gcf,'-property','FontSize'),'FontSize',20)
hold off

prctile(transpose(megapoolwnt),90)
prctile(transpose(megapoolcontrol),90)



prctile(transpose(megapoolwnt),95)
prctile(transpose(megapoolcontrol),95)

