import tqdm


def stage_contigs(df):
    """
    Creates a list of results where each item is a DataFrame of ORFs belonging to a single contig

    Parameters
    ----------
    df: pandas.DataFrame
        Dataframe with contig ids as index and taxonomy at each rank

    Returns
    -------
    contig_res: list
        List of results to submit for processing
    """

    contigs = sorted(df.index.unique())
    total_contigs = len(contigs)
    contig_res = []
    for contig in tqdm.tqdm(contigs, total=total_contigs, unit=" contigs", ncols=100, desc="Staging contigs"):
        contig_res.append(df.loc[contig])
    return contig_res