def binned_list(allcounts_list,bar_width):
    """A binned list for a histogram of the counts 

    Parameters
    ----------
    allcounts_list : numpy.ndarray
        Output of the counts_genome function
    bar_width : float 
        It could be a function of the length of the genome e.g. bar_width=l_genome/1000

    Returns
    -------
    list
        Binned list 
    """
    
    allcounts_binnedlist = []
    val_counter = 0
    sum_values = 0
    for n in range(len(allcounts_list)):
        if int(val_counter % bar_width) != 0:
            sum_values += allcounts_list[n]
        elif int(val_counter % bar_width) == 0:
            allcounts_binnedlist.append(sum_values)
            sum_values = 0
        val_counter += 1
    allcounts_binnedlist.append(sum_values)
    return allcounts_binnedlist