% AUTHOR: Abel Szkalisity
%
% DESCRIPTION:
% Create a clustergram to compare wells based on the classification output.
% This script must be run after a complete report was generated for the
% plate.
%
% This is a specific script for post-processing the synthetic dataset. This
% is needed to compensate for the more advanced features available in
% regression.
%
% COPYRIGHT
% Advanced Cell Classifier (ACC) Toolbox. All rights reserved.
% Copyright (C) 2019 Peter Horvath,
% Synthetic and System Biology Unit, Hungarian Academy of Sciences,
% Biological Research Center, Szeged, Hungary; Institute for Molecular
% Medicine Finland, University of Helsinki, Helsinki, Finland.

global CommonHandles;

plateNumber = 1;

N = numel(CommonHandles.Report.CellProps{plateNumber});
dataToCluster = zeros(N,size(CommonHandles.Report.CellProps{plateNumber}{1}{1},2));
labels = cell(1,N);

for i=1:N    
        actWell = CommonHandles.Report.CellProps{plateNumber}{i};
        dataToCluster(i,:) = mean(cell2mat(actWell),1);
        labels{i} = [ ('A'+floor((i-1)/6)) num2str(mod(i-1,6)+1,'%02d')];
end

cc = clustergram(dataToCluster','ColumnLabels',labels);