def complement_alleles(s):
    """Complement an allele string.

    This will apply the following translation table to the alleles:

        A -> T
        G -> C

    and vice versa.

    Other characters will be left as-is.

    """
    trans = str.maketrans("ATGCatgc", "TACGtacg")
    return s.translate(trans)[::-1]