forked from TASBE/TASBEFlowAnalytics
-
Notifications
You must be signed in to change notification settings - Fork 1
/
process_plusminus_batch.m
58 lines (50 loc) · 2.62 KB
/
process_plusminus_batch.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
% 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.
function pm_results = process_plusminus_batch( colorModel, batch_description, analysisParams, OSbin)
% batch_description is a cell-array of: {condition_name, inducer_name, plus_level_file_pairs, minus_level_file_pairs}
% pm_results is a cell-array of PlusMinusResults
batch_size = numel(batch_description);
% verify that all files exist
% Begin by scanning to make sure all expected files are present
fprintf('Confirming files are present...\n');
for i=1:batch_size
level_file_pairs = [batch_description{i}{3}; batch_description{i}{4}];
for j=1:size(level_file_pairs,1),
fileset = level_file_pairs{j,2};
for k=1:numel(fileset),
if ~exist(fileset{k},'file'),
error('Could not find file: %s',fileset{k});
end
end
end
end
pm_results = cell(batch_size,1);
for i = 1:batch_size
condition_name = batch_description{i}{1};
inducer_name = batch_description{i}{2};
p_level_file_pairs = batch_description{i}{3};
m_level_file_pairs = batch_description{i}{4};
experiment_name = [condition_name ': ' inducer_name ' +'];
p_experiment = Experiment(experiment_name,{inducer_name}, p_level_file_pairs);
fprintf(['Starting analysis of ' experiment_name '...\n']);
p_sampleresults = process_data(colorModel,p_experiment,analysisParams);
p_results = summarize_data(colorModel,p_experiment,analysisParams,p_sampleresults);
experiment_name = [condition_name ': ' inducer_name ' -'];
m_experiment = Experiment(experiment_name,{inducer_name}, m_level_file_pairs);
fprintf(['Starting analysis of ' experiment_name '...\n']);
m_sampleresults = process_data(colorModel,m_experiment,analysisParams);
m_results = summarize_data(colorModel,m_experiment,analysisParams,m_sampleresults);
fprintf(['Computing comparison for ' condition_name '...\n']);
pm_results{i} = compare_plusminus(p_results,m_results);
if nargin>3, % if supplied an output setting, dump bincounts files
OSp = OSbin; OSp.StemName = [OSp.StemName condition_name '-plus'];
plot_bin_statistics(p_sampleresults,OSp);
OSm = OSbin; OSm.StemName = [OSm.StemName condition_name '-minus'];
plot_bin_statistics(m_sampleresults,OSm);
end
end