def _one_autocorr(seq, window, scale):
    """Private function used for calculating auto-correlated pydpi for 1 given sequence, window and an AA scale.
    This function is used by the :py:func:`calculate_autocorr` method of :py:class:`PeptideDescriptor`.

    :param seq: {str} amino acid sequence to calculate descriptor for
    :param window: {int} correlation-window size
    :param scale: {str} amino acid scale to be used to calculate descriptor
    :return: {numpy.array} calculated descriptor data
    """
    try:
        m = list()
        for l in range(len(seq)):
            m.append(scale[str(seq[l])])
        seqdesc = list()
        for dist in range(window):
            for val in range(len(scale['A'])):
                valsum = list()
                cntr = 0.0
                for pos in range(len(seq)):
                    if pos + dist < len(seq):
                        cntr += 1
                        valsum.append(m[pos][val] * m[pos + dist][val])
                seqdesc.append(sum(valsum) / cntr)
        return seqdesc
    except ZeroDivisionError:
        print(
            'ERROR!\nThe chosen correlation window % i is larger than the sequence %s !'
             % (window, seq))
