forked from evodevosys/AroSpotFindingSuite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddStatsToTrainingSet.m
executable file
·62 lines (50 loc) · 2.38 KB
/
addStatsToTrainingSet.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
function trainingSet=addStatsToTrainingSet(trainingSet,varargin)
%% ========================================================================
% Name: addStatsToTrainingSet.m
% Version: 2.5, 25th Apr. 2013
% Author: Allison Wu
% Command: trainingSet=addStatsToTrainingSet(trainingSet)
% Description:
% - add new stats, such as delta stats, ratioSigmaXY and randStats to
% an exisiting trainingSet.
%% ========================================================================
% Adding the delta stats
deltaStats=calculateDeltaStats(trainingSet.stats.dataMat);
% Add the ratioSigmaXY
ratioSigmaXY=trainingSet.stats.sigmax./trainingSet.stats.sigmay;
I= ratioSigmaXY>1;
ratioSigmaXY(I)=trainingSet.stats.sigmay(I)./trainingSet.stats.sigmax(I);
% Add the randStats and percentiles of cumulative sum
[randStats,cumSumPrctiles]=calculateRandStats(trainingSet.stats.dataMat);
% Remove some stats
stats2Remove={'sigmax','sigmay','rawIntensity'};
for k=1:length(stats2Remove)
I=strcmp(stats2Remove{k},trainingSet.statsUsed);
trainingSet.dataMatrix.X(:,I)=[];
trainingSet.statsUsed(I)=[];
end
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)
trainingSet.stats.(statsName{k})=stats2Add(:,k);
if sum(strcmp(statsName{k},trainingSet.statsUsed))==0
trainingSet.statsUsed=[trainingSet.statsUsed;statsName(k)];
end
if isfield(trainingSet.stats,statsName{k})
I=strcmp(statsName{k},trainingSet.statsUsed);
trainingSet.dataMatrix.X(:,I)=stats2Add(:,k);
else
trainingSet.dataMatrix.X=[trainingSet.dataMatrix.X stats2Add(:,k)];
end
end
trainingSet.version='ver. 2.5, new stats added';
if isempty(varargin)
FileName=regexp(trainingSet.FileName,'\.','split');
trainingSet.FileName=[FileName{1} '_v2p5.mat'];
end
save(trainingSet.FileName,'trainingSet')
end