def editTransSplits(splits, minTransLen):
    """
    Called by transOrigin(), this function takes the splits that could be combined to create the current peptide,
    and sorts them in the required order for the rest of the algorithm to work. We want the longest split to be first
    in each pair, and we want the tuple pairs which have both splits with length less than minTransLen to be last
    in the list.
    :param splits: a list of tuples, where each tuple is a possible pair of subsequences which could be combined to
    make the peptide.
    :param minTransLen: the minimum length that a cleavage must be for its location to be reported in the origin data
    of a trans spliced peptide.
    :return splitsNew: splits sorted so that the longest split in each tuple appears first, and the tuples with both
    splits less than minTransLen at the end of the list.
    """
    #print(splits)
    splits1 = []
    splits2 = []
    for tuple in splits:
        # sort the tuple so that the longest split appears first so that it is checked first
        tuple = sorted(tuple, key=len)
        # we want the tuples which have both splits < MIN_TRANS_LEN to be at the end. We only run
        # them if none of the previous tuples have been found.
        if len(tuple[1]) < minTransLen:
            splits2.append(tuple)
        else:
            splits1.append(tuple)
    splitsNew = splits1 + splits2
    #print(splitsNew)
    return splitsNew