def prepare_dataframe(kraken_translate_report_fp,
                      taxonomic_rank,
                      taxa_levels,
                      taxa_levels_idx):
    """Return sets for sample IDs and taxonomy strings.

    Parameters
    ----------
    kraken_translate_report_fp: str
        filepath to output of "kraken translate"
    taxonomic_rank: str
        taxonomy level (e.g., genus or species)
    taxa_levels: dict
        keys are full name taxonomic ranks and values are abbreviated ranks
    taxa_levels_idx: dict
        2-way dict storing integer depths for abbreviated taxonomic ranks

    Returns
    -------
    sample_ids: list
        all unique sample IDs in file
    taxonomies: list
        all unique taxonomies in file
    """
    total_levels = len(taxa_levels)
    taxonomic_rank_level_str = taxa_levels[taxonomic_rank]
    taxonomic_rank_level_int = taxa_levels_idx[taxonomic_rank_level_str]
    if taxonomic_rank_level_int < 6:
        split_on_level = taxa_levels_idx[str(taxonomic_rank_level_int + 1)]
    else:
        # keep full string (to species level)
        split_on_level = '\t'
    sample_ids = set()
    taxonomies = set()
    with open(kraken_translate_report_fp) as kraken_translate_report_f:
        for line in kraken_translate_report_f:
            label, taxonomy = line.strip().split('\t')
            sample_id = label.split('_')[0]
            sample_ids.add(sample_id)
            # record abundance
            if taxonomic_rank_level_str in taxonomy:
                # keep taxonomy string up to specified level
                taxonomy = taxonomy.split(split_on_level)[0]
                taxonomies.add(taxonomy)
    return list(sample_ids), list(taxonomies)