def means2idxarrays(g1, g2, i_bins, c_bins, difference):
    '''take two arrays of values and return the initial values
    and differences as numpy digitised arrays'''

    if difference == "relative":
        # calculate difference between mean values for group1 and group2
        # g1 and g2 will always be same length.
        change = [g1[x] - g2[x] for x in range(0, len(g1))]
        initial = g1
    elif difference == "logfold":
        # JJ bugfix list comprehension...
        change = [np.log2((g2[x]+1.0) /
                          (g1[x]+1.0)) for x in range(0, len(g1))]
        initial = [np.log2(g1[x]+1.0) for x in range(0, len(g1))]

    # Returns an array of len(change) with the index position in c_bins
    # corresponding to the bin in which that value of change falls.
    change_idx = np.digitize(change, c_bins)
    initial_idx = np.digitize(initial, i_bins)

    return(change_idx, initial_idx)
dataset/ETHPy150Open CGATOxford/cgat/scripts/data2spike.py/means2idxarrays/swapped operands of `-`