def divide_clusters(clustered_reads, ref_names):
    """
    Takes the output of cluster_txs and splits them into two groups based on having their name be in ref_names or not.

    Returns a dict mapping cluster IDs to tuples of [ref_txs, non_ref_txs].

    Discards any cluster that does not contain members of both ref and non-ref.

    """
    ref_names = set(ref_names)
    divided_clusters = {}
    for chrom in clustered_reads:
        for cluster_id, tx_list in clustered_reads[chrom].items():
            ref = [tx for tx in tx_list if tx.name in ref_names and len(tx.intron_intervals) > 0]
            iso = [tx for tx in tx_list if tx.name not in ref_names and len(tx.intron_intervals) > 0]
            if len(ref) > 0 and len(iso) > 0:
                divided_clusters[cluster_id] = [ref, iso]
    return divided_clusters