From 6247c5e4c8c9daa69fbd11411f05fdaed3cebda4 Mon Sep 17 00:00:00 2001 From: jakebeal Date: Thu, 17 Jan 2019 05:50:11 -0600 Subject: [PATCH 1/7] count number of events removed by filtering --- code/@ColorModel/read_filtered_au.m | 6 +++++- code/@ColorModel/readfcs_compensated_ERF.m | 6 ++++-- code/@ColorModel/readfcs_compensated_au.m | 6 ++++-- code/per_color_constitutive_analysis.m | 11 +++++++---- code/read_data.m | 5 +++-- tests/test_batch_analysis.m | 5 +++++ 6 files changed, 28 insertions(+), 11 deletions(-) diff --git a/code/@ColorModel/read_filtered_au.m b/code/@ColorModel/read_filtered_au.m index 6a6b8bc9..0cf9a72c 100644 --- a/code/@ColorModel/read_filtered_au.m +++ b/code/@ColorModel/read_filtered_au.m @@ -9,7 +9,7 @@ % exception, as described in the file LICENSE in the TASBE analytics % package distribution's top directory. -function [data fcshdr] = read_filtered_au(CM,filename) +function [data,fcshdr,n_removed] = read_filtered_au(CM,filename) % Get read FCS file and select channels of interest [fcsunscaled fcshdr rawfcs] = fca_readfcs(filename); if (isempty(fcshdr)) @@ -28,3 +28,7 @@ % if requested to dequantize, add a random value in [-0.5, 0.5] if(CM.dequantize), data = data + rand(size(data)) - 0.5; end; + + % count how many have been removed, all told + n_removed = size(rawfcs,1) - size(data,1); + \ No newline at end of file diff --git a/code/@ColorModel/readfcs_compensated_ERF.m b/code/@ColorModel/readfcs_compensated_ERF.m index 2a607c77..92fa4272 100644 --- a/code/@ColorModel/readfcs_compensated_ERF.m +++ b/code/@ColorModel/readfcs_compensated_ERF.m @@ -9,11 +9,11 @@ % exception, as described in the file LICENSE in the TASBE analytics % package distribution's top directory. -function data = readfcs_compensated_ERF(CM,filename,with_AF,floor) +function [data,n_removed] = readfcs_compensated_ERF(CM,filename,with_AF,floor) if(CM.initialized<1), TASBESession.error('TASBE:ReadFCS','Unresolved','Cannot read ERF: ColorModel not yet resolved'); end; % ensure initted % Read to arbitrary units - audata = readfcs_compensated_au(CM,filename,with_AF,floor); + [audata,n_preremoved] = readfcs_compensated_au(CM,filename,with_AF,floor); % Translate each (processed) channel to ERF channel ERF_channel_data = zeros(size(audata)); @@ -47,3 +47,5 @@ if numel(data) Date: Thu, 17 Jan 2019 06:14:15 -0600 Subject: [PATCH 2/7] actually apply drop-thresholds in sample statistics counts --- code/compute_sample_statistics.m | 4 +++- code/subpopulation_statistics.m | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/code/compute_sample_statistics.m b/code/compute_sample_statistics.m index f35161fa..7c66df88 100644 --- a/code/compute_sample_statistics.m +++ b/code/compute_sample_statistics.m @@ -40,9 +40,11 @@ popcmeans = zeros(n_components,n_channels); popcstds = zeros(n_components,n_channels); popcweights = zeros(n_components,n_channels); +drop_thresholds = zeros(n_channels,1); for k=1:n_channels % compute channel-specific drop threshold: drop_threshold = au_to_ERF(colorModel,getChannel(colorModel,k),get_pem_drop_threshold(analysisParams)); + drop_thresholds(k) = drop_threshold; % divide into included/excluded set pos = data(:,k)>drop_threshold; @@ -76,7 +78,7 @@ nonexpressing = sum(nonexpressing_set); % Create (possibly filtered) subpopulation statistics [note: ignore excluded, as already calculated above] -[counts means stds] = subpopulation_statistics(getBins(analysisParams), data, c_index, 'geometric'); +[counts,means,stds] = subpopulation_statistics(getBins(analysisParams), data, c_index, 'geometric', drop_thresholds); if numel(data) plasmid_counts = estimate_plasmids(PEM,means(:,c_index)); fraction_active = estimate_fraction_active(PEM, means(:,c_index)); diff --git a/code/subpopulation_statistics.m b/code/subpopulation_statistics.m index 7a89be3e..a68ab39e 100644 --- a/code/subpopulation_statistics.m +++ b/code/subpopulation_statistics.m @@ -9,7 +9,8 @@ % exception, as described in the file LICENSE in the TASBE analytics % package distribution's top directory. -function [counts, means, stds, excluded] = subpopulation_statistics(BSeq,data,selector,mode) +function [counts, means, stds, excluded] = subpopulation_statistics(BSeq,data,selector,mode,drop_thresholds) +if nargin<5, drop_thresholds = []; end; bedges = get_bin_edges(BSeq); @@ -24,7 +25,9 @@ switch(mode) case 'geometric' for i=1:n - which = find(data(:,selector)>bedges(i) & data(:,selector)<=bedges(i+1)); + selection = data(:,selector)>bedges(i) & data(:,selector)<=bedges(i+1); + if ~isempty(drop_thresholds), selection = selection & data(:,selector)>drop_thresholds(selector); end; + which = find(selection); counts(i) = numel(which); for j=1:ncol From 95e1d55939703b880d369b3c1bebb332afec1888 Mon Sep 17 00:00:00 2001 From: jakebeal Date: Thu, 17 Jan 2019 06:18:12 -0600 Subject: [PATCH 3/7] allow for minor drift in gate definition in batch test --- tests/test_batch_analysis.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_batch_analysis.m b/tests/test_batch_analysis.m index fd26133a..8da17c76 100644 --- a/tests/test_batch_analysis.m +++ b/tests/test_batch_analysis.m @@ -209,8 +209,8 @@ % raw, filtered firstlast_event_counts = [220379 183753; 161222 145854]; -assertEqual(results{1}.n_removed, firstlast_event_counts(1,1)-firstlast_event_counts(2,1) ); -assertEqual(results{14}.n_removed, firstlast_event_counts(1,2)-firstlast_event_counts(2,2) ); +assertElementsAlmostEqual(results{1}.n_removed, firstlast_event_counts(1,1)-firstlast_event_counts(2,1), 'relative', 1e-2); +assertElementsAlmostEqual(results{14}.n_removed, firstlast_event_counts(1,2)-firstlast_event_counts(2,2), 'relative', 1e-2); function test_batch_analysis_plot_warnings % Test for warnings in plot_batch_histograms From 6bce27edd96819686aba689d04f86da8b31cc96c Mon Sep 17 00:00:00 2001 From: jakebeal Date: Mon, 21 Jan 2019 06:38:53 -0600 Subject: [PATCH 4/7] working on test updates --- tests/test_batchAnalysisOutput.m | 60 ++++++++++++++-------------- tests/test_batch_analysis.m | 58 +++++++++++++-------------- tests/test_batch_excel.m | 61 ++++++++++++++--------------- tests/test_batch_output_excel.m | 60 ++++++++++++++-------------- tests/test_plusminus_analysis.m | 28 ++++++------- tests/test_sizebeads.m | 6 +++ tests/test_transfercurve_analysis.m | 2 +- tests/test_transfercurve_excel.m | 2 +- 8 files changed, 141 insertions(+), 136 deletions(-) diff --git a/tests/test_batchAnalysisOutput.m b/tests/test_batchAnalysisOutput.m index 4b83e148..f02fdf3b 100644 --- a/tests/test_batchAnalysisOutput.m +++ b/tests/test_batchAnalysisOutput.m @@ -111,7 +111,7 @@ % The first five rows should be enough to verify writing the histogram file % correctly. expected_bincounts = [... - 6799 2200 1383; + 6799 637 36; % clipped by the drop threshold 8012 2732 2696; 8780 3327 2638; 8563 4637 2632; @@ -119,38 +119,38 @@ ]; % Means and stddevs tests writing the statistics file correctly. -expected_means = 1e5 * [... - 0.2217 2.4948 4.1064 - 0.2219 2.4891 4.0757 - 0.2211 2.5766 4.2599 - 0.2205 2.5874 4.3344 - 0.2216 2.5099 4.3095 - 0.2255 2.4862 4.2764 - 0.2281 2.5457 4.2586 - 0.2539 2.5739 4.4073 - 0.3791 2.4218 4.6213 - 0.4891 2.3266 4.7217 - 0.6924 2.1068 4.6593 - 1.0930 1.7513 5.6729 - 1.5909 1.5451 6.7144 - 1.9472 1.4175 7.4609 +expected_means = [... + 22170 260800 429100 + 22200 260700 426500 + 22110 269300 444900 + 22050 271400 454400 + 22160 262600 450600 + 22550 260800 448200 + 22820 266800 445000 + 25400 268800 460800 + 37920 253000 482200 + 48930 242800 492200 + 69260 220000 486300 + 109400 182500 592500 + 159100 160100 697900 + 194800 146800 772000 ]; expected_stds = [... - 1.6006 6.7653 8.1000 - 1.5990 6.8670 8.1306 - 1.5981 6.8650 8.1230 - 1.6036 6.9155 8.2135 - 1.6035 6.7565 8.1069 - 1.6427 6.8020 8.2742 - 1.7030 6.7618 8.1220 - 1.9914 6.7701 8.2937 - 3.0568 6.4579 8.4052 - 3.6868 6.1704 8.4187 - 4.5068 5.8686 8.2393 - 5.2819 5.2780 8.7369 - 5.6018 4.7061 8.5892 - 5.5773 4.3900 8.4391 + 1.601 6.611 7.921 + 1.600 6.702 7.942 + 1.599 6.710 7.944 + 1.603 6.746 8.014 + 1.604 6.599 7.922 + 1.643 6.641 8.080 + 1.703 6.595 7.936 + 1.992 6.613 8.106 + 3.057 6.308 8.224 + 3.688 6.028 8.242 + 4.508 5.731 8.056 + 5.283 5.163 8.538 + 5.603 4.613 8.392 + 5.578 4.301 8.263 ]; expected_gmm_means = 10.^[... diff --git a/tests/test_batch_analysis.m b/tests/test_batch_analysis.m index 8da17c76..25a38a2d 100644 --- a/tests/test_batch_analysis.m +++ b/tests/test_batch_analysis.m @@ -62,7 +62,7 @@ % Check results in results: result1_expected_bincounts = [... - 6806 2178 1373; + 6806 637 0; % clipped by the drop threshold 8017 2753 2706; 8782 3323 2637; 8558 4640 2623; @@ -125,37 +125,37 @@ ]; result_expected_means = 1e5 * [... - 0.2213 2.4796 4.0832 - 0.2217 2.4605 4.0592 - 0.2201 2.5462 4.2334 - 0.2192 2.5524 4.2831 - 0.2202 2.4833 4.2658 - 0.2230 2.4613 4.2593 - 0.2246 2.5221 4.2116 - 0.2488 2.5455 4.3739 - 0.3723 2.3947 4.5774 - 0.4764 2.2973 4.6921 - 0.6808 2.0812 4.6243 - 1.0768 1.7335 5.6471 - 1.5798 1.5283 6.6706 - 1.9350 1.4045 7.4507 + 0.2214 2.5920 4.2576 + 0.2217 2.5773 4.2344 + 0.2201 2.6618 4.4116 + 0.2193 2.6768 4.4791 + 0.2202 2.5979 4.4447 + 0.2230 2.5794 4.4459 + 0.2246 2.6410 4.3857 + 0.2489 2.6600 4.5635 + 0.3723 2.5019 4.7657 + 0.4765 2.3962 4.8756 + 0.6809 2.1736 4.8155 + 1.0768 1.8055 5.8724 + 1.5798 1.5830 6.9178 + 1.9350 1.4546 7.6877 ]; result_expected_stds = [... - 1.5964 6.7127 8.0237 - 1.5955 6.7718 8.0481 - 1.5855 6.7734 8.0462 - 1.5881 6.8054 8.0832 - 1.5876 6.6713 7.9815 - 1.6027 6.7166 8.1935 - 1.6348 6.6764 7.9794 - 1.8831 6.6863 8.2016 - 2.9448 6.3741 8.2915 - 3.5238 6.0771 8.3279 - 4.3923 5.7805 8.1472 - 5.1748 5.2045 8.6548 - 5.5516 4.6337 8.5021 - 5.5331 4.3324 8.3937 + 1.5964 6.5596 7.8289 + 1.5955 6.6127 7.8521 + 1.5856 6.6173 7.8504 + 1.5881 6.6379 7.8693 + 1.5876 6.5152 7.7858 + 1.6027 6.5557 7.9894 + 1.6348 6.5152 7.7879 + 1.8831 6.5316 7.9963 + 2.9448 6.2255 8.0919 + 3.5238 5.9371 8.1359 + 4.3923 5.6446 7.9458 + 5.1748 5.0904 8.4391 + 5.5515 4.5412 8.2867 + 5.5330 4.2440 8.2005 ]; % Blue, Yellow, Red diff --git a/tests/test_batch_excel.m b/tests/test_batch_excel.m index d69e2f96..0a295df2 100644 --- a/tests/test_batch_excel.m +++ b/tests/test_batch_excel.m @@ -19,7 +19,7 @@ % Yellow, Red, Blue result1_expected_bincounts = [... - 2178 1373 6806; + 637 36 6806; % clipped by the drop threshold 2753 2706 8017; 3323 2637 8782; 4640 2623 8558; @@ -81,38 +81,37 @@ 0 0 0; ]; - result_expected_means = 1e5 * [... - 2.4796 4.0832 0.2213 - 2.4605 4.0592 0.2217 - 2.5462 4.2334 0.2201 - 2.5524 4.2831 0.2192 - 2.4833 4.2658 0.2202 - 2.4613 4.2593 0.2230 - 2.5221 4.2116 0.2246 - 2.5455 4.3739 0.2488 - 2.3947 4.5774 0.3723 - 2.2973 4.6921 0.4764 - 2.0812 4.6243 0.6808 - 1.7335 5.6471 1.0768 - 1.5283 6.6706 1.5798 - 1.4045 7.4507 1.9350 + result_expected_means = [... + 260800 429100 22170 + 260700 426500 22200 + 269300 444900 22110 + 271400 454400 22050 + 262600 450600 22160 + 260800 448200 22550 + 266800 445000 22820 + 268800 460800 25400 + 253000 482200 37920 + 242800 492200 48930 + 220000 486300 69260 + 182500 592500 109400 + 160100 697900 159100 + 146800 772000 194800 ]; result_expected_stds = [... - 6.7127 8.0237 1.5964 - 6.7718 8.0481 1.5955 - 6.7734 8.0462 1.5855 - 6.8054 8.0832 1.5881 - 6.6713 7.9815 1.5876 - 6.7166 8.1935 1.6027 - 6.6764 7.9794 1.6348 - 6.6863 8.2016 1.8831 - 6.3741 8.2915 2.9448 - 6.0771 8.3279 3.5238 - 5.7805 8.1472 4.3923 - 5.2045 8.6548 5.1748 - 4.6337 8.5021 5.5516 - 4.3324 8.3937 5.5331 + 6.702 7.942 1.600 + 6.710 7.944 1.599 + 6.746 8.014 1.603 + 6.599 7.922 1.604 + 6.641 8.080 1.643 + 6.595 7.936 1.703 + 6.613 8.106 1.992 + 6.308 8.224 3.057 + 6.028 8.242 3.688 + 5.731 8.056 4.508 + 5.163 8.538 5.283 + 4.613 8.392 5.603 + 4.301 8.263 5.578 ]; result_expected1_gmm_means = [... @@ -146,7 +145,7 @@ % spot-check name, bincenter, bin-count assertEqual(results{1}.condition, 'Dox 0.1'); assertElementsAlmostEqual(log10(results{1}.bincenters([1 10 40 end])), [4.0500 4.9500 7.9500 9.9500], 'relative', 1e-2); - assertElementsAlmostEqual(results{1}.bincounts, result1_expected_bincounts, 'relative', 1e-2); + assertElementsAlmostEqual(results{1}.bincounts, result1_expected_bincounts, 'relative', 1e-2, 50); assertEqual(results{14}.condition, 'Dox 2000'); assertElementsAlmostEqual(log10(results{14}.bincenters([1 10 40 end])), [4.0500 4.9500 7.9500 9.9500], 'relative', 1e-2); diff --git a/tests/test_batch_output_excel.m b/tests/test_batch_output_excel.m index 7ada09c8..6c570747 100644 --- a/tests/test_batch_output_excel.m +++ b/tests/test_batch_output_excel.m @@ -55,7 +55,7 @@ % The first five rows should be enough to verify writing the histogram file % correctly. expected_bincounts = [... - 2200 1383 6799; + 637 36 6799; % clipped by the drop threshold 2732 2696 8012; 3327 2638 8780; 4637 2632 8563; @@ -63,38 +63,38 @@ ]; % Means and stddevs tests writing the statistics file correctly. - expected_means = 1e5 * [... - 2.4948 4.1064 0.2217 - 2.4891 4.0757 0.2219 - 2.5766 4.2599 0.2211 - 2.5874 4.3344 0.2205 - 2.5099 4.3095 0.2216 - 2.4862 4.2764 0.2255 - 2.5457 4.2586 0.2281 - 2.5739 4.4073 0.2539 - 2.4218 4.6213 0.3791 - 2.3266 4.7217 0.4891 - 2.1068 4.6593 0.6924 - 1.7513 5.6729 1.0930 - 1.5451 6.7144 1.5909 - 1.4175 7.4609 1.9472 + expected_means = [... + 260800 429100 22170 + 260700 426500 22200 + 269300 444900 22110 + 271400 454400 22050 + 262600 450600 22160 + 260800 448200 22550 + 266800 445000 22820 + 268800 460800 25400 + 253000 482200 37920 + 242800 492200 48930 + 220000 486300 69260 + 182500 592500 109400 + 160100 697900 159100 + 146800 772000 194800 ]; expected_stds = [... - 6.7653 8.1000 1.6006 - 6.8670 8.1306 1.5990 - 6.8650 8.1230 1.5981 - 6.9155 8.2135 1.6036 - 6.7565 8.1069 1.6035 - 6.8020 8.2742 1.6427 - 6.7618 8.1220 1.7030 - 6.7701 8.2937 1.9914 - 6.4579 8.4052 3.0568 - 6.1704 8.4187 3.6868 - 5.8686 8.2393 4.5068 - 5.2780 8.7369 5.2819 - 4.7061 8.5892 5.6018 - 4.3900 8.4391 5.5773 + 6.611 7.921 1.601 + 6.702 7.942 1.600 + 6.710 7.944 1.599 + 6.746 8.014 1.603 + 6.599 7.922 1.604 + 6.641 8.080 1.643 + 6.595 7.936 1.703 + 6.613 8.106 1.992 + 6.308 8.224 3.057 + 6.028 8.242 3.688 + 5.731 8.056 4.508 + 5.163 8.538 5.283 + 4.613 8.392 5.603 + 4.301 8.263 5.578 ]; expected_gmm_means = 10.^[... diff --git a/tests/test_plusminus_analysis.m b/tests/test_plusminus_analysis.m index fe732ae3..eec375db 100644 --- a/tests/test_plusminus_analysis.m +++ b/tests/test_plusminus_analysis.m @@ -69,7 +69,7 @@ % Check results in results: expected_ratios1 = [... - 0.9783 1.0086 0.9606 0.9771 0.9354 0.9644 ... + NaN 1.0086 0.9606 0.9771 0.9354 0.9644 ... 1.0185 1.0080 0.9745 1.0056 0.9382 1.0183 ... 0.9451 0.9722 0.9448 0.8899 1.0751 0.9440 ... 0.9175 0.9634 1.0262 0.9926 0.9646 1.0168 ... @@ -79,7 +79,7 @@ NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN; - 0.9166 0.9664 0.8940 0.9385 1.0209 0.9813 ... + NaN 0.9664 0.8940 0.9385 1.0209 0.9813 ... 1.0078 0.9692 0.9432 0.9649 0.9092 0.9043 ... 1.0011 1.0162 0.9402 1.0205 0.9296 0.8528 ... 0.9153 1.0146 0.9160 0.9584 0.9931 0.9313 ... @@ -91,7 +91,7 @@ NaN NaN NaN NaN NaN NaN]'; expected_InSNR1 = [... - -37.8088 -50.4876 -35.5677 -39.6846 -60.2398 -40.4353 ... + NaN -50.4876 -35.5677 -39.6846 -60.2398 -40.4353 ... -45.7498 -35.3940 -40.7624 -34.1766 -59.5005 -41.6042 ... -43.4850 -36.8905 -36.2304 -40.8816 -58.1243 -49.6369 ... -41.7020 -34.3396 -39.2137 -36.2969 -39.8594 -56.6814 ... @@ -101,7 +101,7 @@ NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN; - -32.0705 -33.5707 -51.4860 -45.2050 -46.0929 -42.2081 ... + NaN -33.5707 -51.4860 -45.2050 -46.0929 -42.2081 ... -35.7295 -41.5390 -51.2181 -41.2107 -41.5073 -31.1404 ... -45.1269 -36.9786 -40.1149 -55.8444 -33.6293 -43.3774 ... -53.6681 -29.8151 -28.8893 -41.4384 -27.7713 -24.3412 ... @@ -113,7 +113,7 @@ NaN NaN NaN NaN NaN NaN]'; expected_OutSNR1 = [... - -44.0013 -51.5298 -38.3145 -43.4382 -34.0322 -39.4484 ... + NaN -51.5298 -38.3145 -43.4382 -34.0322 -39.4484 ... -45.3694 -52.6413 -42.4398 -56.0358 -35.0818 -46.4625 ... -37.3607 -43.7595 -37.7257 -31.5290 -35.7296 -37.6141 ... -34.1023 -40.9637 -43.9824 -54.2742 -40.2003 -45.8642 ... @@ -123,7 +123,7 @@ NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN; - -32.0242 -39.2975 -29.5771 -34.4862 -44.2632 -45.0543 ... + NaN -39.2975 -29.5771 -34.4862 -44.2632 -45.0543 ... -52.7365 -40.7116 -35.3894 -39.8367 -31.6605 -31.6725 ... -71.9792 -48.6811 -37.0106 -46.7376 -35.7282 -28.9247 ... -33.8540 -49.3235 -33.6035 -39.1766 -54.5511 -33.3914 ... @@ -135,13 +135,13 @@ NaN NaN NaN NaN NaN NaN]'; expected_ratios2 = [... - 0.9921 0.8515 0.9436 0.9039 0.8732 0.8401 0.8830 0.8175 0.7666 0.7003 ... + NaN 0.8515 0.9436 0.9039 0.8732 0.8401 0.8830 0.8175 0.7666 0.7003 ... 0.7233 0.5937 0.6280 0.5979 0.6195 0.6211 0.4905 0.4894 0.4615 0.3566 ... 0.3546 0.3169 0.2954 0.2417 0.2115 0.1937 0.1664 0.1710 0.1462 0.1269 ... 0.1049 0.0955 0.0988 0.0733 0.0762 0.0807 0.0631 0.0567 0.0469 NaN ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN; - 0.9271 0.9924 0.8857 0.9436 0.8938 0.8439 0.8657 0.7836 0.7623 0.7237 ... + NaN 0.9924 0.8857 0.9436 0.8938 0.8439 0.8657 0.7836 0.7623 0.7237 ... 0.6622 0.6388 0.5512 0.5837 0.6193 0.4723 0.4938 0.4422 0.3841 0.3327 ... 0.3230 0.2664 0.2201 0.2117 0.1613 0.1558 0.1474 0.1194 0.1076 0.0936 ... 0.0850 0.0762 0.0660 0.0641 0.0552 0.0520 0.0498 0.0394 0.0328 0.0300 ... @@ -149,13 +149,13 @@ NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN]'; expected_InSNR2 = [... - -21.1882 -26.2867 -21.8448 -17.9864 -20.8516 -19.0734 -18.3335 -17.5163 -17.4387 -15.1872 ... + NaN -26.2867 -21.8448 -17.9864 -20.8516 -19.0734 -18.3335 -17.5163 -17.4387 -15.1872 ... -12.8411 -10.4584 -7.7761 -8.0683 -7.0743 -6.2092 -5.2542 -4.4733 -3.4007 -2.2669 ... -1.1466 0.1529 0.6244 1.7463 2.5537 2.8679 3.4742 3.9855 4.1103 4.1814 ... 4.5746 4.6932 4.1880 4.1644 3.9865 3.4480 3.4781 3.3437 2.7666 NaN ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN; - -16.0746 -16.9708 -18.0594 -15.7344 -16.8694 -16.8607 -16.6613 -16.0137 -14.9443 -12.9653 ... + NaN -16.9708 -18.0594 -15.7344 -16.8694 -16.8607 -16.6613 -16.0137 -14.9443 -12.9653 ... -11.5909 -8.0905 -7.0605 -6.0781 -5.3351 -5.1998 -3.9302 -2.6338 -1.5806 -0.9217 ... -0.0713 1.2294 1.8748 2.2483 2.9876 3.2888 3.6028 3.4828 3.5926 3.5822 ... 3.4890 3.2987 3.1824 2.9410 2.3671 2.2929 1.8390 2.4193 0.7461 0.6434 ... @@ -163,13 +163,13 @@ NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN]'; expected_OutSNR2 = [... - -52.7405 -25.7988 -35.1381 -30.5310 -27.7514 -25.6300 -28.6421 -24.5755 -22.1651 -19.9213 ... + NaN -25.7988 -35.1381 -30.5310 -27.7514 -25.6300 -28.6421 -24.5755 -22.1651 -19.9213 ... -20.8423 -17.0665 -18.7885 -18.2879 -18.9455 -19.0333 -15.6426 -15.5374 -14.9386 -12.2547 ... -11.9919 -10.7504 -9.9555 -8.0221 -6.9940 -6.0030 -4.9270 -4.5762 -3.6708 -2.9414 ... -2.0771 -1.5017 -1.7750 -1.2747 -1.1792 -2.0762 -1.4888 -0.9332 -1.0486 NaN ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN; - -33.1355 -52.3255 -28.4970 -35.1367 -29.5957 -25.9082 -27.3607 -22.7542 -22.0238 -20.5665 ... + NaN -52.3255 -28.4970 -35.1367 -29.5957 -25.9082 -27.3607 -22.7542 -22.0238 -20.5665 ... -18.7798 -18.5022 -16.5700 -17.7626 -18.8904 -15.0606 -15.6683 -14.4813 -13.0611 -11.6190 ... -11.3301 -9.5345 -8.0891 -7.4733 -5.6032 -5.0626 -4.4712 -3.1378 -2.6121 -2.0064 ... -1.1426 -1.0365 -0.6120 -0.8491 -0.5000 -0.6560 -0.5601 -0.4992 -0.6355 -1.0099 ... @@ -178,12 +178,12 @@ assertEqual(numel(results),2); -assertElementsAlmostEqual(results{1}{1}.MeanRatio, [0.9764; 0.8880], 'relative', 0.01); +assertElementsAlmostEqual(results{1}{1}.MeanRatio, [0.9761; 0.8910], 'relative', 0.01); assertElementsAlmostEqual(results{1}{1}.Ratios, expected_ratios1, 'relative', 0.01); assertElementsAlmostEqual(results{1}{1}.InputSNR, expected_InSNR1, 'relative', 0.1); assertElementsAlmostEqual(results{1}{1}.OutputSNR, expected_OutSNR1, 'relative', 0.1); -assertElementsAlmostEqual(results{2}{1}.MeanRatio, [0.2379; 0.1786], 'relative', 0.01); +assertElementsAlmostEqual(results{2}{1}.MeanRatio, [0.2384; 0.1793], 'relative', 0.01); assertElementsAlmostEqual(results{2}{1}.Ratios, expected_ratios2, 'relative', 0.01); assertElementsAlmostEqual(results{2}{1}.InputSNR, expected_InSNR2, 'relative', 0.1); assertElementsAlmostEqual(results{2}{1}.OutputSNR, expected_OutSNR2, 'relative', 0.1); diff --git a/tests/test_sizebeads.m b/tests/test_sizebeads.m index d011757c..861235d0 100644 --- a/tests/test_sizebeads.m +++ b/tests/test_sizebeads.m @@ -83,3 +83,9 @@ assertEqual(getUnits(channels{2}),'MEFL'); assertEqual(getUnits(channels{3}),'Eum'); assertEqual(getUnits(channels{4}),'a.u.'); + + +function test_size_bead_reading + +need to test size channel reading and make sure it doesn't get screwed up by PEM drop + diff --git a/tests/test_transfercurve_analysis.m b/tests/test_transfercurve_analysis.m index 04f98545..fc5d6930 100644 --- a/tests/test_transfercurve_analysis.m +++ b/tests/test_transfercurve_analysis.m @@ -79,7 +79,7 @@ ers = struct(results); result123_expected_bincounts = [... - 1373 1117 1047; + 0 0 0; 2706 2113 2088; 2637 2204 1992; 2623 2132 1995; diff --git a/tests/test_transfercurve_excel.m b/tests/test_transfercurve_excel.m index 7543005e..a39f31aa 100644 --- a/tests/test_transfercurve_excel.m +++ b/tests/test_transfercurve_excel.m @@ -20,7 +20,7 @@ ers = struct(results); result123_expected_bincounts = [... - 1373 1117 1047; + 0 0 0; 2706 2113 2088; 2637 2204 1992; 2623 2132 1995; From 9304ea78c2f2ff60a457c382b911615927e983aa Mon Sep 17 00:00:00 2001 From: jakebeal Date: Mon, 21 Jan 2019 14:38:27 -0600 Subject: [PATCH 5/7] Make translation to calibrated units respect size channels too --- code/@ColorModel/au_to_ERF.m | 12 ++- tests/test_batch_excel.m | 57 ++++++------ tests/test_sizebeads.m | 171 ++++++++++++++++++++++++++++++++++- 3 files changed, 209 insertions(+), 31 deletions(-) diff --git a/code/@ColorModel/au_to_ERF.m b/code/@ColorModel/au_to_ERF.m index 89d7cf64..9c9308af 100644 --- a/code/@ColorModel/au_to_ERF.m +++ b/code/@ColorModel/au_to_ERF.m @@ -1,4 +1,4 @@ -% AU_TO_ERF translates arbitrary units of a particular channel in a ColorModel object to ERF +% AU_TO_ERF translates arbitrary units of a particular channel in a ColorModel object to ERF (or Eum) % % Copyright (C) 2010-2018, Raytheon BBN Technologies and contributors listed % in the AUTHORS file in TASBE analytics package distribution's top directory. @@ -9,7 +9,15 @@ % package distribution's top directory. function data = au_to_ERF(CM,channel,audata) - % don't attempt to translate for unprocessed channels + % first check if it's the size channel + if ~isempty(CM.size_unit_translation) + if(eq(channel,CM.um_channel)) + data = um_channel_AU_to_um(CM.size_unit_translation,audata); + return; + end + end + + % otherwise, don't attempt to translate for unprocessed channels if(isUnprocessed(channel)), data = audata; return; end ERF_channel_AU_data = translate(CM.color_translation_model,audata,channel,CM.ERF_channel); diff --git a/tests/test_batch_excel.m b/tests/test_batch_excel.m index 0a295df2..22a6059f 100644 --- a/tests/test_batch_excel.m +++ b/tests/test_batch_excel.m @@ -81,37 +81,38 @@ 0 0 0; ]; - result_expected_means = [... - 260800 429100 22170 - 260700 426500 22200 - 269300 444900 22110 - 271400 454400 22050 - 262600 450600 22160 - 260800 448200 22550 - 266800 445000 22820 - 268800 460800 25400 - 253000 482200 37920 - 242800 492200 48930 - 220000 486300 69260 - 182500 592500 109400 - 160100 697900 159100 - 146800 772000 194800 + result_expected_means = 1e5 * [... + 2.5920 4.2576 0.2214 + 2.5773 4.2344 0.2217 + 2.6618 4.4116 0.2201 + 2.6768 4.4791 0.2193 + 2.5979 4.4447 0.2202 + 2.5794 4.4459 0.2230 + 2.6410 4.3857 0.2246 + 2.6600 4.5635 0.2489 + 2.5019 4.7657 0.3723 + 2.3962 4.8756 0.4765 + 2.1736 4.8155 0.6809 + 1.8055 5.8724 1.0768 + 1.5830 6.9178 1.5798 + 1.4546 7.6877 1.9350 ]; result_expected_stds = [... - 6.702 7.942 1.600 - 6.710 7.944 1.599 - 6.746 8.014 1.603 - 6.599 7.922 1.604 - 6.641 8.080 1.643 - 6.595 7.936 1.703 - 6.613 8.106 1.992 - 6.308 8.224 3.057 - 6.028 8.242 3.688 - 5.731 8.056 4.508 - 5.163 8.538 5.283 - 4.613 8.392 5.603 - 4.301 8.263 5.578 + 6.5596 7.8289 1.5964 + 6.6127 7.8521 1.5955 + 6.6173 7.8504 1.5856 + 6.6379 7.8693 1.5881 + 6.5152 7.7858 1.5876 + 6.5557 7.9894 1.6027 + 6.5152 7.7879 1.6348 + 6.5316 7.9963 1.8831 + 6.2255 8.0919 2.9448 + 5.9371 8.1359 3.5238 + 5.6446 7.9458 4.3923 + 5.0904 8.4391 5.1748 + 4.5412 8.2867 5.5515 + 4.2440 8.2005 5.5330 ]; result_expected1_gmm_means = [... diff --git a/tests/test_sizebeads.m b/tests/test_sizebeads.m index 861235d0..beec4d0c 100644 --- a/tests/test_sizebeads.m +++ b/tests/test_sizebeads.m @@ -87,5 +87,174 @@ function test_size_bead_reading -need to test size channel reading and make sure it doesn't get screwed up by PEM drop +CM = setupSizePeakCM(); +% Execute and save the model +CM=resolve(CM); + +% make sure size channel isn't messed up by PEM drop +stem1011 = '../TASBEFlowAnalytics-Tutorial/example_assay/LacI-CAGop_'; +experimentName = 'LacI Transfer Curve'; +bins = BinSequence(-3,0.1,10,'log_bins'); + +AP = AnalysisParameters(bins,{}); +AP=setMinValidCount(AP,100'); +AP=setPemDropThreshold(AP,5'); +AP=setUseAutoFluorescence(AP,false'); + +% Make a map of condition names to file sets +file_pairs = {... + 'Dox 0.1', {[stem1011 'B3_P3.fcs']}; + 'Dox 2000.0', {[stem1011 'C4_P3.fcs']}; + }; + +[results, sampleresults] = per_color_constitutive_analysis(CM,file_pairs,{'EBFP2','EYFP','FSC','SSC'},AP); +save('/tmp/size-batch.mat','AP','bins','file_pairs','results','sampleresults'); + +%%%%%%%%%%%%%%%%%%%%%% +% Run all comparisons + +expectedBinCounts = [... + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 351 0 + 0 0 988 0 + 0 0 1369 0 + 0 0 1558 0 + 0 0 1287 0 + 0 0 1808 0 + 0 0 5069 0 + 0 0 16126 0 + 0 0 54323 0 + 0 0 113083 0 + 0 0 24407 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 362 + 0 0 0 2039 + 0 0 0 6089 + 0 0 0 10663 + 0 0 0 19672 + 0 0 0 33667 + 0 0 0 43173 + 0 0 0 43585 + 0 0 0 32119 + 0 0 0 17692 + 6920 0 0 7481 + 6645 0 0 2635 + 9624 0 0 846 + 8838 4595 0 242 + 10886 4695 0 0 + 13706 6742 0 0 + 10660 6478 0 0 + 11065 7951 0 0 + 7683 8270 0 0 + 4219 8006 0 0 + 1843 7968 0 0 + 568 6619 0 0 + 135 4127 0 0 + 0 3371 0 0 + 0 3108 0 0 + 0 3519 0 0 + 0 3672 0 0 + 0 4319 0 0 + 0 4803 0 0 + 0 5217 0 0 + 0 5254 0 0 + 0 5568 0 0 + 0 5631 0 0 + 0 5470 0 0 + 0 5085 0 0 + 0 4593 0 0 + 0 4243 0 0 + 0 3588 0 0 + 0 2948 0 0 + 0 2428 0 0 + 0 1989 0 0 + 0 1484 0 0 + 0 1168 0 0 + 0 782 0 0 + 0 622 0 0 + 0 387 0 0 + 0 249 0 0 + 0 191 0 0 + 0 124 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + ]; + +expectedMeans = [... + 2.0661e+04 2.5131e+05 7.8537 3.0293e+03; + 1.7136e+05 1.4958e+05 8.2587 2.5810e+03; + ]; + + +for i=1:numel(results) + assertElementsAlmostEqual(expectedMeans(i,:),results{i}.means,'relative',1e-2); +end + +assertElementsAlmostEqual(expectedBinCounts,results{1}.bincounts,'relative',1e-2); From 8160b3b366b0e955e1a060c9660dfd14eeb3975c Mon Sep 17 00:00:00 2001 From: jakebeal Date: Mon, 21 Jan 2019 15:07:28 -0600 Subject: [PATCH 6/7] update last non-passing test --- tests/test_plusminus_excel.m | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/test_plusminus_excel.m b/tests/test_plusminus_excel.m index efbd799c..b84d18d8 100644 --- a/tests/test_plusminus_excel.m +++ b/tests/test_plusminus_excel.m @@ -25,7 +25,7 @@ % Check results in results: expected_ratios1 = [... - 0.9783 1.0086 0.9606 0.9771 0.9354 0.9644 ... + NaN 1.0086 0.9606 0.9771 0.9354 0.9644 ... 1.0185 1.0080 0.9745 1.0056 0.9382 1.0183 ... 0.9451 0.9722 0.9448 0.8899 1.0751 0.9440 ... 0.9175 0.9634 1.0262 0.9926 0.9646 1.0168 ... @@ -35,7 +35,7 @@ NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN; - 0.9166 0.9664 0.8940 0.9385 1.0209 0.9813 ... + NaN 0.9664 0.8940 0.9385 1.0209 0.9813 ... 1.0078 0.9692 0.9432 0.9649 0.9092 0.9043 ... 1.0011 1.0162 0.9402 1.0205 0.9296 0.8528 ... 0.9153 1.0146 0.9160 0.9584 0.9931 0.9313 ... @@ -47,7 +47,7 @@ NaN NaN NaN NaN NaN NaN]'; expected_InSNR1 = [... - -37.8088 -50.4876 -35.5677 -39.6846 -60.2398 -40.4353 ... + NaN -50.4876 -35.5677 -39.6846 -60.2398 -40.4353 ... -45.7498 -35.3940 -40.7624 -34.1766 -59.5005 -41.6042 ... -43.4850 -36.8905 -36.2304 -40.8816 -58.1243 -49.6369 ... -41.7020 -34.3396 -39.2137 -36.2969 -39.8594 -56.6814 ... @@ -57,7 +57,7 @@ NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN; - -32.0705 -33.5707 -51.4860 -45.2050 -46.0929 -42.2081 ... + NaN -33.5707 -51.4860 -45.2050 -46.0929 -42.2081 ... -35.7295 -41.5390 -51.2181 -41.2107 -41.5073 -31.1404 ... -45.1269 -36.9786 -40.1149 -55.8444 -33.6293 -43.3774 ... -53.6681 -29.8151 -28.8893 -41.4384 -27.7713 -24.3412 ... @@ -69,7 +69,7 @@ NaN NaN NaN NaN NaN NaN]'; expected_OutSNR1 = [... - -44.0013 -51.5298 -38.3145 -43.4382 -34.0322 -39.4484 ... + NaN -51.5298 -38.3145 -43.4382 -34.0322 -39.4484 ... -45.3694 -52.6413 -42.4398 -56.0358 -35.0818 -46.4625 ... -37.3607 -43.7595 -37.7257 -31.5290 -35.7296 -37.6141 ... -34.1023 -40.9637 -43.9824 -54.2742 -40.2003 -45.8642 ... @@ -79,7 +79,7 @@ NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN; - -32.0242 -39.2975 -29.5771 -34.4862 -44.2632 -45.0543 ... + NaN -39.2975 -29.5771 -34.4862 -44.2632 -45.0543 ... -52.7365 -40.7116 -35.3894 -39.8367 -31.6605 -31.6725 ... -71.9792 -48.6811 -37.0106 -46.7376 -35.7282 -28.9247 ... -33.8540 -49.3235 -33.6035 -39.1766 -54.5511 -33.3914 ... @@ -91,13 +91,13 @@ NaN NaN NaN NaN NaN NaN]'; expected_ratios2 = [... - 0.9921 0.8515 0.9436 0.9039 0.8732 0.8401 0.8830 0.8175 0.7666 0.7003 ... + NaN 0.8515 0.9436 0.9039 0.8732 0.8401 0.8830 0.8175 0.7666 0.7003 ... 0.7233 0.5937 0.6280 0.5979 0.6195 0.6211 0.4905 0.4894 0.4615 0.3566 ... 0.3546 0.3169 0.2954 0.2417 0.2115 0.1937 0.1664 0.1710 0.1462 0.1269 ... 0.1049 0.0955 0.0988 0.0733 0.0762 0.0807 0.0631 0.0567 0.0469 NaN ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN; - 0.9271 0.9924 0.8857 0.9436 0.8938 0.8439 0.8657 0.7836 0.7623 0.7237 ... + NaN 0.9924 0.8857 0.9436 0.8938 0.8439 0.8657 0.7836 0.7623 0.7237 ... 0.6622 0.6388 0.5512 0.5837 0.6193 0.4723 0.4938 0.4422 0.3841 0.3327 ... 0.3230 0.2664 0.2201 0.2117 0.1613 0.1558 0.1474 0.1194 0.1076 0.0936 ... 0.0850 0.0762 0.0660 0.0641 0.0552 0.0520 0.0498 0.0394 0.0328 0.0300 ... @@ -105,13 +105,13 @@ NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN]'; expected_InSNR2 = [... - -21.1882 -26.2867 -21.8448 -17.9864 -20.8516 -19.0734 -18.3335 -17.5163 -17.4387 -15.1872 ... + NaN -26.2867 -21.8448 -17.9864 -20.8516 -19.0734 -18.3335 -17.5163 -17.4387 -15.1872 ... -12.8411 -10.4584 -7.7761 -8.0683 -7.0743 -6.2092 -5.2542 -4.4733 -3.4007 -2.2669 ... -1.1466 0.1529 0.6244 1.7463 2.5537 2.8679 3.4742 3.9855 4.1103 4.1814 ... 4.5746 4.6932 4.1880 4.1644 3.9865 3.4480 3.4781 3.3437 2.7666 NaN ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN; - -16.0746 -16.9708 -18.0594 -15.7344 -16.8694 -16.8607 -16.6613 -16.0137 -14.9443 -12.9653 ... + NaN -16.9708 -18.0594 -15.7344 -16.8694 -16.8607 -16.6613 -16.0137 -14.9443 -12.9653 ... -11.5909 -8.0905 -7.0605 -6.0781 -5.3351 -5.1998 -3.9302 -2.6338 -1.5806 -0.9217 ... -0.0713 1.2294 1.8748 2.2483 2.9876 3.2888 3.6028 3.4828 3.5926 3.5822 ... 3.4890 3.2987 3.1824 2.9410 2.3671 2.2929 1.8390 2.4193 0.7461 0.6434 ... @@ -119,13 +119,13 @@ NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN]'; expected_OutSNR2 = [... - -52.7405 -25.7988 -35.1381 -30.5310 -27.7514 -25.6300 -28.6421 -24.5755 -22.1651 -19.9213 ... + NaN -25.7988 -35.1381 -30.5310 -27.7514 -25.6300 -28.6421 -24.5755 -22.1651 -19.9213 ... -20.8423 -17.0665 -18.7885 -18.2879 -18.9455 -19.0333 -15.6426 -15.5374 -14.9386 -12.2547 ... -11.9919 -10.7504 -9.9555 -8.0221 -6.9940 -6.0030 -4.9270 -4.5762 -3.6708 -2.9414 ... -2.0771 -1.5017 -1.7750 -1.2747 -1.1792 -2.0762 -1.4888 -0.9332 -1.0486 NaN ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN; - -33.1355 -52.3255 -28.4970 -35.1367 -29.5957 -25.9082 -27.3607 -22.7542 -22.0238 -20.5665 ... + NaN -52.3255 -28.4970 -35.1367 -29.5957 -25.9082 -27.3607 -22.7542 -22.0238 -20.5665 ... -18.7798 -18.5022 -16.5700 -17.7626 -18.8904 -15.0606 -15.6683 -14.4813 -13.0611 -11.6190 ... -11.3301 -9.5345 -8.0891 -7.4733 -5.6032 -5.0626 -4.4712 -3.1378 -2.6121 -2.0064 ... -1.1426 -1.0365 -0.6120 -0.8491 -0.5000 -0.6560 -0.5601 -0.4992 -0.6355 -1.0099 ... From 1b3cd156d28c7136952f2399ffaf67dbe4ff4233 Mon Sep 17 00:00:00 2001 From: jakebeal Date: Mon, 21 Jan 2019 15:37:45 -0600 Subject: [PATCH 7/7] make au_to_ERF correctly distinguish FSC and SSC channels --- code/@ColorModel/au_to_ERF.m | 2 +- tests/test_sizebeads.m | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/code/@ColorModel/au_to_ERF.m b/code/@ColorModel/au_to_ERF.m index 9c9308af..689c242d 100644 --- a/code/@ColorModel/au_to_ERF.m +++ b/code/@ColorModel/au_to_ERF.m @@ -11,7 +11,7 @@ function data = au_to_ERF(CM,channel,audata) % first check if it's the size channel if ~isempty(CM.size_unit_translation) - if(eq(channel,CM.um_channel)) + if(find(CM,channel)==find(CM,CM.um_channel)) data = um_channel_AU_to_um(CM.size_unit_translation,audata); return; end diff --git a/tests/test_sizebeads.m b/tests/test_sizebeads.m index beec4d0c..ab1acb71 100644 --- a/tests/test_sizebeads.m +++ b/tests/test_sizebeads.m @@ -79,10 +79,16 @@ assertElementsAlmostEqual(UT.peak_sets{1}, expected_peaks, 'relative', 1e-2); channels = getChannels(CM); +% make sure units are right assertEqual(getUnits(channels{1}),'MEFL'); assertEqual(getUnits(channels{2}),'MEFL'); assertEqual(getUnits(channels{3}),'Eum'); assertEqual(getUnits(channels{4}),'a.u.'); +% make sure translations are right +assertElementsAlmostEqual(au_to_ERF(CM,getChannel(CM,1),1),2267.3, 'relative', 1e-2); +assertElementsAlmostEqual(au_to_ERF(CM,getChannel(CM,2),1),1163.3, 'relative', 1e-2); +assertElementsAlmostEqual(au_to_ERF(CM,getChannel(CM,3),1),0.0083, 'relative', 1e-2); +assertElementsAlmostEqual(au_to_ERF(CM,getChannel(CM,4),1),1, 'relative', 1e-2); function test_size_bead_reading