%% This script gets some parts of Fig1
%on its own it does not make a lot of sense
%needs to run assembly scripts before or load a working workspace

target = 'Experiment-9396_1_molecule_5_kymograph.tif';

names = false(1, length(barcodeGen_allunmerged));
for n = 1:length(barcodeGen_allunmerged)
    names(n) = strcmp(barcodeGen_allunmerged{n}.name, target);
end

sum(names)

find(names,1)

figure('Color','white')
plot(barcodeGen_allunmerged{205}.rawBarcode(barcodeGen_allunmerged{205}.rawBitmask))
axis tight;
title(sprintf(barcodeGen_allunmerged{205}.name));
set(gca, 'XTick', [], 'YTick', []); % cleaner view
axis off

barcodeGen_allunmerged{205}.name
%plot(barcodeGen_allunmerged{217}.rawBarcode(barcodeGen_allunmerged{217}.rawBitmask))


figure('Color','white')
plot(barcodeGen_allunmerged{217}.rawBarcode(11:250))
axis tight;
title(sprintf(barcodeGen_allunmerged{217}.name));
set(gca, 'XTick', [], 'YTick', []); % cleaner view
axis off

barcodeGen_allunmerged{217}.name


figure('Color','white')
plot(barcodeGen_allunmerged{29}.rawBarcode(barcodeGen_allunmerged{29}.rawBitmask))
axis tight;
title(sprintf(barcodeGen_allunmerged{29}.name));
set(gca, 'XTick', [], 'YTick', []); % cleaner view
axis off

figure('Color','white')
plot(barcodeGen_allunmerged{29}.rawBarcode(6:260))
hold on
plot(barcodeGen_allunmerged{29}.rawBarcode(6:125),'r')
axis tight;
title(sprintf(barcodeGen_allunmerged{29}.name));
set(gca, 'XTick', [], 'YTick', []); % cleaner view
axis off




% a bargroup...
% specifically from 4_allmerged_bothmasked_new
% bcodegen has 746 cGenAll has 29 gorups
figure('Color','white')
plot(barcodeGen{cGenAll{22}.idx(1)}.rawBarcode(12:483))
axis tight;
title(sprintf(barcodeGen{cGenAll{22}.idx(1)}.name));
set(gca, 'XTick', [], 'YTick', []); % cleaner view
axis off

figure('Color','white')
plot(barcodeGen{cGenAll{22}.idx(2)}.rawBarcode(12:284))
axis tight;
title(sprintf(barcodeGen{cGenAll{22}.idx(2)}.name));
set(gca, 'XTick', [], 'YTick', []); % cleaner view
axis off

figure('Color','white')
plot(barcodeGen{cGenAll{22}.idx(3)}.rawBarcode(12:486))
axis tight;
title(sprintf(barcodeGen{cGenAll{22}.idx(3)}.name));
set(gca, 'XTick', [], 'YTick', []); % cleaner view
axis off

figure('Color','white')
plot(cGenAll{22}.rawBarcode)
axis tight;
%title(sprintf(cGenAll{22}.idx));
set(gca, 'XTick', [], 'YTick', []); % cleaner view
axis off



figure('Color','white')
plot(barcodeGen_allunmerged{29}.rawBarcode(6:260))
hold on
plot(barcodeGen_allunmerged{29}.rawBarcode(6:125),'r')
axis tight;
title(sprintf(barcodeGen_allunmerged{29}.name));
set(gca, 'XTick', [], 'YTick', []); % cleaner view
axis off