def categorize_tracking(tracking_file):
    """
    Gets transcript id's for each match in the tracking file and sorts
    them into three dictionaries.

    :param tracking_file: tracking file from GffCompare
    :return: tcons_xxx (key): [transcript_id,
                               transcripts_id,
                               transcript_id] (value)
    """
    with open(tracking_file, 'r') as tracking:
        three_match, two_match, no_match = {}, {}, {}
        for line in tracking:
            line = line.split()
            # section containing the transcript match information
            transcripts = line[4::]
            transcript_ids = []

            count = 0
            for transcript in transcripts:
                # No transcript present in position
                if transcript == '-':
                    count += 1
                    transcript_id = transcript
                # transcript present
                else:
                    transcript_id = transcript.split('|')[1]
                transcript_ids.append(transcript_id)

            # 1 transcript was not present
            if count == 1:
                two_match[line[0]] = transcript_ids
            # 2 transcripts were not present
            elif count == 2:
                no_match[line[0]] = transcript_ids
            # all transcripts are present
            else:
                three_match[line[0]] = transcript_ids
    return three_match, two_match, no_match