def calculateperformance(true_annotations, predicted_annotations):
    """
    Calculates common classification evaluation metrics.
    :param true_annotations: The ground truth annotations in a sequence. Values in [True, False]
    :param predicted_annotations: The predicted annotations in a sequence. Values in [True, False]
    :return: Dictionary with Sensitivity, Specificity, Precision, NPV, FPR, FDR, FNR, ACC, BACC, F1
    """
    total = len(true_annotations)
    true_pos = 0
    true_neg = 0
    false_pos = 0
    false_neg = 0
    pos = 0
    neg = 0
    for true, pred in zip(true_annotations, predicted_annotations):
        if true:
            pos += 1
            if pred:
                true_pos += 1
            else:
                false_neg += 1
        else:
            neg += 1
            if pred:
                false_pos += 1
            else:
                true_neg += 1
    sens = true_pos/(true_pos+false_neg) if true_pos+false_neg > 0 else 0
    spec = true_neg/(false_pos+true_neg) if false_pos+true_neg > 0 else 0
    prec = true_pos/(true_pos+false_pos) if true_pos+false_pos > 0 else 0
    npv = true_neg/(true_neg+false_neg) if true_neg+false_neg > 0 else 0
    fpr = false_pos/(false_pos+true_neg) if false_pos+true_neg > 0 else 1
    fdr = false_pos/(false_pos+true_pos) if false_pos+true_pos > 0 else 1
    fnr = false_neg/(false_neg+true_pos) if false_neg+true_pos > 0 else 1
    f1 = 2*true_pos/(2*true_pos+false_pos+false_neg) if 2*true_pos+false_pos+false_neg > 0 else 0
    acc = (true_pos+true_neg)/total if total > 0 else 0
    bacc = (true_pos/pos + true_neg/neg)/2 if pos > 0 and neg > 0 else 0
    evaluation = {"sensitivity":    sens,
                  "specificity":    spec,
                  "precision":      prec,
                  "npv":            npv,
                  "fpr":            fpr,
                  "fdr":            fdr,
                  "fnr":            fnr,
                  "acc":            acc,
                  "bacc":           bacc,
                  "f1":             f1}
    return evaluation