def gap_proportion(sequences, gap_chars='-'):
    """
    Generates a list with the proportion of gaps by index in a set of
    sequences.
    """
    aln_len = None
    gaps = []
    for i, sequence in enumerate(sequences):
        if aln_len is None:
            aln_len = len(sequence)
            gaps = [0] * aln_len
        elif not len(sequence) == aln_len:
            raise ValueError(
                'Unexpected sequence length {0}. Is this an alignment?'.
                format(len(sequence)))
        for j, char in enumerate(sequence.seq):
            if char in gap_chars:
                gaps[j] += 1
    sequence_count = float(i + 1)
    gap_props = [(i / sequence_count) for i in gaps]
    return gap_props
