def contingency(set1,set2,all_genes):
    """Creates contingency table for gene enrichment
        set1: Set of genes (e.g. regulon)
        set2: Set of genes (e.g. i-modulon)
        all_genes: Set of all genes
    """
        
    tp = len(set1 & set2)
    fp = len(set2 - set1)
    tn = len(all_genes - set1 - set2)
    fn = len(set1 - set2)
    return [[tp,fp],[fn,tn]]