def filter_threshold(tf1_scores, tf2_scores, pref_scores, tf1_threshold, tf2_threshold):
    """
    Filters scores in a preferences bed file by the following rules
    - if tf1_score < tf1_threshold and tf2_score < tf2_threshold, None
    - if pref_score > 0.0 and tf1_score > tf1_threshold, include
    - if pref_score < 0.0 and tf2_score > tf2_threshold, include
    - if pref_score == 0.0, include
    :param tf1_scores: list of strings containing the scores for TF1
    :param tf2_scores: list of strings containing the scores for TF2
    :param pref_scores: list of strings containing the preference values for TF1 vs TF2
    :param tf1_threshold: NegCtrl threshold for TF1 scores
    :param tf2_threshold: NegCtrl threshold for TF2 scores
    :return: A list of preference scores, filtered by the above
    """
    output_pref_scores = list(pref_scores)
    for i in range(len(tf1_scores)):
        tf1_score, tf2_score, pref_score = float(tf1_scores[i]), float(tf2_scores[i]), float(pref_scores[i])
        if tf1_score < tf1_threshold and tf2_score < tf2_threshold:
            output_pref_scores[i] = None # Signal this to be filtered out later
        elif pref_score > 0.0: # favors tf_1
            # if the source TF score is below the cutoff, zero this score
            if tf1_score < tf1_threshold: output_pref_scores[i] = '0'
        elif pref_score < 0.0: # favors tf_2
            if tf2_score < tf2_threshold: output_pref_scores[i] = '0'
        else: # must be 0.0
            pass
    return output_pref_scores