def assign_indices(sorted_one_pos_ranking, consider_gaps=False):
    """
        Given the output of the one positional analysis, this function returns
        the index of each position. As defined by Waegele and Mayer (2007), we
        only consider positions that are unique within the query group and
        distinguish three indices: binary, asymmetric, and noisy.
        We identify them based on the discriminative power, the rank of the
        query group, and the rank of the reference group.
    """

    binary = list()
    asymmetric = list()
    noisy = list()

    # Assign an index for all positions. pos_info is structured as follows
    # [pos, disc. power, (query rank, query max base), (ref rank, ref max base)]
    # An example for pos_info is [434, 1.0, "(1, 'g')", "(1, 'a')"].
    for pos_info in sorted_one_pos_ranking:
        # We only consider positions with unique a character state in the query
        # group (query rank = 1). Consider gaps only if the flag is set. Do not
        # consider positions with unique missing information ('n').
        if (pos_info[2][0] == 1 and (pos_info[2][1] != '-' or consider_gaps) and 
            pos_info[2][1] != 'n'):
            # A discriminative power of 1 is either binary or asymmetric.
            if pos_info[1] == 1:
                # A position is binary if the rank of the reference group is 1.
                # Otherwise, the position is asymmetric.
                if pos_info[3][0] == 1:
                    pos_info.append("binary")
                    binary.append(pos_info)
                else:
                    pos_info.append("asymmetric")
                    asymmetric.append(pos_info)
            else:
                # In case that the discriminative power is less than 1, the
                # position is noisy. In case that the reference rank is 1, the
                # reference and query group have the same unique base. Hence, it
                # is not noisy.
                if pos_info[3][0] > 1:
                    pos_info.append("noisy")
                    noisy.append(pos_info)

    return binary, asymmetric, noisy