forked from kdharris101/iss
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathquality_threshold.m
35 lines (29 loc) · 1.44 KB
/
quality_threshold.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
function QualOK = quality_threshold(o,Method)
% QualOK = o.quality_threshold
% quick function that returns a binary saying which spots are above quality
% threshold
%Method = 'DotProduct','Prob' or 'Pixel' to consider gene assignments given
%by o.SpotCodeNo, o.pSpotCodeNo and o.pxSpotCodeNo respectively.
if strcmpi('Prob',Method)
QualOK = (o.pSpotScore>o.pScoreThresh & o.pSpotIntensity>0 | ...
o.pSpotIntensity>o.pIntensityThresh & o.pLogProbOverBackground>o.pLogProbThresh & o.pSpotScore+o.pSpotScoreDev>o.pDevThresh...
& o.pSpotScore>o.pScoreThresh2);
%| o.pSpotIntensity>1000);
elseif strcmpi('Pixel',Method)
QualOK = (o.pxSpotScore>o.pScoreThresh & o.pxSpotIntensity>0 | ...
o.pxSpotIntensity>o.pIntensityThresh & o.pxLogProbOverBackground>o.pLogProbThresh & o.pxSpotScore+o.pxSpotScoreDev>o.pDevThresh...
& o.pxSpotScore>o.pScoreThresh2);
%| o.pSpotIntensity>1000);
elseif strcmpi('DotProduct',Method)
QualOK = (o.SpotCombi & o.SpotScore>o.CombiQualThresh & o.SpotIntensity>o.CombiIntensityThresh & o.SpotScoreDev>o.CombiDevThresh);
else
error('Method not valid, must be DotProduct, Prob or Pixel');
end
% % HACK ALERT
% QualOK = QualOK & o.cSpotIsolated;
nCombiCodes = sum(~strcmp(o.CharCodes, 'EXTRA'));
% now extras - they have their own thresholds, set manually for each type
for i=1:size(o.ExtraCodes,1)
MySpots = (o.SpotCodeNo == nCombiCodes+i);
QualOK(MySpots) = o.SpotIntensity(MySpots)>o.ExtraCodes{i,4};
end