def get_contrib_read_ids(indexes, reads):
    """
    Takes a set of indexes from assign_reads and the list of read signatures
    plus the dictionary mapping signatures to aligned read IDs and returns
    the set of corresponding aligned read IDs (BAM query IDs).
    """
    hap_read_ids = set()
    for read_idx in indexes:
        for read_id in reads[read_idx]:
            hap_read_ids.add(read_id)
    return hap_read_ids