def kappa(a, b, c, d):
    """           GO term 2
               | yes |  no |        
    -------------------------------   
    GO   | yes |  a  |  b  | 
   term1 |  no |  c  |  d  |


   kapa(GO_1, GO_2) = 1 - (1 - po) / (1 - pe)

   po = (a + d) / (a + b + c + d) 
   marginal_a = ( (a + b) * ( a + c )) / (a + b + c + d)
   marginal_b = ( (c + d) * ( b + d )) / (a + b + c + d)
   pe = (marginal_a + marginal_b) / (a + b + c + d)

"""
    a = float(len(a))
    b = float(len(b))
    c = float(len(c))
    d = float(len(d))

    po = (a + d) / (a + b + c + d) 
    marginal_a = ( (a + b) * ( a + c )) / (a + b + c + d)
    marginal_b = ( (c + d) * ( b + d )) / (a + b + c + d)
    pe = (marginal_a + marginal_b) / (a + b + c + d)

    #print (f" {a} | {b}\n {c} | {d}")
    return 1 - (1 - po) / (1 - pe)