-
Notifications
You must be signed in to change notification settings - Fork 0
/
makeSeparateInhibitorGraphs.m
83 lines (83 loc) · 3.45 KB
/
makeSeparateInhibitorGraphs.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
function Stats=makeSeparateInhibitorGraphs(Folder,varargin)
Files=dir(fullfile(Folder,['*' filesep]));
if isempty(varargin)
CommonArgs={'binInterval',10,'xLabel','Concentration (µM)',...
'XLim',[-20 620],'FontSize',12};
else
CommonArgs=varargin;
end
EvaluateBundling=false;
c=1;
for n=1:length(Files)
isDot=strcmp(Files(n).name,{'.','..','.git','eval','ignore','eval_old','done','names'});
if Files(n).isdir && ~any(isDot)
if exist(fullfile(Folder,Files(n).name,'Dilution_series_summary.mat'),'file')==2
Summary=load(fullfile(Folder,Files(n).name,'Dilution_series_summary.mat'),'concentrations','allSpeeds','allLengths','numMTs','labels');
elseif exist(fullfile(Folder,Files(n).name,'summary2.mat'),'file')==2
Summary=load(fullfile(Folder,Files(n).name,'summary2.mat'),'concentrations','allSpeeds','allLengths','numMTs','labels','AllBundling');
EvaluateBundling=true;
elseif exist(fullfile(Folder,Files(n).name,'summary1.mat'),'file')==2
Summary=load(fullfile(Folder,Files(n).name,'summary1.mat'),'concentrations','allSpeeds','allLengths','numMTs','labels');
elseif exist(fullfile(Folder,Files(n).name,'summary.mat'),'file')==2
Summary=load(fullfile(Folder,Files(n).name,'summary.mat'),'allSpeeds','allLengths','numMTs','labels','acquisitionDates');
ConcCsvFile=fullfile(Folder,Files(n).name,'concentrations.csv');
if exist(ConcCsvFile, 'file') == 2
Summary.concentrations=load(ConcCsvFile);
else
Summary.concentrations=Summary.acquisitionDates;
end
elseif exist(fullfile(Folder,Files(n).name,'Speed_summary.mat'),'file')==2
Summary=load(fullfile(Folder,Files(n).name,'Speed_summary.mat'),'allSpeeds','allLengths','numMTs','labels','acquisitionDates');
ConcCsvFile=fullfile(Folder,Files(n).name,'concentrations.csv');
if exist(ConcCsvFile, 'file') == 2
Summary.concentrations=load(ConcCsvFile);
else
Summary.concentrations=Summary.acquisitionDates;
end
else
error('Could not find speed summary matlab file in %s.',fullfile(Folder,Files(n).name));
end
Conc{c}=Summary.concentrations; %#ok<*AGROW>
Sp{c}=Summary.allSpeeds;
Len{c}=Summary.allLengths;
NumMTs{c}=Summary.numMTs;
if EvaluateBundling
Bundl{c}=Summary.AllBundling;
end
DisplayNames{c}=Files(n).name;
c=c+1;
end
end
Control=find(cellfun(@(x) ~isempty(regexpi(x,'Control')),DisplayNames));
if ~isempty(Control)
[~, BinnedSP]=binData(Conc{Control},Sp{Control},CommonArgs{1:2});
[~, BinnedLen]=binData(Conc{Control},Len{Control},CommonArgs{1:2});
[~, BinnedNumMTs]=binData(Conc{Control},num2cell(NumMTs{Control}),CommonArgs{1:2});
if EvaluateBundling
[~, BinnedBundl]=binData(Conc{Control},Bundl{Control},CommonArgs{1:2});
end
end
Stats(c-1)=struct('DisplayName','','Stats',struct());
for n=1:c-1
if n~=Control
Conc{n}=[0;Conc{n}];
Sp{n}=[{BinnedSP(:,1)};Sp{n}];
Len{n}=[{BinnedLen(:,1)};Len{n}];
NumMTs{n}=[{BinnedNumMTs(:,1)};num2cell(NumMTs{n})];
else
NumMTs{n}=num2cell(NumMTs{n});
end
Stats(n).DisplayName=DisplayNames{n};
if EvaluateBundling
if n~=Control
Bundl{n}=[{BinnedBundl(:,1)};Bundl{n}];
end
Stats(n).Stats=makePlotSetFigure(Conc{n},Sp{n},Len{n},NumMTs{n},...
fullfile(Folder,DisplayNames{n}),'Bundling',Bundl{n},...
CommonArgs{:});
else
Stats(n).Stats=makePlotSetFigure(Conc{n},Sp{n},Len{n},NumMTs{n},...
fullfile(Folder,DisplayNames{n}),...
CommonArgs{:});
end
end