forked from TASBE/TASBEFlowAnalytics
-
Notifications
You must be signed in to change notification settings - Fork 1
/
fcs_scatter.m
48 lines (41 loc) · 1.91 KB
/
fcs_scatter.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
function [data figh] = fcs_scatter(filename,xcolor,ycolor,density,range,visible,largeoutliers,linear,filters)
% FCS_SCATTER(filename,xcolor,ycolor,density,range,visible):
% Plot a log-log scatter graph of positive points in FCS file
% Defaults to non-visible, density 10, range = []
% Copyright (C) 2010-2017, Raytheon BBN Technologies and contributors listed
% in the AUTHORS file in TASBE analytics package distribution's top directory.
%
% This file is part of the TASBE analytics package, and is distributed
% under the terms of the GNU General Public License, with a linking
% exception, as described in the file LICENSE in the TASBE analytics
% package distribution's top directory.
if nargin < 6, visible = false; end;
if nargin < 7, largeoutliers = false; end;
if nargin < 8 || isempty(linear), linear = [0 0]; end;
if nargin < 9, filters = {}; end;
[fcsraw,fcshdr,fcsdat] = fca_readfcs(strtrim(filename));
% optional discarding of filtered data (e.g., debris, time contamination)
for i=1:numel(filters)
fcsdat = feval(filters{i},fcshdr,fcsdat);
end
xc = get_fcs_color(fcsdat,fcshdr,xcolor);
yc = get_fcs_color(fcsdat,fcshdr,ycolor);
pos = xc>0 & yc>0;
if linear(1), xv = xc; else xv = log10(xc(pos)); end;
if linear(2), yv = yc; else yv = log10(yc(pos)); end;
if nargin >= 4 && density
h = figure('PaperPosition',[1 1 5 5]);
if ~visible, set(h,'visible','off'); end;
if nargin < 5, range = []; end;
if density >= 1, type = 'image'; else type = 'contour'; end
smoothhist2D([xv yv],10,[200, 200],[],type,range,largeoutliers);
else
h = figure('PaperPosition',[1 1 5 5]);
if ~visible, set(h,'visible','off'); end;
plot(xv,yv,'.','MarkerSize',1);
if (nargin >= 5 && ~isempty(range)), xlim(range(:,1)); ylim(range(:,2)); end;
end
xlabel(['log_{10} ' xcolor ' a.u.']); ylabel(['log_{10} ' ycolor ' a.u.']);
title(sprintf('Scatter of %s vs. %s for %s',xcolor,ycolor,filename));
data = [xc yc];
figh = h;