close all;
clear all;

A = load('/projects/NBL/reference_files/flanking/sizes.txt');
S = load('/projects/NBL/reference_files/flanking/knownGene.merged.sizes');

F1=load('/projects/NBL/reference_files/flanking/knownGene.p1k.merged.sizes.clean');
F2=load('/projects/NBL/reference_files/flanking/knownGene.p2k.merged.sizes.clean');
F3=load('/projects/NBL/reference_files/flanking/knownGene.p3k.merged.sizes.clean');
F4=load('/projects/NBL/reference_files/flanking/knownGene.p4k.merged.sizes.clean');
F5=load('/projects/NBL/reference_files/flanking/knownGene.p5k.merged.sizes.clean');

figure(1);
plot(cumsum(sort(S)))
hold on
plot(cumsum(sort(A)), '--')
plot(1:length(F1),cumsum(sort(F1)),'r')
plot(1:length(F2),cumsum(sort(F2)),'g')
plot(1:length(F3),cumsum(sort(F3)),'k')
plot(1:length(F4),cumsum(sort(F4)),'c')
plot(1:length(F5),cumsum(sort(F5)),'m')

grid on
legend('no flanks','no Flanks, all Genes','1000bp flanks', '2000bp flanks','3000bp flanks','4000bp flanks','5000bp flanks');
xlabel('Number of Genes');
ylabel('Sum of Merged sizes');
title('Cumulative Sum of merged gene sizes at different Flanking Windows');
