def vector_as_string(vector, gap="-", alleles=None):
    """Convert a vector of integer encoded alleles to a string.

    Parameters
    ----------
    vector : ndarray, int, (n_pos, )
        1D array of integers.
    gap : str, optional
        Character used to represent gap values.
    alleles : array_like, array_like, str, optional
        Characters used to represent each allele at each position.

    Returns
    -------
    string : str
        String of allele characters

    """
    if alleles is None:
        return "".join(str(a) if a >= 0 else gap for a in vector)
    else:
        return "".join(alleles[i][a] if a >= 0 else gap for i, a in enumerate(vector))