def kraken2_transformer(all_rank_summary, output_rank_summaries, ranks):
    'Converts a summary of all ranks from kraken into rank-wise profiles\n    similar to the CAMI-SIM output\n\n    Parameters\n    ----------\n    all_rank_summary\n    output_rank_summaries\n    ranks\n\n    Returns\n    -------\n\n    '
    all_ranks = pd.read_csv(all_rank_summary, sep='\t')
    all_ranks.columns = kraken_columns
    all_ranks['rank'] = all_ranks['rank'].str[0]
    all_ranks = all_ranks.loc[all_ranks['rank'].isin(kraken_rank_dictionary)]
    all_ranks['RANK'] = [kraken_rank_dictionary[key] for key in all_ranks['rank']]
    keep_cols = ['@@TAXID', 'RANK', 'TAXNAME', 'PERCENTAGE']
    for (output_, rank) in zip(output_rank_summaries, ranks):
        sub_df = all_ranks.loc[(all_ranks['RANK'] == rank)]
        sub_df_matching = sub_df[keep_cols]
        sub_df_matching.to_csv(output_, sep='\t', index=False)
Converts a summary of all ranks from kraken into rank-wise profiles
similar to the CAMI-SIM output

Parameters
----------
all_rank_summary
output_rank_summaries
ranks

Returns
-------
def kraken2_transformer(all_rank_summary, output_rank_summaries, ranks):
    'Converts a summary of all ranks from kraken into rank-wise profiles\n    similar to the CAMI-SIM output\n\n    Parameters\n    ----------\n    all_rank_summary\n    output_rank_summaries\n    ranks\n\n    Returns\n    -------\n\n    '
    all_ranks = pd.read_csv(all_rank_summary, sep='\t')
    all_ranks.columns = kraken_columns
    all_ranks['rank'] = all_ranks['rank'].str[0]
    all_ranks = all_ranks.loc[all_ranks['rank'].isin(kraken_rank_dictionary)]
    all_ranks['RANK'] = [kraken_rank_dictionary[key] for key in all_ranks['rank']]
    keep_cols = ['@@TAXID', 'RANK', 'TAXNAME', 'PERCENTAGE']
    for (output_, rank) in zip(output_rank_summaries, ranks):
        sub_df = all_ranks.loc[(all_ranks['RANK'] == rank)]
        sub_df_matching = sub_df[keep_cols]
        sub_df_matching.to_csv(output_, sep='\t', index=False)