def GetPides(mali, id1, ids, first_res, last_res):
    """calculate pid between sequence id1 and all others in ids."""

    result = []
    sequence1 = mali[id1][first_res:last_res]

    for id2 in ids:
        sequence2 = mali[id2][first_res:last_res]

        # calculate percent identity - gaps treated as separate characters.
        n, t = 0, 0
        for a, b in zip(sequence1, sequence2):
            if a == b:
                n += 1
            t += 1

        result.append(float(n) / t)
    return result