-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaddStatsToWormGaussian.m
More file actions
executable file
·48 lines (40 loc) · 1.84 KB
/
addStatsToWormGaussian.m
File metadata and controls
executable file
·48 lines (40 loc) · 1.84 KB
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
function worms=addStatsToWormGaussian(worms,saveOrNot)
%% ========================================================================
% Name: addStatsToWormGaussian.m
% Version: 2.5, 25th Apr. 2013
% Author: Allison Wu
% Command: worms=addStatsToWormGaussian(worms)
% Description:
% - add new stats, such as delta stats, ratioSigmaXY and randStats to
% an exisiting worms structure from wormGaussianFit.mat
%% ========================================================================
if nargin==1
saveOrNot=true;
end;
for j=1:length(worms)
% Adding the delta stats
if ~isempty(worms{j}.spotDataVectors)
deltaStats=calculateDeltaStats(worms{j}.spotDataVectors.dataMat);
% Add the ratioSigmaXY
ratioSigmaXY=worms{j}.spotDataVectors.sigmax./worms{j}.spotDataVectors.sigmay;
I= ratioSigmaXY>1;
ratioSigmaXY(I)=worms{j}.spotDataVectors.sigmay(I)./worms{j}.spotDataVectors.sigmax(I);
% Add the randStats and percentiles of cumulative sum
[randStats,cumSumPrctiles]=calculateRandStats(worms{j}.spotDataVectors.dataMat);
stats2Add=[deltaStats ratioSigmaXY randStats cumSumPrctiles];
statsName={'absDeltaPlusSign','deltaPlusSign','absPlusSignDelta','plusSignPvalue',...
'absDeltaStarSign','deltaStarSign','absStarSignDelta','starSignPvalue',...
'absDeltaCenterBox','deltaCenterBox','absCenterBoxDelta','centerBoxPvalue',...
'ratioSigmaXY','totalAreaRandPvalue','cumSumPrctile90RP','cumSumPrctile70RP','cumSumPrctile50RP','cumSumPrctile30RP',...
'cumSumPrctile90','cumSumPrctile70','cumSumPrctile50','cumSumPrctile30'};
for k=1:length(statsName)
worms{j}.spotDataVectors.(statsName{k})=stats2Add(:,k);
end
worms{j}.version='v2.5';
end
end
if saveOrNot
wormFileName=strrep(worms{1}.segStackFile,'_SegStacks.mat','_wormGaussianFit.mat');
save(wormFileName,'worms')
end;
end