fname=sprintf('/mnt/dv/wid/projects3/Roy-enhancer-promoter/RMEC/RaoToRoadmapPredictions/Local/%s/%s/chr%s_full/concat_BinomialOutput.txt',trainCell,testCell,chr);
F=importdata(fname);
chr_intr=F.data;
figure;
fig=figure
fig.Units='inches'
fig.PaperUnits='inches'
fig.PaperSize=[6 3]
fig.PaperPosition=[0 0 6 3]
qval=0.05
plot(chr_intr(:,2),chr_intr(:,1),'o','Color',[0.7 0.7 0.7],'MarkerSize',2,'MarkerFaceColor',[0.7 0.7 0.7]);
hold on;
sigs=find(chr_intr(:,3)<0.05);
fprintf('Found %d interactions\n',size(sigs,1));
plot(chr_intr(sigs,2),chr_intr(sigs,1),'o','Color',[0 0 1],'MarkerSize',2,'MarkerFaceColor','b');
[ig,order]=sort(chr_intr(:,3));
plot(chr_intr(order(1:1000),2),chr_intr(order(1:1000),1),'o','Color',[1 0 0],'MarkerSize',2,'MarkerFaceColor','r');
legend({'all';sprintf('q<%.3f',qval);'top1000'});
title(sprintf('Duan Method: %i sig. int.',size(sigs,1)),'fontsize',10)

saveas(fig,sprintf('./CountFigures_LHiCReg_SF1/%s/%s/chr%s.jpg',trainCell,testCell,chr));
