def handle_oncogene_results(permutation_result, num_permutations):
    """Takes in output from multiprocess_permutation function and converts to
    a better formatted dataframe.

    Parameters
    ----------
    permutation_result : list
        output from multiprocess_permutation

    Returns
    -------
    permutation_df : pd.DataFrame
        formatted output suitable to save
    """
    mycols = ['gene', 'num recurrent', 'position entropy',
              'mean vest score', 'entropy p-value',
              'vest p-value', 'Total Mutations', 'Unmapped to Ref Tx']
    permutation_df = pd.DataFrame(permutation_result, columns=mycols)

    # get benjamani hochberg adjusted p-values
    permutation_df['entropy BH q-value'] = mypval.bh_fdr(permutation_df['entropy p-value'])
    permutation_df['vest BH q-value'] = mypval.bh_fdr(permutation_df['vest p-value'])

    # combine p-values
    permutation_df['tmp entropy p-value'] = permutation_df['entropy p-value']
    permutation_df['tmp vest p-value'] = permutation_df['vest p-value']
    permutation_df.loc[permutation_df['entropy p-value']==0, 'tmp entropy p-value'] = 1. / num_permutations
    permutation_df.loc[permutation_df['vest p-value']==0, 'tmp vest p-value'] = 1. / num_permutations
    permutation_df['combined p-value'] = permutation_df[['entropy p-value', 'vest p-value']].apply(mypval.fishers_method, axis=1)
    permutation_df['combined BH q-value'] = mypval.bh_fdr(permutation_df['combined p-value'])
    del permutation_df['tmp vest p-value']
    del permutation_df['tmp entropy p-value']

    # order output
    permutation_df = permutation_df.set_index('gene', drop=False)  # make sure genes are indices
    permutation_df['num recurrent'] = permutation_df['num recurrent'].fillna(-1).astype(int)  # fix dtype isssue
    col_order = ['gene', 'Total Mutations', 'Unmapped to Ref Tx',
                 'num recurrent', 'position entropy',
                 'mean vest score', 'entropy p-value',
                 'vest p-value', 'combined p-value', 'entropy BH q-value',
                 'vest BH q-value', 'combined BH q-value']
    permutation_df = permutation_df.sort_values(by=['combined p-value'])
    return permutation_df[col_order]