def prepare_df_annoVar(df):
    """Prepare internal dataframe as input to ANNOVAR.

    Generates a list of all the column names, adding a repeat of position to give start and end, as required by 
    ANNOVAR input format, then reorders the columns to ensure the first 5 are those required by ANNOVAR 
    (chromosome, start position, end position, reference allele, observed allele.) 

    See annovar.openbioinformatics.org/en/latest/user-guide/input/ for more details. 
     """
    # make a list of all column names; position repeats twice for input
    df['position2'] = df['position']
    wanted = ['chromosome', 'position', 'position2','allele1', 'allele2']
    colnames = df.columns

    # list comprehensions to identify first 5 column names
    final_colnames = [col for col in wanted if col in colnames] + [col for col in colnames if col not in wanted]

    # re-order dataframe according to final list of column names and return
    annot_input = df[final_colnames]
    return annot_input