gateHist : makes a histogram for the list of cells in the clist table for the given clist index. It first gates the list if there is a gate field in clist. INPUT : clist : list of cells with time-independent info ind : indices of clist definition used for x and y label [x,y] xx : number of bins cc : color of plot OUTPUT : y : counts xx : values of clist(ind) Copyright (C) 2016 Wiggins Lab Written by Paul Wiggins. University of Washington, 2016 This file is part of SuperSegger. SuperSegger is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. SuperSegger is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with SuperSegger. If not, see <http://www.gnu.org/licenses/>.
0001 function [y,xx] = gateHist(clist, ind, xx, cc) 0002 % gateHist : makes a histogram for the list of cells 0003 % in the clist table for the given clist index. 0004 % It first gates the list if there is a gate field in clist. 0005 % 0006 % INPUT : 0007 % clist : list of cells with time-independent info 0008 % ind : indices of clist definition used for x and y label [x,y] 0009 % xx : number of bins 0010 % cc : color of plot 0011 % 0012 % OUTPUT : 0013 % y : counts 0014 % xx : values of clist(ind) 0015 % 0016 % 0017 % Copyright (C) 2016 Wiggins Lab 0018 % Written by Paul Wiggins. 0019 % University of Washington, 2016 0020 % This file is part of SuperSegger. 0021 % 0022 % SuperSegger is free software: you can redistribute it and/or modify 0023 % it under the terms of the GNU General Public License as published by 0024 % the Free Software Foundation, either version 3 of the License, or 0025 % (at your option) any later version. 0026 % 0027 % SuperSegger is distributed in the hope that it will be useful, 0028 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0029 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0030 % GNU General Public License for more details. 0031 % 0032 % You should have received a copy of the GNU General Public License 0033 % along with SuperSegger. If not, see <http://www.gnu.org/licenses/>. 0034 0035 0036 clist = gate(clist); 0037 ss = size( clist.data ); 0038 NUM_BINS = round((sqrt(ss(1)))); 0039 0040 if ~exist( 'xx', 'var' ); 0041 xx = []; 0042 end 0043 if ~exist( 'cc', 'var' ); 0044 cc = 'b'; 0045 end 0046 0047 nind = numel( ind ); 0048 0049 if nind == 2 0050 if isempty( xx) 0051 [y,xx] =hist3( [clist.data(:,ind(2)),clist.data(:,ind(1))], round(([ NUM_BINS, NUM_BINS])/2) ); 0052 else 0053 [y,xx] =hist3( [clist.data(:,ind(2)),clist.data(:,ind(1))], xx ); 0054 end 0055 imagesc(xx{2},xx{1},y) 0056 set( gca, 'YDir', 'normal' ); 0057 0058 ylabel( clist.def{ind(2)} ); 0059 xlabel( clist.def{ind(1)} ); 0060 0061 elseif nind == 1 0062 if isempty( xx ) 0063 [y,xx] = hist( clist.data(:,ind), NUM_BINS ); 0064 else 0065 [y,xx] = hist( clist.data(:,ind), xx ); 0066 end 0067 0068 clf; 0069 0070 if any(y==0) 0071 plot( xx, y, '.-', 'Color', cc ); 0072 else 0073 semilogy( xx, y, '.-', 'Color', cc ); 0074 end 0075 0076 tmp = ishold; 0077 hold on; 0078 0079 if any(y==0) 0080 plot( mean(clist.data(:,ind))+[0,0], [max(y),min(y(y>0))], ':', 'Color', cc ); 0081 else 0082 semilogy( mean(clist.data(:,ind))+[0,0], [max(y),min(y(y>0))], ':', 'Color', cc ); 0083 end 0084 0085 if ~tmp 0086 hold off; 0087 end 0088 0089 ylabel('Number of Cells'); 0090 xlabel(clist.def{ind}); 0091 else 0092 disp('Error in getHist: too many indices in ind'); 0093 end 0094 0095 0096 0097 end