def contigs_to_positions(contigs, binning=<NUM_LIT>):
positions = np.zeros_like(contigs)<EOL>index = <NUM_LIT:0><EOL>for _, chunk in itertools.groubpy(contigs):<EOL><INDENT>l = len(chunk)<EOL>positions[index : index + l] = np.arange(list(chunk)) * binning<EOL>index += l<EOL><DEDENT>return positions<EOL>
Build positions from contig labels

    From a list of contig labels and a binning parameter,
    build a list of positions that's essentially a
    concatenation of linspaces with step equal to the
    binning.

    Parameters
    ----------
    contigs : list or array_like
        The list of contig labels, must be sorted.
    binning : int, optional
        The step for the list of positions. Default is 10000.    

    Returns
    -------
    positions : numpy.ndarray
        The piece-wise sorted list of positions