DE_trans = load([homeDir, 'revision/DESeq_normalization/DE.mat'], 'transGenes');
DE_cis = load([homeDir, 'revision/DESeq_normalization/DE.mat'], 'cisGenes');
DE_trans = DE_trans.transGenes;
DE_cis = DE_cis.cisGenes;

cisGenes1 = intint(goodGenes(cisGenes));
transGenes1 = intint(goodGenes(transGenes));
[x,p] = hypergeom(DE_cis, cisGenes1, intint(goodGenes));
disp(['cis: intersect = ', num2str(x), ', p-value = ', num2str(p)]);
[x,p] = hypergeom(DE_trans, transGenes1, intint(goodGenes));
disp(['trans: intersect = ', num2str(x), ', p-value = ', num2str(p)]);

function [x, p] = hypergeom(l1, l2, bg)
l1 = intersect(l1, bg);
l2 = intersect(l2, bg);
x = length(intersect(l1, l2));
m = length(bg);
k = length(l2);
n = length(l1);
p = hygepdf(x, m, k, n);
end
