def make_transcript_PET_dict(infile):
    """ Given a bedtools intersect file, this function creates a dictionary
        mapping each transcript_ID to a set containing the RNA-PET IDs that
        it matched to. """

    transcript_2_pet = {}   

    with open(infile, 'r') as f:
        for line in f:
            line = line.strip()
            entry = line.split("\t")

            transcript_ID = entry[3]
            rna_pet_ID = entry[9]

            if transcript_ID in transcript_2_pet:
                transcript_2_pet[transcript_ID].add(rna_pet_ID)
            elif rna_pet_ID != "-1":
                transcript_2_pet[transcript_ID] = set()
                transcript_2_pet[transcript_ID].add(rna_pet_ID)
            else:
               transcript_2_pet[transcript_ID] = set()
            
    return transcript_2_pet