returns the absolute value of the difference in enrichment factors and corresponding statistics.
    specifically, |ef1 - ef2|, the 95% confidence interval, and the 2-sided p-value
    :param score_structure_1: list [(id, best_score, best_query, status, net decoy count, net active count), ...,]
    :param score_structure_2: list [(id, best_score, best_query, status, net decoy count, net active count), ...,]
    :param fpf: float fpf @ which the enrichment factor was calculated
    :return EF1-EF2, EF1-EF2 - CI, EF1-EF2 + CI, p-value) : tuple

def calculate_ef_diff(ef_structure1, ef_structure2, fpf):
    """
    returns the absolute value of the difference in enrichment factors and corresponding statistics.
    specifically, |ef1 - ef2|, the 95% confidence interval, and the 2-sided p-value
    :param score_structure_1: list [(id, best_score, best_query, status, net decoy count, net active count), ...,]
    :param score_structure_2: list [(id, best_score, best_query, status, net decoy count, net active count), ...,]
    :param fpf: float fpf @ which the enrichment factor was calculated
    :return EF1-EF2, EF1-EF2 - CI, EF1-EF2 + CI, p-value) : tuple
    """

    ef1, tpf1 = calculate_ef(ef_structure1, fpf, 'diff')
    ef2, tpf2 = calculate_ef(ef_structure2, fpf, 'diff')

    var1a, var1d, s2_1 = calculate_ef_var(tpf1, fpf)
    var2a, var2d, s2_2 = calculate_ef_var(tpf2, fpf)

    covara, covard = calculate_ef_covar(ef_structure1, ef_structure2)

    # standard error
    vardiffa = var2a + var1a - 2 * covara
    vardiffd = var2d * s2_2 + var1d * s2_1 + 2 * covard * (s2_2 ** 0.5) * (s2_1 ** 0.5)

    p = len([x for x in ef_structure1 if x[3] == '1'])
    n = len([x for x in ef_structure2 if x[3] == '0'])

    se = (1 / fpf) * ((vardiffa / p) + (vardiffd / n)) ** 0.5

    # 95% confidence interval
    ci = se * stats.t.ppf(1 - 0.025, n + p - 1)

    # bounds
    diff = ef1 - ef2
    lower = diff - ci
    upper = diff + ci

    # 2-sided p-value
    tt = ((diff ** 2) ** 0.5)/ se
    p_value = 2 * stats.t.sf(tt, n + p - 1)

    return (ef1, ef2, diff, (lower, upper), p_value)